Dart SDK version: 2.13.0-216.0.dev (dev) (Wed Apr 7 15:12:05 2021 -0700) on "windows_x64"
Here is a source code example:
class C<X> {}
typedef A<X extends C<X>> = C<X>;
main() {
A();
}
Analyzer throws a compile error here whereas dart silently passes.
Sample output is:
$> dart test.dart
$ dartanalyzer test.dart
Analyzing test.dart...
error - Couldn't infer type parameter 'X'.
Tried to infer 'C<Object?>' for 'X' which doesn't work:
Type parameter 'X' is declared to extend 'C<X>' producing 'C<C<Object?>>'.
Consider passing explicit type argument(s) to the generic.
- test.dart:5:3 - could_not_infer
1 error found.
Please also note that both analyzer and dart don't throws a compile error for the following code:
class C<X> {}
typedef A<X extends C<X>> = C<X>;
main() {
A a = throw "Error";
}