Analyzer: Missing check for well-boundedness #41963
Labels
analyzer-spec
Issues with the analyzer's implementation of the language spec
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
Consider the following program:
The raw types
F1
andF2
that are used as parameter types infoo
are completed by instantiation to bound, yieldingF1<A<dynamic>>
andF2<A<dynamic>>
respectively.However, those two types are not well-bounded: The type argument
A<dynamic>
doesn't satisfy the bound (A<dynamic>
is not a subtype ofA<A<dynamic>>
), so the types are not regular-bounded. They are also not correctly super-bounded, because the type parameter is invariant respectively unused, so the substitution step where extreme types are replaced by the "opposite" type when occurring in a position with the right variance doesn't change anything. SoF1
andF2
simply can't be used raw anywhere.The same type can also not be used explicitly, because it still isn't well-bounded:
However,
dartanalyzer
from commit de3779e does not report any of these errors, so it seems that there is a missing check for such types being well-bounded (or the check occurs, but it replacesdynamic
byNull
/Never
even when it occurs in a position that isn't covariant).The text was updated successfully, but these errors were encountered: