Skip to content

Commit 1424e0d

Browse files
committed
AST: Handle new abstract conformances in ProtocolConformanceRef::subst()
1 parent 07aa850 commit 1424e0d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/AST/ProtocolConformanceRef.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,20 @@ ProtocolConformanceRef::subst(Type origType, InFlightSubstitution &IFS) const {
9494
return getPack()->subst(IFS);
9595

9696
// Handle abstract conformances below:
97+
auto *proto = getProtocol();
9798

9899
// If the type is an opaque archetype, the conformance will remain abstract,
99100
// unless we're specifically substituting opaque types.
100101
if (auto origArchetype = origType->getAs<ArchetypeType>()) {
101102
if (!IFS.shouldSubstituteOpaqueArchetypes()
102103
&& isa<OpaqueTypeArchetypeType>(origArchetype)) {
103-
return *this;
104+
return forAbstract(origType.subst(IFS), proto);
104105
}
105106
}
106107

107108
// Otherwise, compute the substituted type.
108109
auto substType = origType.subst(IFS);
109110

110-
auto *proto = getProtocol();
111-
112111
// If the type is an existential, it must be self-conforming.
113112
if (substType->isExistentialType()) {
114113
auto optConformance =
@@ -119,7 +118,7 @@ ProtocolConformanceRef::subst(Type origType, InFlightSubstitution &IFS) const {
119118
return ProtocolConformanceRef::forInvalid();
120119
}
121120

122-
// Check the conformance map.
121+
// Local conformance lookup into the substitution map.
123122
// FIXME: Pack element level?
124123
return IFS.lookupConformance(origType->getCanonicalType(), substType, proto,
125124
/*level=*/0);

0 commit comments

Comments
 (0)