@@ -2587,8 +2587,7 @@ bool ConstraintSystem::repairFailures(
2587
2587
});
2588
2588
};
2589
2589
2590
- if (path.empty () ||
2591
- path.back ().is <LocatorPathElt::ExplicitTypeCoercion>()) {
2590
+ if (path.empty ()) {
2592
2591
if (!anchor)
2593
2592
return false ;
2594
2593
@@ -3219,16 +3218,9 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
3219
3218
// let's defer it until later proper check.
3220
3219
if (!(desugar1->is <DependentMemberType>() &&
3221
3220
desugar2->is <DependentMemberType>())) {
3222
- if (desugar1->isEqual (desugar2)) {
3223
- if (kind >= ConstraintKind::Conversion &&
3224
- !flags.contains (TMF_ApplyingFix)) {
3225
- if (RemoveUnnecessaryCoercion::attempt (*this , type1, type2,
3226
- getConstraintLocator (locator))) {
3227
- return getTypeMatchFailure (locator);
3228
- }
3229
- }
3230
- if (!isa<InOutType>(desugar2))
3231
- return getTypeMatchSuccess ();
3221
+ // If the types are obviously equivalent, we're done.
3222
+ if (desugar1->isEqual (desugar2) && !isa<InOutType>(desugar2)) {
3223
+ return getTypeMatchSuccess ();
3232
3224
}
3233
3225
}
3234
3226
@@ -8037,7 +8029,6 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyFixConstraint(
8037
8029
case FixKind::GenericArgumentsMismatch:
8038
8030
case FixKind::AllowMutatingMemberOnRValueBase:
8039
8031
case FixKind::AllowTupleSplatForSingleParameter:
8040
- case FixKind::RemoveUnnecessaryCoercion:
8041
8032
llvm_unreachable (" handled elsewhere" );
8042
8033
}
8043
8034
@@ -8344,20 +8335,11 @@ void ConstraintSystem::addExplicitConversionConstraint(
8344
8335
SmallVector<Constraint *, 3 > constraints;
8345
8336
8346
8337
auto locatorPtr = getConstraintLocator (locator);
8347
- ConstraintLocator *coerceLocator = locatorPtr;
8348
-
8349
- if (allowFixes && shouldAttemptFixes ()) {
8350
- auto *anchor = locator.getAnchor ();
8351
- if (isa<CoerceExpr>(anchor) && !anchor->isImplicit ()) {
8352
- coerceLocator =
8353
- getConstraintLocator (anchor, LocatorPathElt::ExplicitTypeCoercion ());
8354
- }
8355
- }
8356
8338
8357
8339
// Coercion (the common case).
8358
8340
Constraint *coerceConstraint =
8359
8341
Constraint::create (*this , ConstraintKind::Conversion,
8360
- fromType, toType, coerceLocator );
8342
+ fromType, toType, locatorPtr );
8361
8343
coerceConstraint->setFavored ();
8362
8344
constraints.push_back (coerceConstraint);
8363
8345
0 commit comments