New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve error message when incorrectly using cascades #10332
Comments
I hope to get to recovery before M5, but can't make any promises. Set owner to @bwilkerson. |
Added Analyzer-Recovery label. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
I'm not sure when this changed, but we now produce "Expected an identifier". It's not ideal in this case (you'd kind of like "Extra semicolon"), but it does have advantages for code completion, which might outweigh the disadvantages. At least there's only one error message. Added Fixed label. |
Consider this program that uses cascades, but that has an error (there is an extra ';' after add(1)):
main() {
var n = [];
n..add(1);
..add(2);
}
The new analyzer gives a warning. It took me a while to figure out what was wrong in that line of code:
[warning] Undefined name '' (warning.dart:4:5)
The old analyzer used to say:
file:.../warning.dart:4:4: Unexpected token '..'
3: n..add(1);
4: ..add(2);
~~
file:.../warning.dart:4:6: Unexpected token 'IDENTIFIER' (expected ';')
3: n..add(1);
4: ..add(2);
~~~
Compilation failed with 2 problems.
The text was updated successfully, but these errors were encountered: