mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SourceKit] Never try to report mangled names for archetypes without contexts. rdar://28094209
This commit is contained in:
@@ -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);
|
||||
|
||||
11
test/SourceKit/CursorInfo/crash2.swift
Normal file
11
test/SourceKit/CursorInfo/crash2.swift
Normal 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)
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user