mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSolver] Refactor solveSimplified to consolidate disjunction choice attributes/operations
Consolidate some of the attributes and operations common to disjunction choice in new `DisjunctionChoice` class, which simplifies implementation of the `ConstraintSystem::solveSimplified` method related to overload selection.
This commit is contained in:
@@ -4986,3 +4986,26 @@ ConstraintSystem::simplifyConstraint(const Constraint &constraint) {
|
||||
|
||||
llvm_unreachable("Unhandled ConstraintKind in switch.");
|
||||
}
|
||||
|
||||
void ConstraintSystem::simplifyDisjunctionChoice(Constraint *choice) {
|
||||
// Simplify this term in the disjunction.
|
||||
switch (simplifyConstraint(*choice)) {
|
||||
case ConstraintSystem::SolutionKind::Error:
|
||||
if (!failedConstraint)
|
||||
failedConstraint = choice;
|
||||
solverState->retireConstraint(choice);
|
||||
break;
|
||||
|
||||
case ConstraintSystem::SolutionKind::Solved:
|
||||
solverState->retireConstraint(choice);
|
||||
break;
|
||||
|
||||
case ConstraintSystem::SolutionKind::Unsolved:
|
||||
InactiveConstraints.push_back(choice);
|
||||
CG.addConstraint(choice);
|
||||
break;
|
||||
}
|
||||
|
||||
// Record this as a generated constraint.
|
||||
solverState->addGeneratedConstraint(choice);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user