Skip to content

Commit 1a5504f

Browse files
rchen152meta-codesync[bot]
authored andcommitted
Split Quantified and PartialQuantified code paths
Summary: For #105. PartialQuantified will continue to have eager pinning behavior, whereas we want to delay solving Quantified in some cases. So let's split these code paths to make later changes easier. This diff does not change any user-facing behavior. Reviewed By: migeed-z Differential Revision: D96334059 fbshipit-source-id: 5543a6db71879831d902a0c2b80cb06bacaccf38
1 parent 34beb96 commit 1a5504f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

pyrefly/lib/solver/solver.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,25 +2013,24 @@ impl<'a, Ans: LookupAnswer> Subset<'a, Ans> {
20132013
} else {
20142014
t1_p.clone()
20152015
};
2016-
self.solver
2017-
.variables
2018-
.lock()
2019-
.update(*v2, Variable::Answer(answer));
20202016
// Widen None to None | Any for PartialQuantified, matching
20212017
// the PartialContained behavior (see comment there).
20222018
if is_partial {
20232019
let variables = self.solver.variables.lock();
2024-
let v2_current = variables.get(*v2);
2025-
if let Variable::Answer(t) = &*v2_current
2026-
&& t.is_none()
2027-
{
2020+
if answer.is_none() {
20282021
let widened = self
20292022
.solver
20302023
.heap
2031-
.mk_union(vec![t.clone(), Type::any_implicit()]);
2032-
drop(v2_current);
2024+
.mk_union(vec![answer.clone(), Type::any_implicit()]);
20332025
variables.update(*v2, Variable::Answer(widened));
2026+
} else {
2027+
variables.update(*v2, Variable::Answer(answer));
20342028
}
2029+
} else {
2030+
self.solver
2031+
.variables
2032+
.lock()
2033+
.update(*v2, Variable::Answer(answer));
20352034
}
20362035
Ok(())
20372036
}

0 commit comments

Comments
 (0)