CFE and analyzer: constant error when casting null
to nullable extension type.
#53751
Labels
cfe-feature-extension-types
Implement extension types feature in the CFE
feature-extension-types
Implementation of the extension type feature
legacy-area-fe-analyzer-shared
Legacy: Use area-dart-model instead.
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Example:
This errs in both CFE and Analyzer (DartPad, master branch).
Analyze:
CFE:
Guessing this is constant evaluation not being extension-type aware again, like #53610, which is why I tried this workaround.
There is currently no way (that I have found) to create a constant which has an extension type and a representation object of
null
.If I change the code to:
the analyzer error changes to:
CFE/Dart2JS is pretty much the same:
In any case, all of these should be allowed, since
null
is castable toint?
at runtime, and thereforenull as E
, explicitly or implicitly by downcast, should succeed with runtime-typenull
and static typeE
.The text was updated successfully, but these errors were encountered: