code wiki / (root) / _self_host_stmt_boundary_regression.nx

_self_host_stmt_boundary_regression.nx source

↩ module page · 48 lines · 1193 B

1// Regression for at_stmt_boundary refinement (2026-05-16). 2// 3// PREVENT additive: newline-after-expression continues into bitwise 4// operators (`|`, `&`, `^`), comparisons (`==`, `<`, ...), shifts 5// (`<<`, `>>`), and logical (`&&`, `||`). They can never start a 6// statement, so they're continuations. 7// 8// Ambiguous tokens (`*`, `-`, `&`, `+`) still trigger boundary -- 9// preserves the F-meta-2 fix. 10// 11// Passing case returns 0. Failing case returns 1, 2, or 3. 12 13import "nx_syscalls.nx" 14 15func test_multiline_or() -> i64 { 16 let x: i64 = 1 17 | (2 << 8) 18 | (3 << 16) 19 if x != 197121 { return 1 } 20 return 0 21} 22 23func test_multiline_compare() -> i64 { 24 let z: i64 = 5 25 if z 26 < 10 27 { 28 return 0 29 } 30 return 2 31} 32 33func test_multiline_shift() -> i64 { 34 let y: i64 = 1 35 << 8 36 if y != 256 { return 3 } 37 return 0 38} 39 40func main() -> i64 { 41 let r1: i64 = test_multiline_or() 42 if r1 != 0 { return r1 } 43 let r2: i64 = test_multiline_compare() 44 if r2 != 0 { return r2 } 45 let r3: i64 = test_multiline_shift() 46 if r3 != 0 { return r3 } 47 return 0 48}