Skip to content

[5.1][sourcekitd] Improve CursorInfo, RelatedIdents, and local rename to better handle VarDecls involved in case fallthroughs #23468

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

nathawes
Copy link
Contributor

Cherry-pick of #23448 for 5.1 branch

Nathan Hawes added 3 commits March 21, 2019 12:34
…case statements

We weren't picking up all occurrences of 'x' in the cases like the below:

case .first(let x), .second(let x):
  print("foo \(x)")
  fallthrough
case .third(let x):
  print("bar \(x)")

We would previously only return occurrences within the case statement the query
was made in (ignoring fallthroughs) and for cases with multiple patterns (as in
the first case above) we would only return the occurrence in the first pattern.
…se statements

We weren't renaming all occurrences of 'x' in the cases like the below:

  case .first(let x), .second(let x):
    print("foo \(x)")
    fallthrough
  case .third(let x):
    print("bar \(x)")

We would previously only rename occurrences within the case statement the query
was made in (ignoring fallthroughs) and for cases with multiple patterns (as in
the first case above) we would only rename the occurrence in the first pattern.
…ng introduced in CastStmt bodies

When CursorInfo finds a reference to a VarDecl that's implicit but has a parent
VarDecl (according to VarDecl::getParentVarDecl), act as if we found the parent
instead.
@nathawes
Copy link
Contributor Author

@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 50f6ddb

@nathawes
Copy link
Contributor Author

Linux failure seems unrelated:

16:04:31 Failing Tests (1):
16:04:31     LLDB :: Expr/TestIRMemoryMap.test

@swift-ci please test Linux

@nathawes nathawes merged commit be7da31 into swiftlang:swift-5.1-branch Mar 22, 2019
@nathawes nathawes deleted the fix-case-var-for-relatedidents-cursorinfo-and-rename-5.1 branch March 22, 2019 01:04
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.

2 participants