Redirection from const to non-const constructor partially allowed with weird behavior #27617
Labels
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P2
A bug or feature request we're likely to work on
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Milestone
It seems the analyzer (both strong and weak) and the Dart VM allow redirecting from a const constructor to a non-const constructor, but dart2js doesn't. Dart VM even allows printing from such a constructor and side-effects!
Example (code in comments shows other interesting situations):
Dartpad
The code above doesn't result in analyzer warnings.
In dart2js it crashes with:
In Dart VM (in both checked and unchecked modes) the code runs fine and prints:
The text was updated successfully, but these errors were encountered: