@@ -94,21 +94,20 @@ ProtocolConformanceRef::subst(Type origType, InFlightSubstitution &IFS) const {
94
94
return getPack ()->subst (IFS);
95
95
96
96
// Handle abstract conformances below:
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
101
if (auto origArchetype = origType->getAs <ArchetypeType>()) {
101
102
if (!IFS.shouldSubstituteOpaqueArchetypes ()
102
103
&& isa<OpaqueTypeArchetypeType>(origArchetype)) {
103
- return * this ;
104
+ return forAbstract (origType. subst (IFS), proto) ;
104
105
}
105
106
}
106
107
107
108
// Otherwise, compute the substituted type.
108
109
auto substType = origType.subst (IFS);
109
110
110
- auto *proto = getProtocol ();
111
-
112
111
// If the type is an existential, it must be self-conforming.
113
112
if (substType->isExistentialType ()) {
114
113
auto optConformance =
@@ -119,7 +118,7 @@ ProtocolConformanceRef::subst(Type origType, InFlightSubstitution &IFS) const {
119
118
return ProtocolConformanceRef::forInvalid ();
120
119
}
121
120
122
- // Check the conformance map.
121
+ // Local conformance lookup into the substitution map.
123
122
// FIXME: Pack element level?
124
123
return IFS.lookupConformance (origType->getCanonicalType (), substType, proto,
125
124
/* level=*/ 0 );
0 commit comments