Skip to content
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

Emit references to shadowed variables in if-let shorthands #77177

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dylansturg
Copy link
Contributor

Variables defined in if-let shorthand now get their own definition and references to the variable use that definition.

Track the original-decl/captured decl as part of the symbol passed to the IndexConsumer. This allows the Rename consumer to check if the symbol is a shadowed reference to a decl being renamed, without the index skipping the other relevant output when visiting shadowing variables.

This change stores variables from if-let shorthand syntax in the indexstore, when indexing locals, because those are local variables too. As opposed to purely being references to their shadowed declaration.

Resolves #76805

…es when indexing locals is enabled.

Track the original-decl/captured decl as part of the symbol passed to the IndexConsumer. This allows the Rename consumer to check if the symbol is a shadowed reference to a decl being renamed, without the index skipping the other relevant output when visiting shadowing variables.

swiftlang#76805
@bnbarham
Copy link
Contributor

@swift-ci please test

Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working through this @dylansturg 🙇‍♂️. LGTM assuming all the other tests pass!

@dylansturg
Copy link
Contributor Author

The failure for macOS seems unrelated. It looks like the build at head is failing with the same error; looking at https://ci.swift.org/job/oss-swift-incremental-RA-macos/.

Hopefully that's resolved soon and we can retry.

@hamishknight
Copy link
Contributor

@swift-ci please test macOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indexstore for if let shorthand bound variables references shadowed declaration instead of local variable
3 participants