Skip to content

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

@eernstg

Description

@eernstg

Cf. dart-lang/language#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.dart-model-analyzer-specIssues with the analyzer's implementation of the language spectype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions