-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
This issue is based on input from MichaelRFairhurst. The analyzer parser processes a number of different constructs involving initializing formals in a way that is too permissive, or which leads to a crash. This may become a non-issue soon because of the switch to the common front end, but this issue at least serves to document the situation until then.
With dartanalyzer (and dartanalyzer --strong) version 1.25.0-dev.16.4, the following program is accepted, even though it contains a syntax error.
class C {
var t;
C(this.t<T>);
}Apparently, the spurious type argument list <T> is accepted by the parser, but henceforth ignored. The result is 'No issues'.
Here are some more cases, where each variant of the constructor causes a crash:
class C {
var t;
C(int this.t<X>(int y)); //# 01: ok
C(int this.t(int this.x<X>())); //# 02: compile-time error
C(var this.t4<X>(int y)); //# 03: compile-time error
}Apparently, initializing formals for generic functions are not yet handled at all, and this also affects the treatment of wrong initializing formals like x in subtest 02.