Skip to content

Commit 685f3f2

Browse files
committed
AST: Use correct generic signature to mangle retroactive conformances
1 parent 2f0ce4c commit 685f3f2

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

lib/AST/ASTMangler.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,9 @@ void ASTMangler::appendType(Type type, const ValueDecl *forDecl) {
11161116
if (tryMangleTypeSubstitution(tybase))
11171117
return;
11181118

1119+
auto outerGenericSig = CurGenericSignature;
11191120
appendAnyGenericType(decl);
1121+
CurGenericSignature = outerGenericSig;
11201122
bool isFirstArgList = true;
11211123
appendBoundGenericArgs(type, isFirstArgList);
11221124
appendRetroactiveConformances(type);
@@ -1249,7 +1251,9 @@ void ASTMangler::appendType(Type type, const ValueDecl *forDecl) {
12491251
appendType(GenArgs[0], forDecl);
12501252
appendOperator("Sg");
12511253
} else {
1254+
auto outerGenericSig = CurGenericSignature;
12521255
appendAnyGenericType(Decl);
1256+
CurGenericSignature = outerGenericSig;
12531257
bool isFirstArgList = true;
12541258
appendBoundGenericArgs(type, isFirstArgList);
12551259
appendRetroactiveConformances(type);
@@ -3224,17 +3228,6 @@ void ASTMangler::appendConcreteProtocolConformance(
32243228
const ProtocolConformance *conformance) {
32253229
auto module = conformance->getDeclContext()->getParentModule();
32263230

3227-
// It's possible that we might not have a generic signature here to get
3228-
// the conformance access path (for example, when mangling types for
3229-
// debugger). In that case, we can use the generic signature of the
3230-
// conformance (if it's present).
3231-
auto conformanceSig = conformance->getGenericSignature();
3232-
auto shouldUseConformanceSig = !CurGenericSignature && conformanceSig;
3233-
llvm::SaveAndRestore<CanGenericSignature> savedSignature(
3234-
CurGenericSignature, shouldUseConformanceSig
3235-
? conformanceSig.getCanonicalSignature()
3236-
: CurGenericSignature);
3237-
32383231
// Conforming type.
32393232
Type conformingType = conformance->getType();
32403233
if (conformingType->hasArchetype())

0 commit comments

Comments
 (0)