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 {
428428
429429 FixKind getKind () const { return Kind; }
430430
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 {
434434 switch (fixBehavior) {
435435 case FixBehavior::AlwaysWarning:
436436 case FixBehavior::DowngradeToWarning:
437437 case FixBehavior::Suppress:
438- return true ;
438+ return false ;
439439
440440 case FixBehavior::Error:
441- return false ;
441+ return true ;
442442 }
443443 }
444444
Original file line number Diff line number Diff line change @@ -8467,7 +8467,7 @@ bool ConstraintSystem::applySolutionFixes(const Solution &solution) {
84678467
84688468 auto diagnosed =
84698469 primaryFix->coalesceAndDiagnose (solution, secondaryFixes);
8470- if (primaryFix->canApplySolution ()) {
8470+ if (! primaryFix->isFatal ()) {
84718471 assert (diagnosed && " warnings should always be diagnosed" );
84728472 (void )diagnosed;
84738473 } else {
@@ -9127,9 +9127,9 @@ Optional<SolutionApplicationTarget> ConstraintSystem::applySolution(
91279127 bool diagnosedErrorsViaFixes = applySolutionFixes (solution);
91289128 bool canApplySolution = true ;
91299129 for (const auto fix : solution.Fixes ) {
9130- if (! fix->canApplySolution ())
9130+ if (fix->isFatal ())
91319131 canApplySolution = false ;
9132- if (fix->affectsSolutionScore () == SK_Fix && fix->canApplySolution ())
9132+ if (fix->affectsSolutionScore () == SK_Fix && ! fix->isFatal ())
91339133 ++numResolvableFixes;
91349134 }
91359135
Original file line number Diff line number Diff line change @@ -4616,7 +4616,7 @@ bool ConstraintSystem::diagnoseAmbiguityWithFixes(
46164616 // let's diagnose this as regular ambiguity.
46174617 if (llvm::all_of (solutions, [](const Solution &solution) {
46184618 return llvm::all_of (solution.Fixes , [](const ConstraintFix *fix) {
4619- return fix->canApplySolution ();
4619+ return ! fix->isFatal ();
46204620 });
46214621 })) {
46224622 return diagnoseAmbiguity (solutions);
You can’t perform that action at this time.
0 commit comments