Skip to content

Commit 6f31f84

Browse files
authored
Merge pull request swiftlang#63790 from bnbarham/refactoring-use-sourceinfo
[Rename] Allow renaming of symbols from another module
2 parents 4190cb7 + 45b1f94 commit 6f31f84

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/Refactoring/Refactoring.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8843,7 +8843,7 @@ void swift::ide::collectRenameAvailabilityInfo(
88438843
AvailKind = RenameAvailableKind::Unavailable_system_symbol;
88448844
} else if (VD->getClangDecl()) {
88458845
AvailKind = RenameAvailableKind::Unavailable_decl_from_clang;
8846-
} else if (VD->getStartLoc().isInvalid()) {
8846+
} else if (VD->getLoc().isInvalid()) {
88478847
AvailKind = RenameAvailableKind::Unavailable_has_no_location;
88488848
} else if (!VD->hasName()) {
88498849
AvailKind = RenameAvailableKind::Unavailable_has_no_name;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/build)
3+
// RUN: split-file --leading-lines %s %t
4+
5+
// RUN: %target-swift-frontend -emit-module -module-name MyModule -emit-module-path %t/build/MyModule.swiftmodule -emit-module-source-info-path %t/build/MyModule.swiftsourceinfo %t/Action.swift
6+
7+
//--- Action.swift
8+
public protocol Action {}
9+
10+
//--- test.swift
11+
import MyModule
12+
13+
// RUN: %sourcekitd-test -req=cursor -pos=%(line+1):19 -length=6 -cursor-action %t/test.swift -- %t/test.swift -I %t/build | %FileCheck %s
14+
func test(action: Action) { }
15+
// CHECK: ACTIONS BEGIN
16+
// CHECK-NEXT: source.refactoring.kind.rename.global
17+
// CHECK-NEXT: Global Rename
18+
// CHECK-NOT: cannot be renamed

0 commit comments

Comments
 (0)