[CP][stable channel] Improve messaging on invalid use of >>> #47187
Labels
area-infrastructure
Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.
cherry-pick-approved
Label for approved cherrypick request
merge-to-stable
commit(s) to merge:
01212e3
72de10d
1231e3d
merge instructions: https://dart-review.googlesource.com/c/sdk/+/213043
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. The fix has been verified to work without cascading error 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: