0%

typeck-semantics

Goal

Type the block as the unified exit-path type; bare break is loop-only; continue:block is an error; loop transparency.

Implementation Sketch

Unify all break:label values + final expr; thread label namespace (no-shadowing); pass-through semantics for bare break + loop-label control flow.

Spec References

labeled-block-early-exit-proposal.md Semantics + Unlabeled-break + continue:block-error + Loop-Control-Transparency.

Work Items

  • Type the block as the unified type of ALL break:label value exit paths AND the final expression (per proposal Semantics) in compiler/ori_types/; break:label value binds value to the named block.
  • Bare break (no label) inside a labeled block is LOOP-ONLY — passes THROUGH the block to the innermost enclosing loop (per proposal). break:loop_label / continue:loop_label are transparent through blocks (like try { }). No-shadowing: block labels share the loop-label namespace.
  • continue:block_label targeting a labeled block is a COMPILE-TIME ERROR (blocks do not iterate) — emit a structured diagnostic (allocate a new E-code); negative #compile_fail test pins it. continue:loop_label through a block stays valid.