Analyzer doesn't detect compile-time error for mismatched types in constant containers #35748
Labels
analyzer-constants
dart-model-analyzer-spec
Issues with the analyzer's implementation of the language spec
legacy-area-analyzer
Use area-devexp instead.
P2
A bug or feature request we're likely to work on
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Consider the following code (assuming
--enable-experiment=set-literals
):From a static error perspective, the constant declarations of
a
,b
,c
, andd
are all valid, because Object is assignable to int. However, constant evaluation should report an error, because the type of the value ofo
is Object, and it is unsound to store a value of type Object in a list, set, or map where an int is expected.The VM and dart2js report the correct error. The analyzer and DDC don't report any error at all.
The text was updated successfully, but these errors were encountered: