-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SourceKit] Add local variables to structure (SR-5057) #11262
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
Similar question for this: does it make sense to be emitting accessibility and setter accessibility for local vars? They don't properly have such, unless I'm mistaken. |
I thought about this and I wasn't able to come up with a good answer. It looks like they'll always be |
Hmm, yes, that's useful information, but surely there's a design possible that doesn't require describing the non-existent accessibility level of a non-existent setter? |
I think I agree. What would be the best approach here? Leaving that for another PR? |
I wouldn't have the ability to answer that, but I will ask--is it possible to suppress the accessibility output and to have two flavors of |
Wouldn't that be actually more inconsistent? This would be the only variable kind to be split in two based on its mutability. Some alternatives:
|
Whatever key is used to indicate the difference between This is why I suggested different flavors of However, another key such as |
cc @nkcsgexi |
I'm thinking about removing the accessibility fields for local variables for now and leave the discussion for the (near) future. |
baa05d4
to
f8a1d74
Compare
Rebased omitting the accessibility for local variables. |
f8a1d74
to
fe6ee9f
Compare
// CHECK: <foreach>for <elem-id>var i</elem-id> = 0, i2 = 1; i == 0; ++i <brace>{}</brace></foreach> | ||
for var i = 0, i2 = 1; i == 0; ++i {} | ||
// CHECK: <foreach>for <elem-id>var (i,i2)</elem-id> = (0,0), i3 = 1; i == 0; ++i <brace>{}</brace></foreach> | ||
for var (i,i2) = (0,0), i3 = 1; i == 0; ++i {} |
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.
I've removed these since the C-style for was removed from Swift and some cleanup was just merged (#11346)
ping @nkcsgexi? |
@swift-ci please test |
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! Sorry about the delay.
@swift-ci please smoke test |
@shahmishal any idea why PR testing isn't responding? |
@swift-ci please smoke test |
@nkcsgexi @marcelofabri Is it possible to close this PR and re-create the PR? We have seen issues with few PR's, to workaround this issue we need to just create the PR. |
This PR includes local variables (
source.lang.swift.decl.var.local
) to structures provided by SourceKit. This also makes variables declared infor
andwhile
statements available in the structure.Resolves SR-5057.
This is super important for SwiftLint, as you can see on realm/SwiftLint#136 and all duplicated issues. I'm not sure if there's a historical reason for this not be included until now.