Skip to content

[4.1][CursorInfo] Fix crash on init call of inner class with outer generic context #14162

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

@nathawes nathawes commented Jan 25, 2018

CCC Info

  • Radar: rdar://problem/35819975
  • Explanation:

Invoking the cursor info request on a call to the initializer of an inner class in a generic context would crash SourceKit, e.g:

class Bar<T> {
  class Inner {}
  func foo() { /*invoke here:*/Inner() }
}

There was faulty logic to treat an invocation on an initializer call, e.g. Inner(), as if it were a plain reference to the type, e.g. Inner. We were updating the declaration used to the initializer's parent, but left the containing type as is.

  • Risk: Low. Change only affects sourcekitd cursor info request when invoked on initializer calls.
  • Scope of issue: Jump-to-definition, quick help and refactoring were crashing sourcekit on these initializer calls
  • Origination: CrashTracer issue
  • Reviewed by: Xi Ge
  • Testing: Added regression test

@nathawes
Copy link
Contributor Author

@swift-ci please test

@nathawes nathawes requested a review from nkcsgexi January 25, 2018 19:10
Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

LGTM.

@nathawes nathawes force-pushed the rdar3581975-cursor-info-crasher-4.1 branch from f3602e6 to 6ff6e3c Compare January 25, 2018 21:27
@nathawes
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - f3602e6aebdb47f51391d1a9516a32420e969bf3

@nathawes
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f3602e6aebdb47f51391d1a9516a32420e969bf3

@nathawes
Copy link
Contributor Author

@swift-ci please test linux

@nathawes nathawes merged commit 3e235aa into swiftlang:swift-4.1-branch Jan 26, 2018
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.

3 participants