Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/AST/USRGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions test/SourceKit/CursorInfo/crash2.swift
Original file line number Diff line number Diff line change
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a more descriptive file name. Also, we should check that we're getting a reasonable USR still, right?

2 changes: 1 addition & 1 deletion tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down