From 3fff5dd064fd99eb905cbbec37cc8e6e9c19762c Mon Sep 17 00:00:00 2001 From: Pavel Yaskevich Date: Wed, 29 Jan 2020 09:40:38 -0800 Subject: [PATCH] [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. --- lib/Sema/CSSimplify.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/Sema/CSSimplify.cpp b/lib/Sema/CSSimplify.cpp index 870eae283b2f5..2a24f5f95d981 100644 --- a/lib/Sema/CSSimplify.cpp +++ b/lib/Sema/CSSimplify.cpp @@ -4068,16 +4068,12 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind, auto result = matchTypes(instanceType1, instanceType2, subKind, subflags, locator.withPathElement(ConstraintLocator::InstanceType)); - if (shouldAttemptFixes() && result.isFailure()) { - auto *anchor = locator.getAnchor(); - if (anchor && isa(anchor)) { - auto *fix = - ContextualMismatch::create(*this, instanceType1, instanceType2, - getConstraintLocator(locator)); - conversionsOrFixes.push_back(fix); - break; - } - } + + // If matching of the instance types resulted in the failure make sure + // to give `repairFailure` a chance to run to attempt to fix the issue. + if (shouldAttemptFixes() && result.isFailure()) + break; + return result; }