Skip to content

Commit 7bd01b5

Browse files
committed
[SourceKit] Never try to report mangled names for archetypes without contexts. rdar://28094209
1 parent 05f4594 commit 7bd01b5

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

lib/AST/USRGeneration.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ static inline StringRef getUSRSpacePrefix() {
3131
}
3232

3333
bool ide::printTypeUSR(Type Ty, raw_ostream &OS) {
34+
assert(!Ty->hasArchetype() && "cannot have contextless archetypes mangled.");
3435
using namespace Mangle;
3536
Mangler Mangler(true);
3637
Mangler.mangleTypeForDebugger(Ty->getRValueType(), nullptr);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
protocol P {
2+
func meth()
3+
}
4+
5+
func foo (t : P) {
6+
t.meth()
7+
}
8+
9+
// RUN: %sourcekitd-test -req=cursor -pos=6:5 %s -- %s | %FileCheck %s -check-prefix=CASE1
10+
11+
// CASE1: source.lang.swift.ref.function.method.instance (2:8-2:14)

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
658658
unsigned MangledTypeEnd = SS.size();
659659

660660
unsigned MangledContainerTypeStart = SS.size();
661-
if (ContainerTy) {
661+
if (ContainerTy && !ContainerTy->hasArchetype()) {
662662
llvm::raw_svector_ostream OS(SS);
663663
SwiftLangSupport::printTypeUSR(ContainerTy, OS);
664664
}

0 commit comments

Comments
 (0)