diff --git a/lib/AST/USRGeneration.cpp b/lib/AST/USRGeneration.cpp index 1561df073e0d3..b993fe5260e07 100644 --- a/lib/AST/USRGeneration.cpp +++ b/lib/AST/USRGeneration.cpp @@ -31,6 +31,7 @@ static inline StringRef getUSRSpacePrefix() { } bool ide::printTypeUSR(Type Ty, raw_ostream &OS) { + assert(!Ty->hasArchetype() && "cannot have contextless archetypes mangled."); using namespace Mangle; Mangler Mangler(true); Mangler.mangleTypeForDebugger(Ty->getRValueType(), nullptr); diff --git a/test/SourceKit/CursorInfo/crash2.swift b/test/SourceKit/CursorInfo/crash2.swift new file mode 100644 index 0000000000000..518da93d64f58 --- /dev/null +++ b/test/SourceKit/CursorInfo/crash2.swift @@ -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) diff --git a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp index 8e37dd22f0729..fa47c90a69b3a 100644 --- a/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp +++ b/tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp @@ -658,7 +658,7 @@ static bool passCursorInfoForDecl(const ValueDecl *VD, unsigned MangledTypeEnd = SS.size(); unsigned MangledContainerTypeStart = SS.size(); - if (ContainerTy) { + if (ContainerTy && !ContainerTy->hasArchetype()) { llvm::raw_svector_ostream OS(SS); SwiftLangSupport::printTypeUSR(ContainerTy, OS); }