-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Allow var / let as parameter names, but provide a warning, and fixit to add backticks. #24059
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
Conversation
Looks like #24025 |
If you wish to take over this bug, please see my notes on the other. In brief: please don’t change the diagnostic engine, but instead remove this diagnostic and make it do something useful by sticking in backquotes. |
Just pushed a change that allows let / var as argument label names but generates a warning when they're used. I'm going to have to update a lot of tests that rely on this being disallowed so don't run CI just yet, but I figured I'd put this up so anyone interested can take a look at the implementation. I'll modify the tests relating to this so they expect the new warning rather than the old error tomorrow. Just as a note on the implementation, doing this was a tad bit more involved than just changing the error to a warning and shuffling around tests as there were a few conflicting diagnostics that would yell at you if you added backticks to something that wasn't invalid without them. I modified those diagnostics so they don't fire when we want to allow both with and without backticks. |
var
/ let
as parameter doesn't remove enough whitespace.
@swift-ci build toolchain |
1 similar comment
@swift-ci build toolchain |
@swift-ci please smoke test |
Linux Toolchain (Ubuntu 16.04) Install command |
@swift-ci please smoke test |
@swift-ci build toolchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you, @sl!
@swift-ci please test source compatibility |
The diagnostic is now a warning and the new message alerts the user that though it is valid to have let and var as argument label names, they are interpreted as argument labels, not keywords.
@swift-ci please smoke test |
@swift-ci please test source compatibility |
Notable Changes
Resolves SR-10293.
This is resolved as there's no longer a need to change that fixit.