mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Constraint solver] Don't reprocess constraints known to be unsolvable.
When we're creating a new constraint because we couldn't solve it (and need to record the result), do so without trying to simplify it yet again. It's just wasted work.
This commit is contained in:
@@ -1196,8 +1196,11 @@ ConstraintSystem::matchTypes(Type type1, Type type2, TypeMatchKind kind,
|
||||
// this new constraint will be solved at a later point.
|
||||
// Obviously, this must not happen at the top level, or the
|
||||
// algorithm would not terminate.
|
||||
addConstraint(getConstraintKind(kind), type1, type2,
|
||||
getConstraintLocator(locator));
|
||||
addUnsolvedConstraint(Constraint::create(*this,
|
||||
getConstraintKind(kind),
|
||||
type1, type2, DeclName(),
|
||||
FunctionRefKind::Compound,
|
||||
getConstraintLocator(locator)));
|
||||
return SolutionKind::Solved;
|
||||
}
|
||||
|
||||
@@ -3672,7 +3675,9 @@ ConstraintSystem::simplifyRestrictedConstraint(ConversionRestrictionKind restric
|
||||
getConstraintLocator(locator));
|
||||
|
||||
Constraint *disjunctionChoices[] = {int8Con, uint8Con, voidCon};
|
||||
addDisjunctionConstraint(disjunctionChoices, locator);
|
||||
addUnsolvedConstraint(
|
||||
Constraint::createDisjunction(*this, disjunctionChoices,
|
||||
getConstraintLocator(locator)));
|
||||
return SolutionKind::Solved;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user