[SourceKit] Never try to report mangled names for archetypes without contexts. rdar://28094209

This commit is contained in:
Xi Ge
2016-10-24 16:55:57 -07:00
parent 05f45945ec
commit 7bd01b5ad1
3 changed files with 13 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ static inline StringRef getUSRSpacePrefix() {
} }
bool ide::printTypeUSR(Type Ty, raw_ostream &OS) { bool ide::printTypeUSR(Type Ty, raw_ostream &OS) {
assert(!Ty->hasArchetype() && "cannot have contextless archetypes mangled.");
using namespace Mangle; using namespace Mangle;
Mangler Mangler(true); Mangler Mangler(true);
Mangler.mangleTypeForDebugger(Ty->getRValueType(), nullptr); Mangler.mangleTypeForDebugger(Ty->getRValueType(), nullptr);

View File

@@ -0,0 +1,11 @@
protocol P {
func meth()
}
func foo (t : P) {
t.meth()
}
// RUN: %sourcekitd-test -req=cursor -pos=6:5 %s -- %s | %FileCheck %s -check-prefix=CASE1
// CASE1: source.lang.swift.ref.function.method.instance (2:8-2:14)

View File

@@ -658,7 +658,7 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
unsigned MangledTypeEnd = SS.size(); unsigned MangledTypeEnd = SS.size();
unsigned MangledContainerTypeStart = SS.size(); unsigned MangledContainerTypeStart = SS.size();
if (ContainerTy) { if (ContainerTy && !ContainerTy->hasArchetype()) {
llvm::raw_svector_ostream OS(SS); llvm::raw_svector_ostream OS(SS);
SwiftLangSupport::printTypeUSR(ContainerTy, OS); SwiftLangSupport::printTypeUSR(ContainerTy, OS);
} }