You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change how the parser reports errors for named parameters that start with `_` in anticipation of supporting private named parameters.
With "private named parameters" some private named parameters are errors and some aren't. It's still an error to have a private named parameter that doesn't refer to a field. This updates the error reporting to implement that. It also consolidates the error reporting into the parser. Prior to this CL, analyzer would discard the parser's private named parameter errors and then re-detect and report them itself.
The errors you get now when the experiment is off are:
* If the parameter doesn't refer to a field, you get the old error that you can't have a private named parameter.
* If the parameter does refer to a field, you get an error telling you to enable the experiment. When the experiment ships, this changes to an error about updating the library's language version.
And when the experiment is on:
* If the parameter doesn't refer to a field, you get a new error that you can't have a private named parameter unless it refers to a field.
* If the parameter does refer to a field, it reports no error. It doesn't actually support private named parameters that refer to fields yet.
Let me know what I got wrong. It was a little tricky to figure out how it should behave when the experiment is off. One option is to have no user-visible changes in behavior at all when the experiment is off. So the feature is fully hidden behind the experiment.
But most other code I saw seems to take an approach where if the feature is off, it acknowledges the existence of the feature but tells the user it's disabled. I went with this approach but I don't know if that's something we should only do when it's closer to shipping.
Change-Id: I0fc4e9b06c8e7f0abc868e0f49d2b3e625c8dade
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/456540
Auto-Submit: Bob Nystrom <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Reviewed-by: Phil Quitslund <[email protected]>
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Phil Quitslund <[email protected]>
0 commit comments