File tree Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Expand file tree Collapse file tree 3 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -428,17 +428,17 @@ class ConstraintFix {
428
428
429
429
FixKind getKind () const { return Kind; }
430
430
431
- // / Whether it is still possible to "apply" a solution containing this kind
432
- // / of fix to get a usable AST.
433
- bool canApplySolution () const {
431
+ // / Whether this fix fatal for the constraint solver, meaning that it cannot
432
+ // / produce a usable type-checked AST.
433
+ bool isFatal () const {
434
434
switch (fixBehavior) {
435
435
case FixBehavior::AlwaysWarning:
436
436
case FixBehavior::DowngradeToWarning:
437
437
case FixBehavior::Suppress:
438
- return true ;
438
+ return false ;
439
439
440
440
case FixBehavior::Error:
441
- return false ;
441
+ return true ;
442
442
}
443
443
}
444
444
Original file line number Diff line number Diff line change @@ -8467,7 +8467,7 @@ bool ConstraintSystem::applySolutionFixes(const Solution &solution) {
8467
8467
8468
8468
auto diagnosed =
8469
8469
primaryFix->coalesceAndDiagnose (solution, secondaryFixes);
8470
- if (primaryFix->canApplySolution ()) {
8470
+ if (! primaryFix->isFatal ()) {
8471
8471
assert (diagnosed && " warnings should always be diagnosed" );
8472
8472
(void )diagnosed;
8473
8473
} else {
@@ -9127,9 +9127,9 @@ Optional<SolutionApplicationTarget> ConstraintSystem::applySolution(
9127
9127
bool diagnosedErrorsViaFixes = applySolutionFixes (solution);
9128
9128
bool canApplySolution = true ;
9129
9129
for (const auto fix : solution.Fixes ) {
9130
- if (! fix->canApplySolution ())
9130
+ if (fix->isFatal ())
9131
9131
canApplySolution = false ;
9132
- if (fix->affectsSolutionScore () == SK_Fix && fix->canApplySolution ())
9132
+ if (fix->affectsSolutionScore () == SK_Fix && ! fix->isFatal ())
9133
9133
++numResolvableFixes;
9134
9134
}
9135
9135
Original file line number Diff line number Diff line change @@ -4616,7 +4616,7 @@ bool ConstraintSystem::diagnoseAmbiguityWithFixes(
4616
4616
// let's diagnose this as regular ambiguity.
4617
4617
if (llvm::all_of (solutions, [](const Solution &solution) {
4618
4618
return llvm::all_of (solution.Fixes , [](const ConstraintFix *fix) {
4619
- return fix->canApplySolution ();
4619
+ return ! fix->isFatal ();
4620
4620
});
4621
4621
})) {
4622
4622
return diagnoseAmbiguity (solutions);
You can’t perform that action at this time.
0 commit comments