You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P2] Valid conditional blocks can underflow the operand stack #15
Reproduced during the 2026-09-04 language review at a20753c6cff96ee86758744e227a04460234a832. Priority: P2.
let x = if true {
1
} else {
2
}
x
This passes canonical checking but fails at execution with pop_stack_value on empty stack and missing-x diagnostics. The compact legal version using 1; and 2; behaves the same. let x = if true 1 else 2; x succeeds and returns 1.
Canonical newline lowering inserts VM semicolons. The inherited conditional-block code preserves its tail only when last_was_sep is false; see IfTrueBlock. Canonical try/catch received special tail-preservation handling, but this conditional path did not. The authoring guide explicitly recommends conditional values, making this more than an undocumented style preference; see authoring-for-llms.md.
Specify whether each block context produces a value, then preserve it during lowering. Every valid expression branch should leave exactly one operand. Empty or statement-only branches must either yield a specified nil or be rejected in value position. Test if, elif, and else inside assignments, arrays, calls, and try; test LF, CRLF, and explicit semicolons. Function blocks also need an explicit return rule: current canonical tails are discarded unless return is used.
Acceptance: implement the described correction, publish the resulting language contract, and add focused regression coverage including applicable capability, streaming-parser, and resource-limit cases.
Fix and executable regressions: PR #19. Workspace tests, explicit vendor suites, formatting, strict Clippy, and the Linux ARM64/RISC-V and Windows GNU compile checks pass locally. All GitHub Actions checks pass on f1e775f, including Linux tests, fuzzing, AddressSanitizer, and Miri. This issue remains open until the fix is merged.
Activity