131. Inference unifies siblings within one expression, never across statements (2026-11-21)
- Decision. Element types of list literals,
if/elsebranches,matcharms and comprehension results are unified across all siblings before generic parameters are fixed, withnonejoiningTto?T:[Pair(1, none), Pair(2, 3)]is aList<Pair<Int, ?Int>>. Inference never looks at later statements:var x = nonefollowed byx = 3stays an error asking for?Intwherexis declared. Range inference (model A:letkeeps its computed range, an unannotatedvarwidens toInt,var x: lo..=hichecks each assignment) stays intraprocedural, goes through arithmetic onlets, runs no loop fixpoints and crosses no calls; whatever it can't prove keeps its runtime check. - Why. Fixes the reproduced error on
[Pair(1, none), Pair(2, 3)]while keeping inference local, predictable and linear (compile speed beats exotic analysis). Range inference only affects widths and elided checks, never meaning. - Reverse. First-element inference; or flow-sensitive inference across statements.
- Status. Accepted; sibling unification not implemented.