@@ -93,23 +93,24 @@ ProtocolConformanceRef::subst(Type origType, InFlightSubstitution &IFS) const {
93
93
if (isPack ())
94
94
return getPack ()->subst (IFS);
95
95
96
- // Handle abstract conformances below:
96
+ ASSERT (isAbstract ());
97
+ auto *proto = getProtocol ();
97
98
98
99
// If the type is an opaque archetype, the conformance will remain abstract,
99
100
// unless we're specifically substituting opaque types.
100
- if (auto origArchetype = origType->getAs <ArchetypeType>()) {
101
- if (!IFS.shouldSubstituteOpaqueArchetypes ()
102
- && isa<OpaqueTypeArchetypeType>(origArchetype)) {
103
- return *this ;
101
+ if (auto origArchetype = origType->getAs <OpaqueTypeArchetypeType>()) {
102
+ if (!IFS.shouldSubstituteOpaqueArchetypes ()) {
103
+ return forAbstract (origType.subst (IFS), proto);
104
104
}
105
105
}
106
106
107
+ // FIXME: Handle local archetypes as above!
108
+
107
109
// Otherwise, compute the substituted type.
108
110
auto substType = origType.subst (IFS);
109
111
110
- auto *proto = getProtocol ();
111
-
112
112
// If the type is an existential, it must be self-conforming.
113
+ // FIXME: This feels like it's in the wrong place.
113
114
if (substType->isExistentialType ()) {
114
115
auto optConformance =
115
116
lookupConformance (substType, proto, /* allowMissing=*/ true );
@@ -119,7 +120,7 @@ ProtocolConformanceRef::subst(Type origType, InFlightSubstitution &IFS) const {
119
120
return ProtocolConformanceRef::forInvalid ();
120
121
}
121
122
122
- // Check the conformance map.
123
+ // Local conformance lookup into the substitution map.
123
124
// FIXME: Pack element level?
124
125
return IFS.lookupConformance (origType->getCanonicalType (), substType, proto,
125
126
/* level=*/ 0 );
0 commit comments