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

Resolves SR-11077
This commit is contained in:
Colton Schlosser
2019-07-08 21:13:46 -04:00
parent 0a22ab7099
commit 07675a75e0
21 changed files with 208 additions and 2 deletions

View File

@@ -784,7 +784,7 @@ bool RefactoringActionLocalRename::performChange() {
CursorInfoResolver Resolver(*TheFile);
ResolvedCursorInfo CursorInfo = Resolver.resolve(StartLoc);
if (CursorInfo.isValid() && CursorInfo.ValueD) {
ValueDecl *VD = CursorInfo.ValueD;
ValueDecl *VD = CursorInfo.CtorTyRef ? CursorInfo.CtorTyRef : CursorInfo.ValueD;
llvm::SmallVector<DeclContext *, 8> Scopes;
analyzeRenameScope(VD, DiagEngine, Scopes);
if (Scopes.empty())
@@ -3352,7 +3352,7 @@ int swift::ide::findLocalRenameRanges(
Diags.diagnose(StartLoc, diag::unresolved_location);
return true;
}
ValueDecl *VD = CursorInfo.ValueD;
ValueDecl *VD = CursorInfo.CtorTyRef ? CursorInfo.CtorTyRef : CursorInfo.ValueD;
llvm::SmallVector<DeclContext *, 8> Scopes;
analyzeRenameScope(VD, Diags, Scopes);
if (Scopes.empty())