Skip to content

Commit 6bddac3

Browse files
committed
[ConstraintSystem] Allow to check presence of fix by kind and locator
1 parent 82c2456 commit 6bddac3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/Sema/ConstraintSystem.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,10 +2095,15 @@ class ConstraintSystem {
20952095

20962096
/// Determine whether constraint system already has a fix recorded
20972097
/// for a particular location.
2098-
bool hasFixFor(ConstraintLocator *locator) const {
2099-
return llvm::any_of(Fixes, [&locator](const ConstraintFix *fix) {
2100-
return fix->getLocator() == locator;
2101-
});
2098+
bool hasFixFor(ConstraintLocator *locator,
2099+
Optional<FixKind> expectedKind = None) const {
2100+
return llvm::any_of(
2101+
Fixes, [&locator, &expectedKind](const ConstraintFix *fix) {
2102+
if (fix->getLocator() == locator) {
2103+
return !expectedKind || fix->getKind() == *expectedKind;
2104+
}
2105+
return false;
2106+
});
21022107
}
21032108

21042109
/// If an UnresolvedDotExpr, SubscriptMember, etc has been resolved by the

0 commit comments

Comments
 (0)