Merge pull request #63167 from bnbarham/fix-shadowed-rename

[Index] Handle shorthand if let/closure captures in local rename
This commit is contained in:
Ben Barham
2023-01-25 09:11:55 -08:00
committed by GitHub
7 changed files with 60 additions and 36 deletions

View File

@@ -912,6 +912,11 @@ bool RefactoringActionLocalRename::performChange() {
auto ValueRefCursorInfo = dyn_cast<ResolvedValueRefCursorInfo>(&CursorInfo);
if (ValueRefCursorInfo && ValueRefCursorInfo->getValueD()) {
ValueDecl *VD = ValueRefCursorInfo->typeOrValue();
// The index always uses the outermost shadow for references
if (!ValueRefCursorInfo->getShorthandShadowedDecls().empty()) {
VD = ValueRefCursorInfo->getShorthandShadowedDecls().back();
}
SmallVector<DeclContext *, 8> Scopes;
Optional<RenameRefInfo> RefInfo;