Closed
Description
Dart SDK Version: 2.0.0_dev.68.0
OS: Windows 10
The following sample code example declares a function with one optional parametrized argument and than calls it without parameters:
class A<X> {}
testme<X extends A<X>>([X x]) {}
main() { testme(); }
It passes with dart and it seems like a correct result - indeed, if we don't set optional input argument, it should not affect the execution.
However, dartanalyzer throws an error here:
Analyzing test.dart...
error - Couldn't infer type parameter 'X'.
Tried to infer 'A<dynamic>' for 'X' which doesn't work:
Type parameter 'X' declared to extend 'A<A<dynamic>>'.
Consider passing explicit type argument(s) to the generic.
at test.dart:4:10 - strong_mode_could_not_infer
1 error found.
I suppose analyzer should pass here too.