A super-bounded type can be given as an actual type argument in a function call #33815
Labels
area-dart-model
For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.
dart-model-analyzer-spec
Issues with the analyzer's implementation of the language spec
P4
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Milestone
Consider the following program (variant of example given in #33805):
The response from
dartanalyzer
looks as follows:In the first line of
main
, we are passing the type argumentA<dynamic>
to the invocation oftestme
, and that is in itself a super-bounded type (becauseA<Null>
is regular-bounded, becauseNull <: A<Null>
). Fortestme
there are no constraints on the type argument, and in particular it can be a super-bounded type. So the analyzer should allow this.The second line of
main
is similar, but it illustrates that the analyzer flags an error both for the type argumentA<A<dynamic>>
as a whole, and for the nested type argumentA<dynamic>
. So none of them are allowed to be a super-bounded type, and they should both be allowed.With the common front end, the third line gets the inferred type argument
A<A<dynamic>>
(the same as in the second line), which can be detected by running the program with the VM, due toprint(X)
. With dartanalyzer it is not obvious what the inferred type argument is, but we do not get an error from there.The text was updated successfully, but these errors were encountered: