Skip to content

Commit 0e2a591

Browse files
authored
Merge pull request swiftlang#18576 from xedin/small-matchtypes-cleanup
[CSSimplify] NFC: `matchTypes` - group all "fix" affecting conditions…
2 parents 9ebbf2f + 477a3fb commit 0e2a591

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,13 +2367,17 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
23672367
}
23682368
}
23692369

2370+
// Attempt fixes iff it's allowed, both types are concrete and
2371+
// we are not in the middle of attempting one already.
2372+
bool attemptFixes =
2373+
shouldAttemptFixes() && concrete && !flags.contains(TMF_ApplyingFix);
2374+
23702375
// When we hit this point, we're committed to the set of potential
23712376
// conversions recorded thus far.
23722377
//
23732378
// If we should attempt fixes, add those to the list. They'll only be visited
23742379
// if there are no other possible solutions.
2375-
if (shouldAttemptFixes() && !isTypeVarOrMember1 && !isTypeVarOrMember2 &&
2376-
!flags.contains(TMF_ApplyingFix) && kind >= ConstraintKind::Conversion) {
2380+
if (attemptFixes && kind >= ConstraintKind::Conversion) {
23772381
Type objectType1 = type1->getRValueType();
23782382

23792383
// If we have an optional type, try to force-unwrap it.

0 commit comments

Comments
 (0)