@@ -79,7 +79,9 @@ void ConnectedComponent::buildRequirements(Type subjectType,
7979 subjectType, constraintType);
8080 subjectType = constraintType;
8181 }
82- } else {
82+ } else if (!ConcreteType->hasError ()) {
83+ // For compatibility with the old GenericSignatureBuilder, drop requirements
84+ // containing ErrorTypes.
8385 reqs.emplace_back (RequirementKind::SameType,
8486 subjectType, ConcreteType);
8587
@@ -120,14 +122,20 @@ RequirementMachine::buildRequirementsFromRules(
120122 prop->getLayoutConstraint ());
121123 return ;
122124
123- case Symbol::Kind::Superclass:
125+ case Symbol::Kind::Superclass: {
126+ // For compatibility with the old GenericSignatureBuilder, drop requirements
127+ // containing ErrorTypes.
128+ auto superclassType = Context.getTypeFromSubstitutionSchema (
129+ prop->getSuperclass (),
130+ prop->getSubstitutions (),
131+ genericParams, MutableTerm ());
132+ if (superclassType->hasError ())
133+ return ;
134+
124135 reqs.emplace_back (RequirementKind::Superclass,
125- subjectType,
126- Context.getTypeFromSubstitutionSchema (
127- prop->getSuperclass (),
128- prop->getSubstitutions (),
129- genericParams, MutableTerm ()));
136+ subjectType, superclassType);
130137 return ;
138+ }
131139
132140 case Symbol::Kind::ConcreteType: {
133141 auto concreteType = Context.getTypeFromSubstitutionSchema (
0 commit comments