Skip to content

Commit 3fff5dd

Browse files
committed
[ConstraintSystem] Extend metatype instance type mismatch coverage
Originally type mismatches associated with metatypes were only covered for coercions but fix coverage grew since then and now it makes sense to remove special case and let `repairFailures` take care of it.
1 parent ffa6bf4 commit 3fff5dd

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4068,16 +4068,12 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
40684068
auto result =
40694069
matchTypes(instanceType1, instanceType2, subKind, subflags,
40704070
locator.withPathElement(ConstraintLocator::InstanceType));
4071-
if (shouldAttemptFixes() && result.isFailure()) {
4072-
auto *anchor = locator.getAnchor();
4073-
if (anchor && isa<CoerceExpr>(anchor)) {
4074-
auto *fix =
4075-
ContextualMismatch::create(*this, instanceType1, instanceType2,
4076-
getConstraintLocator(locator));
4077-
conversionsOrFixes.push_back(fix);
4078-
break;
4079-
}
4080-
}
4071+
4072+
// If matching of the instance types resulted in the failure make sure
4073+
// to give `repairFailure` a chance to run to attempt to fix the issue.
4074+
if (shouldAttemptFixes() && result.isFailure())
4075+
break;
4076+
40814077
return result;
40824078
}
40834079

0 commit comments

Comments
 (0)