code wiki / _hdl_build / nx_probe_exhaust_live.nx

nx_probe_exhaust_live.nx source

↩ module page · 26 lines · 1032 B

1// nx_probe_exhaust_live.nx -- PROBE (2026-08-05): does nx_cc check MATCH EXHAUSTIVENESS? 2// Three-variant enum, ALL arms present = the valid form. Elm/Rust/Swift refuse this; if this target 3// BUILDS, the check is absent and that is the next enforcement rung (climb v6 rung 1). 4// REPRO A (non-exhaustive): delete the Blue arm -> nx_parse: line N: non-exhaustive match on enum\n// ExhColor: 2 of 3 variants handled -- add an arm for: Blue\n// REPRO B (unreachable): duplicate the Red arm -> nx_parse: line N: unreachable match arm ExhColor::Red\n// -- already handled by an earlier arm of the match at line M\n// license_tier: ORIGINAL expect_exit: 0 5import "nx_syscalls.nx" 6 7enum ExhColor { 8 Red, 9 Green, 10 Blue, 11} 12 13func exh_code(c: i64) -> i64 { 14 match c { 15 ExhColor::Red => { return 1 }, 16 ExhColor::Green => { return 2 }, 17 ExhColor::Blue => { return 3 }, 18 } 19 return 0 20} 21 22func main(argc: i64, argv: *i64) -> i64 { 23 let k: i64 = exh_code(ExhColor::Red) 24 sys_exit(0) 25 return 0 26}