sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[analyzer] Generic method instantiation is not applicable to `functionType.call`.

Open eernstg opened this issue 4 years ago • 2 comments

Cf. https://github.com/dart-lang/language/pull/1616.

The analyzer should now report an error for the following program:

void foo<X>(X x) {}

void main() {
  var f = foo; // Create a function object by tearing off `foo`.
  void Function(int) g = f.call; // Use `call` to get a generic instantiation of f.
}

The initialization of g should give rise to a type error, because the generic function type isn't assignable to the non-generic function type, and generic method instantiation does not apply for the call of a function type.

eernstg avatar May 06 '21 10:05 eernstg