Issue #2544: An if or match on a value known in a comptime? copy is decided while building, and only the taken branch is emitted

Open and answer this issue on GitHub.

ready · opened 2026-11-21 · updated 2026-11-21 · 0 comments

Part of #906 After #2537

What it is

ADR-specialization-1 D4: an if or a match on a value known in this copy (and, once @unroll exists, this turn) is decided while building; only the branch taken is emitted, the others are checked once as ordinary code. No word marks it. This is what lets a comptime? copy keep only the part its value needs. Was #906 item 4.

To build

  1. The checker records the arm taken per copy (keyed so a turn can be added later), and the emitter writes only that arm. Test: a decided match in a comptime? function, its copy for a literal running the one arm, the ordinary function all arms (tests/compiler/tests/, .stdout; the lowered copy holds only the taken arm).

Done when

An if/match on a value known in a comptime? copy lowers to the taken branch alone while the ordinary function keeps every branch, shown by its test; the commit carries Fixes #N for this issue, and the report gives a Found: line per finding.

Split from #906 by Claude Code

Back to Open Issues