Skip to content

Commit 153da37

Browse files
committed
IRGen: Use getMaximalTypeExpansionContext()
1 parent cbf4dce commit 153da37

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

lib/IRGen/MetadataRequest.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,7 @@ CanType IRGenModule::substOpaqueTypesWithUnderlyingTypes(CanType type) {
528528
// Substitute away opaque types whose underlying types we're allowed to
529529
// assume are constant.
530530
if (type->hasOpaqueArchetype()) {
531-
auto context = TypeExpansionContext::maximal(getSwiftModule(),
532-
getSILModule().isWholeModule());
531+
auto context = getMaximalTypeExpansionContext();
533532
return swift::substOpaqueTypesWithUnderlyingTypes(type, context,
534533
/*allowLoweredTypes=*/false);
535534
}
@@ -542,8 +541,7 @@ SILType IRGenModule::substOpaqueTypesWithUnderlyingTypes(
542541
// Substitute away opaque types whose underlying types we're allowed to
543542
// assume are constant.
544543
if (type.getASTType()->hasOpaqueArchetype()) {
545-
auto context = TypeExpansionContext::maximal(getSwiftModule(),
546-
getSILModule().isWholeModule());
544+
auto context = getMaximalTypeExpansionContext();
547545
return SILType::getPrimitiveType(
548546
swift::substOpaqueTypesWithUnderlyingTypes(type.getASTType(), context,
549547
/*allowLoweredTypes=*/true),
@@ -559,8 +557,7 @@ IRGenModule::substOpaqueTypesWithUnderlyingTypes(CanType type,
559557
// Substitute away opaque types whose underlying types we're allowed to
560558
// assume are constant.
561559
if (type->hasOpaqueArchetype()) {
562-
auto context = TypeExpansionContext::maximal(getSwiftModule(),
563-
getSILModule().isWholeModule());
560+
auto context = getMaximalTypeExpansionContext();
564561
return std::make_pair(
565562
swift::substOpaqueTypesWithUnderlyingTypes(type, context,
566563
/*allowLoweredTypes=*/false),

test/Reflection/opaque_associated_type_requirements.swift

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,12 @@
1010

1111
// RUN: %target-swift-reflection-dump %t/AssociatedTypeRequirements | %FileCheck %s
1212

13+
// This test is useless and was just relying on a bug where we didn't substitute away
14+
// known opaque return types in non-WMO mode.
15+
1316
// CHECK: ASSOCIATED TYPES:
1417
// CHECK: - AssociatedTypeRequirements.Foo : AssociatedTypeRequirements.myProto
15-
// CHECK-NEXT: typealias PerformReturn = opaque type symbolic reference
16-
// CHECK-NEXT: opaque type symbolic reference
17-
// CHECK-NEXT: (bound_generic_struct AssociatedTypeRequirements.Bar
18-
19-
// CHECK: conformance requirements:
20-
// CHECK-NEXT: AssociatedTypeRequirements.protoA
21-
// CHECK-NEXT: AssociatedTypeRequirements.protoB
22-
// CHECK-NEXT: testModB.testModBProtocol
23-
24-
// CHECK: same-type requirements:
25-
// CHECK-NEXT: A.AssociatedTypeRequirements.protoB.K = Sf (Swift.Float)
26-
// CHECK-NEXT: A.AssociatedTypeRequirements.protoA.T = 8testModB0aB7BStructV (testModB.testModBStruct)
18+
// CHECK-NEXT: typealias PerformReturn = AssociatedTypeRequirements.Bar<testModB.testModBStruct, Swift.Float>
2719

2820
import testModB
2921

0 commit comments

Comments
 (0)