-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Do not include decl in own (string interp) initializer #34548
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
[CodeCompletion] Do not include decl in own (string interp) initializer #34548
Conversation
@swift-ci please test |
Just noticed I had left the types of the added tests as Int rather than String. Shouldn't matter but do you want me to fix that? |
Build failed |
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.
The context type shouldn't matter. So I'm OK with it.
But,
func foo(arg: Int = #^HERE^#) {}
I just noticed this suggests arg
in Swift5.3, which is not OK. Does this (or your recent) change resolve it too? Could you add test cases for them?
The previous one should fix that case, but I can add it in this one. May as well fix the type while I'm at it as well. Thanks :) |
Strings are a single token, so the previous check would treat completions inside string interpolations as being outside of the initializer. Grab the end of the token from the Lexer, but wrap in a context check to avoid performing that for every declaration found in the lookup. Resolves rdar://70833348
Similar to 4cf7426 but for the case when the completion is in a default argument expression rather than initializer. Fixed to grab either the initializer or default argument if there is one.
97d7e9d
to
c3d1e34
Compare
Previous did not fix... it was only checking the initializer, not for a default argument. Added another commit to fix that one as well. Also enabled some disabled tests that should work now (have for a while I think). Let me know if you'd prefer it in a separate PR. |
@swift-ci please test |
Build failed |
@swift-ci please test Linux platform |
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.
Thank you!
Strings are a single token, so the previous check would treat
completions inside string interpolations as being outside of the
initializer.
Grab the end of the token from the Lexer, but wrap in a context check to
avoid performing that for every declaration found in the lookup.
Resolves rdar://70833348