Skip to content

[refactoring] Fix error when renaming nested type at constructor - init() has no declaration location #26016

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

Merged

Conversation

cltnschlosser
Copy link
Contributor

protocol P1 {}
struct Test {
  var test: P1 {
    struct SP1: P1 {}
    return SP1()
  }
}

Renaming SPR1 on line 5 was incorrectly trying to rename the initializer instead of the type.

Resolves SR-11077.

cc @nathawes

@nathawes nathawes self-requested a review July 9, 2019 22:25
@nathawes
Copy link
Contributor

nathawes commented Jul 9, 2019

Thanks for fixing this Colton!

@nathawes
Copy link
Contributor

nathawes commented Jul 9, 2019

@swift-ci please test

Copy link
Contributor

@nathawes nathawes left a comment

Choose a reason for hiding this comment

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

This looks great, Colton! I realized while reading through it that the -find-local-rename-ranges refactoring will probably need a similar fix. Would you mind testing/fixing that one too? Xcode uses that request for the code roll UI it goes into when you invoke rename.

If you're interested in trying out your changes in Xcode, you can launch Xcode from the command line with an extra environment variable set that points to your local build:

$ __XPC_SOURCEKIT_TOOLCHAIN_LIB_PATH=/path/to/swift-build-dir/lib /Applications/Xcode-beta.app/Contents/MacOS/Xcode

…it() has no declaration location

Resolves SR-11077
@cltnschlosser cltnschlosser force-pushed the SR-11077-inner-rename-nested-type branch from 26b9ffe to 07675a7 Compare July 11, 2019 01:02
@nathawes
Copy link
Contributor

@swift-ci please test

@nathawes nathawes self-requested a review July 11, 2019 17:50
@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 26b9ffe66c13152d952d44433a77e8d9e13bf116

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 26b9ffe66c13152d952d44433a77e8d9e13bf116

Copy link
Contributor

@nathawes nathawes left a comment

Choose a reason for hiding this comment

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

Thanks Colton – this looks great!

@nathawes nathawes merged commit 3065843 into swiftlang:master Jul 12, 2019
@cltnschlosser cltnschlosser deleted the SR-11077-inner-rename-nested-type branch July 12, 2019 01:19
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