Skip to content

Commit d222804

Browse files
committed
[IDE] Use getStartLoc() for matching pattern ranges
For Example `getLoc()` for `foo as Ty`(`IsPattern`) is at 'as'. We should try to resolve this at position of 'foo'.
1 parent be8be32 commit d222804

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/IDE/SwiftSourceDocInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ std::pair<bool, Pattern*> NameMatcher::walkToPatternPre(Pattern *P) {
581581
if (isDone() || shouldSkip(P->getSourceRange()))
582582
return std::make_pair(false, P);
583583

584-
tryResolve(ASTWalker::ParentTy(P), P->getLoc());
584+
tryResolve(ASTWalker::ParentTy(P), P->getStartLoc());
585585
return std::make_pair(!isDone(), P);
586586
}
587587

test/refactoring/rename/Outputs/local/catch_1.swift.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct Err1 : Error { }
3232
func test4(arg: () throws -> Void) {
3333
do {
3434
try arg()
35-
} catch let x as Err1 {
35+
} catch let xRenamed as Err1 {
3636
print(xRenamed)
3737
} catch let x {
3838
print(x)

0 commit comments

Comments
 (0)