You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#18246: correctly compute capture sets in TypeComparer.glb (#18254)
Intuitively, `glb(S1^C1, S2^C2)` should capture `C1 ⊓ C2`, where `⊓`
denotes the glb of capture sets. When computing `glb(tp1, tp2)`, if
`tp1` matches `CapturingType(parent1, refs1)`, it captures `C0 ++ refs1`
where `C0` is the nested capture sets inside `parent1`. Denote the
capture set of `tp2` with `C2`, the result should capture `(C0 ++ refs1)
⊓ C2`. Presumably, `⊓` distributes over the union (`++`); therefore `(C0
++ refs1) ⊓ C2` equals `C0 ⊓ C2 ++ refs1 ⊓ C2`.
Previously, if `C2` is a subcapture of `refs1`, it is simply dropped.
However, based on the above reasoning, we have `refs1 ⊓ C2` equals `C2`;
therefore `C0 ⊓ C2 ++ refs1 ⊓ C2` equals `C0 ⊓ C2 ++ C2`. `C2` should
not be dropped, but rather kept. This PR fixes the logic to behave
correctly.
Fixes#18246.
0 commit comments