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
{{ message }}
Repository navigation
[v1.5 regression] Repeating a type guard condition causes the guard to be lost #5546
Root cause: #5256 switched NarrowOp::Or from JoinStyle::SimpleMerge to JoinStyle::NarrowOf(type_info). Besides collapsing a gradual base back to Any (what #5256 needed), the NarrowOf join also returns the base type whenever base <: union(branches). A class with an Any base is assignable from anything, so type[object] <: type[C] holds and the join gives back type[object], even with two different guards (has(t) or has2(t)). 1.4.0 reveals type[C] for both.
Plan: keep the NarrowOf join for gradual bases and for facets, but use the plain union of the branches for the root type of a non-gradual base, as before #5256.
Activity
Divyansh151005 commentedon Nov 12, 2026
#claim
Root cause: #5256 switched
NarrowOp::OrfromJoinStyle::SimpleMergetoJoinStyle::NarrowOf(type_info). Besides collapsing a gradual base back toAny(what #5256 needed), theNarrowOfjoin also returns the base type wheneverbase <: union(branches). A class with anAnybase is assignable from anything, sotype[object] <: type[C]holds and the join gives backtype[object], even with two different guards (has(t) or has2(t)). 1.4.0 revealstype[C]for both.Plan: keep the
NarrowOfjoin for gradual bases and for facets, but use the plain union of the branches for the root type of a non-gradual base, as before #5256.github-actions commentedon Nov 12, 2026
@Divyansh151005 you've claimed this issue — it's now assigned to you. Thanks for picking it up! 🎉