Skip to content

Commit 4289b98

Browse files
committed
AST: Fix handling of ErrorType in MakeAbstractConformanceForGenericType
And remove the assert, it will be replaced with one inside forAbstract().
1 parent 964f081 commit 4289b98

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/AST/TypeSubstitution.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,17 @@ operator()(CanType dependentType, Type conformingReplacementType,
154154
PackConformance::get(conformingPack, conformedProtocol, conformances));
155155
}
156156

157-
assert((conformingReplacementType->is<ErrorType>() ||
158-
conformingReplacementType->is<SubstitutableType>() ||
159-
conformingReplacementType->is<DependentMemberType>() ||
160-
conformingReplacementType->hasTypeVariable()) &&
161-
"replacement requires looking up a concrete conformance");
157+
if (conformingReplacementType->is<ErrorType>())
158+
return ProtocolConformanceRef::forInvalid();
159+
162160
// A class-constrained archetype might conform to the protocol
163161
// concretely.
164162
if (auto *archetypeType = conformingReplacementType->getAs<ArchetypeType>()) {
165-
if (auto superclassType = archetypeType->getSuperclass()) {
163+
if (archetypeType->getSuperclass()) {
166164
return lookupConformance(archetypeType, conformedProtocol);
167165
}
168166
}
167+
169168
return ProtocolConformanceRef::forAbstract(
170169
conformingReplacementType, conformedProtocol);
171170
}

0 commit comments

Comments
 (0)