Closed
Description
Consider the following program:
X id<X>(X x) => x;
void main() {
int Function(int) f = id; // No problems, instantiates `id` as `id<int>`.
var idVar = id; // Tears off `id`, yielding a generic function object.
int Function(int) g = idVar; // Error.
}
The initialization of g
is a compile-time error, because idVar
is a variable and not a function declaration. However, the analyzer (as of commit ffde158) does not report any errors for this program.
With --enable-experiment=constructor-tearoff
we should get an error at the explicit instantiation idVar<int>
as well, and that error is also missing. Note that this question was discussed here.
Note that this should not be a breaking change, because the CFE already reports this error.