Ensure that the type parameters passed to methods outlive the call expression. Fixes #18899.