Skip to content

Commit d81edcb

Browse files
committed
ModulePrinting: Properly substitute via metatype to simplify complex bound generic types appearing in synthesized extensions. rdar://25063840
1 parent 41971fe commit d81edcb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ struct SynthesizedExtensionAnalyzer::Implementation {
272272
if (Arg.isNull())
273273
return GenericType;
274274
Arguments.push_back(Arg);
275-
276275
auto GenericParams = NTD->getInnermostGenericParamTypes();
277276
assert(Arguments.size() == GenericParams.size());
278277
TypeSubstitutionMap Map;
@@ -281,7 +280,8 @@ struct SynthesizedExtensionAnalyzer::Implementation {
281280
Map[(*It)->getCanonicalType()->castTo<SubstitutableType>()] =
282281
Arguments[Index];
283282
}
284-
return NTD->getDeclaredTypeInContext().subst(DC->getParentModule(), Map, None);
283+
auto MType = NTD->getInterfaceType().subst(DC->getParentModule(), Map, None);
284+
return MType->getAs<AnyMetatypeType>()->getInstanceType();
285285
}
286286

287287
SynthesizedExtensionInfo isApplicable(ExtensionDecl *Ext) {

test/IDE/print_stdlib.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,4 @@ func foo(x: _PointerType) {} // Checks that this protocol actually exists.
8484
// RUN: %target-swift-ide-test -print-module -module-group "Collection/Type-erased" -synthesize-extension -module-to-print=Swift -source-filename %s -print-interface | FileCheck %s -check-prefix=CHECK-FREQUENT-WORD
8585

8686
// CHECK-FREQUENT-WORD: ///
87+
// CHECK-FREQUENT-WORD-NOT: where Slice<Dictionary<Key, Value>> == Slice<Self>

0 commit comments

Comments
 (0)