Design decisions

131. Inference unifies siblings within one expression, never across statements (2026-11-21)

  • Decision. Element types of list literals, if/else branches, match arms and comprehension results are unified across all siblings before generic parameters are fixed, with none joining T to ?T: [Pair(1, none), Pair(2, 3)] is a List<Pair<Int, ?Int>>. Inference never looks at later statements: var x = none followed by x = 3 stays an error asking for ?Int where x is declared. Range inference (model A: let keeps its computed range, an unannotated var widens to Int, var x: lo..=hi checks each assignment) stays intraprocedural, goes through arithmetic on lets, 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.