Files
sx/examples/errors/1015-errors-failable-or-reject.sx
agra 66bdc70bf1 test: group examples into per-category folders
Move examples/*.sx and their expected/ snapshots into per-category
subfolders (examples/<category>/...). Folder = leading filename token,
with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus
runner and LSP sweep now discover each category's expected/ dir, while
issues/ stays flat. Example 1058's repo-root-relative companion import
is made file-relative. Path strings embedded in 164 snapshots were
regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
2026-06-21 14:41:34 +03:00

20 lines
568 B
Plaintext

// Failable `or` rejection (ERR step E2.4a): the value-terminator form
// (`lhs or value`) requires a value-carrying failable LHS — a pure failable
// (`-> !`) has no success value to fall back to, so `or value` is rejected
// (use `catch` to absorb the error). The positive cases live in
// `examples/231-failable-or.sx`.
#import "modules/std.sx";
E :: error { Bad }
must :: (n: i32) -> !E {
if n < 0 { raise error.Bad; }
return;
}
main :: () -> i32 {
x := must(-1) or 0; // error: `-> !` has no success value to fall back to
return 0;
}