[CP][beta channel] Improve messaging on invalid use of >>> #47037
Labels
area-front-end
Use area-front-end for front end / CFE / kernel format related issues.
cherry-pick-review
Issue that need cherry pick triage to approve
merge-to-beta
commit(s) to merge: 72de10d
merge instructions: https://dart-review.googlesource.com/c/sdk/+/211700 (no merge conflicts, but unittests needed infra changes)
What is the issue: Using the
>>>
operator in a <2.14 library results in confusing parser errors because>>>
is parsed as>>
followed by a>
, instead of mentioning that>>>
needs the triple-shift language feature. Runningdart
on this programresults in these confusing messages
What is the fix: The fix is to special case
>>
immediately followed by>
in the parser. This is done just after parsingoperator >
and just before parsing>>
followed by>
as a binary expression. At these points the normal message for an unavailable language feature is reported, instead the parser error it would normally have led to.This means that after the fix, the output for the program above is:
Why cherrypick: Since the triple-shift feature is launched with the upcoming stable release, the messaging should clearly recognize failed attempts to use the features, and not indicate that the feature is unknown.
Risk: Low-medium risk. The parser change is added at points where parser errors are inevitable, but the error recovery might still result in unwanted cascading messages.
Link to original issue(s): #46886
/cc @kevmoo @mit-mit @whesse @athomas @vsmenon @devoncarew @lrhn @jensjoha
The text was updated successfully, but these errors were encountered: