sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Create method/function fixes don't handle type parameters of actual types

Open FMorschel opened this issue 3 days ago • 1 comments

While fixing https://github.com/dart-lang/sdk/issues/61186, I noticed this repro below had no Create method fix:

class A {}

T? Function<T>() g(A a) => a.test<T>;

I've made it work, but if we had:

class A {}

int Function() g(A a) => a.test<int>; // Note this is not a `TypeParameterType`

We should be able to create new type arguments for something like:

class A {
  int test<T>() {}
}

int Function() g(A a) => a.test<int>;

We'd have to think of the correct way to create those type arguments, but I think we can probably come up with a reasonable definition.

The same goes for the invocation case, for both method and function. We currently would create a method/function with no type parameters:

class A {}

int? g(A a) => a.test<int>();

This issue is to track fixing the second case only, since the first case will be handled on a new CL for https://github.com/dart-lang/sdk/issues/61186.

CC @bwilkerson

FMorschel avatar Dec 08 '25 13:12 FMorschel