Crash with non-identifier expression in for (... in ...)
#60358
Labels
area-dart-model
For issues related to conformance to the language spec in the parser, compilers or the CLI analyzer.
cfe-crashes
Crashes in the CFE
P3
A lower priority bug or feature request
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Example:
The
b[0]
is an assignable expression, but not an identifier.The language grammar only allows a single identifier (or declaration) in that position, not a general expression, assignable or not.
(Could potentially allow any assignment pattern, possibly even any assignable expression, as long as it doesn't raise concerns about repeated evaluation.)
The analyzer reports "Unexpected character '['", which is correct. (It has a follow-up error if the
ints
array was typed asList<int>
, saying that you can't assignint
toList<int>
, so it probably error-recovers to an assignment tob
.)The front-end crashes spectacularly in type inferece (DartPad, main branch):
Should have had a parsing error before that when the part before
in
was not a single identifier.The text was updated successfully, but these errors were encountered: