Skip to content

Commit e3bbd8c

Browse files
committed
Remove ResilienceExpansion from substOpaqueTypes for now.
It's currently meaningless, and it'll require thought to pass the correct value when it becomes meaningful.
1 parent a6c9254 commit e3bbd8c

13 files changed

+20
-28
lines changed

include/swift/AST/ProtocolConformanceRef.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ class ProtocolConformanceRef {
111111

112112
/// Replace opaque types in the conforming type with their underlying types,
113113
/// and resolve opaque conformances to their underlying conformances.
114-
ProtocolConformanceRef substOpaqueTypesWithUnderlyingTypes(Type origType,
115-
ResilienceExpansion expansion) const;
114+
ProtocolConformanceRef substOpaqueTypesWithUnderlyingTypes(Type origType) const;
116115

117116
/// Given a dependent type (expressed in terms of this conformance's
118117
/// protocol), follow it from the conforming type.

include/swift/AST/SubstitutionMap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ class SubstitutionMap {
174174

175175
/// Replace opaque types in the replacement types in the map with their
176176
/// underlying types. Does not change keys.
177-
SubstitutionMap substOpaqueTypesWithUnderlyingTypes(
178-
ResilienceExpansion expansion) const;
177+
SubstitutionMap substOpaqueTypesWithUnderlyingTypes() const;
179178

180179
/// Create a substitution map for a protocol conformance.
181180
static SubstitutionMap

include/swift/AST/Type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class Type {
318318

319319
/// Replace opaque types with their underlying types when visible at the given
320320
/// resilience expansion.
321-
Type substOpaqueTypesWithUnderlyingTypes(ResilienceExpansion expansion) const;
321+
Type substOpaqueTypesWithUnderlyingTypes() const;
322322

323323
bool isPrivateStdlibType(bool treatNonBuiltinProtocolsAsPublic = true) const;
324324

include/swift/AST/Types.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4816,11 +4816,8 @@ END_CAN_TYPE_WRAPPER(OpaqueTypeArchetypeType, ArchetypeType)
48164816
/// archetypes with underlying types visible at a given resilience expansion
48174817
/// to their underlying types.
48184818
class ReplaceOpaqueTypesWithUnderlyingTypes {
4819-
ResilienceExpansion expansion;
4820-
48214819
public:
4822-
ReplaceOpaqueTypesWithUnderlyingTypes(ResilienceExpansion expansion)
4823-
: expansion(expansion) {}
4820+
ReplaceOpaqueTypesWithUnderlyingTypes() {}
48244821

48254822
/// TypeSubstitutionFn
48264823
Type operator()(SubstitutableType *maybeOpaqueType) const;

include/swift/SIL/AbstractionPattern.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class AbstractionPattern {
304304
OrigType = origType;
305305
else
306306
OrigType = origType
307-
.substOpaqueTypesWithUnderlyingTypes(ResilienceExpansion::Minimal)
307+
.substOpaqueTypesWithUnderlyingTypes()
308308
->getCanonicalType();
309309
GenericSig = CanGenericSignature();
310310
if (OrigType->hasTypeParameter())

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5046,7 +5046,7 @@ CanSILBoxType SILBoxType::get(ASTContext &C,
50465046
SubstitutionMap Substitutions) {
50475047
// TODO: Support resilient opaque types.
50485048
Substitutions = Substitutions
5049-
.substOpaqueTypesWithUnderlyingTypes(ResilienceExpansion::Minimal);
5049+
.substOpaqueTypesWithUnderlyingTypes();
50505050
// Canonicalize substitutions.
50515051
Substitutions = Substitutions.getCanonical();
50525052

lib/AST/ASTMangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ void ASTMangler::appendType(Type type) {
966966
return appendType(ErrorType::get(opaqueTy->getASTContext()));
967967
}
968968
auto underlyingType =
969-
type.substOpaqueTypesWithUnderlyingTypes(ResilienceExpansion::Minimal);
969+
type.substOpaqueTypesWithUnderlyingTypes();
970970
assert(!underlyingType->isEqual(type));
971971
return appendType(underlyingType->getCanonicalType());
972972
}

lib/AST/ProtocolConformance.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,8 @@ ProtocolConformanceRef::subst(Type origType,
142142
}
143143

144144
ProtocolConformanceRef
145-
ProtocolConformanceRef::substOpaqueTypesWithUnderlyingTypes(Type origType,
146-
ResilienceExpansion expansion) const {
147-
ReplaceOpaqueTypesWithUnderlyingTypes replacer(expansion);
145+
ProtocolConformanceRef::substOpaqueTypesWithUnderlyingTypes(Type origType) const {
146+
ReplaceOpaqueTypesWithUnderlyingTypes replacer;
148147
return subst(origType, replacer, replacer,
149148
SubstFlags::SubstituteOpaqueArchetypes);
150149
}

lib/AST/SubstitutionMap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,9 @@ SubstitutionMap SubstitutionMap::subst(TypeSubstitutionFn subs,
493493
}
494494

495495
SubstitutionMap
496-
SubstitutionMap::substOpaqueTypesWithUnderlyingTypes(ResilienceExpansion exp)
496+
SubstitutionMap::substOpaqueTypesWithUnderlyingTypes()
497497
const {
498-
ReplaceOpaqueTypesWithUnderlyingTypes replacer(exp);
498+
ReplaceOpaqueTypesWithUnderlyingTypes replacer;
499499
return subst(replacer, replacer, SubstFlags::SubstituteOpaqueArchetypes);
500500
}
501501

lib/AST/Type.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,7 +2471,7 @@ Type ReplaceOpaqueTypesWithUnderlyingTypes::operator()(
24712471

24722472
// If the type still contains opaque types, recur.
24732473
if (substTy->hasOpaqueArchetype()) {
2474-
return substTy.substOpaqueTypesWithUnderlyingTypes(expansion);
2474+
return substTy.substOpaqueTypesWithUnderlyingTypes();
24752475
}
24762476
return substTy;
24772477
}
@@ -2509,14 +2509,13 @@ ReplaceOpaqueTypesWithUnderlyingTypes::operator()(CanType maybeOpaqueType,
25092509

25102510
// If the type still contains opaque types, recur.
25112511
if (substTy->hasOpaqueArchetype()) {
2512-
return substRef.substOpaqueTypesWithUnderlyingTypes(substTy, expansion);
2512+
return substRef.substOpaqueTypesWithUnderlyingTypes(substTy);
25132513
}
25142514
return substRef;
25152515
}
25162516

2517-
Type Type::substOpaqueTypesWithUnderlyingTypes(
2518-
ResilienceExpansion expansion) const {
2519-
ReplaceOpaqueTypesWithUnderlyingTypes replacer(expansion);
2517+
Type Type::substOpaqueTypesWithUnderlyingTypes() const {
2518+
ReplaceOpaqueTypesWithUnderlyingTypes replacer;
25202519
return subst(replacer, replacer,
25212520
SubstFlags::SubstituteOpaqueArchetypes
25222521
// TODO(opaque): Currently lowered types always get opaque types

lib/IRGen/GenProto.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,12 +1470,11 @@ void WitnessTableBuilder::defineAssociatedTypeWitnessTableAccessFunction(
14701470
ProtocolConformanceRef associatedConformance) {
14711471
// Substitute out opaque types.
14721472
auto substAssocType = associatedType
1473-
.substOpaqueTypesWithUnderlyingTypes(ResilienceExpansion::Minimal)
1473+
.substOpaqueTypesWithUnderlyingTypes()
14741474
->getCanonicalType();
14751475
if (substAssocType != associatedType) {
14761476
auto substAssocConformance = associatedConformance
1477-
.substOpaqueTypesWithUnderlyingTypes(associatedType,
1478-
ResilienceExpansion::Minimal);
1477+
.substOpaqueTypesWithUnderlyingTypes(associatedType);
14791478

14801479
associatedType = substAssocType;
14811480
associatedConformance = substAssocConformance;

lib/SIL/SILInstructions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,10 +2127,10 @@ KeyPathPattern::get(SILModule &M, CanGenericSignature signature,
21272127

21282128
// TODO: support resilient opaque types
21292129
rootType = rootType
2130-
.substOpaqueTypesWithUnderlyingTypes(ResilienceExpansion::Minimal)
2130+
.substOpaqueTypesWithUnderlyingTypes()
21312131
->getCanonicalType();
21322132
valueType = valueType
2133-
.substOpaqueTypesWithUnderlyingTypes(ResilienceExpansion::Minimal)
2133+
.substOpaqueTypesWithUnderlyingTypes()
21342134
->getCanonicalType();
21352135

21362136
auto newPattern = KeyPathPattern::create(M, signature, rootType, valueType,

lib/SIL/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ TypeConverter::getTypeLowering(AbstractionPattern origType,
14951495
Type origSubstType,
14961496
ResilienceExpansion forExpansion) {
14971497
CanType substType = origSubstType->getCanonicalType()
1498-
.substOpaqueTypesWithUnderlyingTypes(forExpansion)
1498+
.substOpaqueTypesWithUnderlyingTypes()
14991499
->getCanonicalType();
15001500
auto key = getTypeKey(origType, substType);
15011501

0 commit comments

Comments
 (0)