[ConstraintSystem] Compute variables referenced by conjunction elements incrementally

Attempting to pre-compute a set of referenced type variables
upfront is incorrect because parameter(s) and/or result type
could be bound before conjunction is attempted. Let's compute
a set of referenced variables before each element gets attempted.
This commit is contained in:
Pavel Yaskevich
2021-09-01 10:32:17 -07:00
parent da3cef2961
commit 67a721485f
6 changed files with 93 additions and 79 deletions

View File

@@ -799,10 +799,6 @@ bool ConjunctionStep::attempt(const ConjunctionElement &element) {
CS.applySolution(Solutions.pop_back_val());
}
// Bring all of the referenced variables into scope.
for (auto *typeVar : element.getReferencedVars())
CS.addTypeVariable(typeVar);
// Make sure that element is solved in isolation
// by dropping all scoring information.
CS.CurrentScore = Score();