The following code is accepted by the anaylzer but rejected by the CFE:
class C {
int f() => 0;
}
extension E on int {
void f() {}
}
void test(int? i) {
E(i)?.f();
}
main() {}
The CFE's error message is:
../../tmp/proj/test.dart:10:9: Error: This expression has type 'void' and can't be used.
E(i)?.f();
^
The analyzer is correct; there shuld be no error.
Note however that there should be an error if the return value is actually used, e.g., if the contents of test were changed to print(E(i)?.f());.