-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onanalyzer-apiIssues that impact the public API of the analyzer packageIssues that impact the public API of the analyzer packagearea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
When inheriting parameter types ie:
class Base {
void f(int x);
}
class Sub extends Base {
f(x); // type of `x` inherited from `Base.f`
}
The inherited type may be a generic function. This leads to confusion in the element model because the enclosing type parameter contexts are assumed to be a discoverable via enclosingElement
.
This means, given
class Base {
void f(void Function<T>(T) x);
}
class Sub extends Base {
f(x); // the type of `x` inherited from `Base.f`
}
the FunctionType
from x
must get a new synthetic Element
so that its parameter T
can be enclosed within the Sub
class.
This is currently working in the above example, but not in more complex examples such as:
void f(List<void Function<T>(T)> x);
in which case the FunctionTypeElement is not copied into a synthetic when f
is overriden without a parameter type annotation, leading to a crash at deserialization time from summaries.
This may also affect other cases:
typedef F = Function<T>();
...
void f(List<F> fs);
// or
void f(Function(Function<T>()) x);
etc.
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onanalyzer-apiIssues that impact the public API of the analyzer packageIssues that impact the public API of the analyzer packagearea-dart-modelFor issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)