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.
37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
// The cleanup-absorption check (ERR step E1.7) is TRANSITIVE: a bare,
|
|
// un-absorbed failable call is rejected no matter how deeply it is nested
|
|
// inside a `defer` / `onfail` body's control flow — through `if` (both
|
|
// branches), nested blocks, and loops. 1049 covers the direct-body case; this
|
|
// pins the recursive arms of `checkCleanupNode` (`.if_expr`, `.block`,
|
|
// `.while_expr`) before A5.2 extracts the pass into its own module.
|
|
//
|
|
// Three bare failables, three rejections; the program never runs (exit 1).
|
|
|
|
#import "modules/std.sx";
|
|
|
|
E :: error { Bad }
|
|
|
|
failing :: () -> !E { raise error.Bad; }
|
|
|
|
work :: (n: i32) -> !E {
|
|
defer {
|
|
if n > 0 {
|
|
failing(); // REJECTED: nested in the `if` then-branch
|
|
} else {
|
|
{ failing(); } // REJECTED: nested block in the else-branch
|
|
}
|
|
}
|
|
onfail {
|
|
while n > 0 {
|
|
failing(); // REJECTED: nested in the `while` body
|
|
}
|
|
}
|
|
if n < 0 { raise error.Bad; }
|
|
return;
|
|
}
|
|
|
|
main :: () -> i32 {
|
|
a := work(-1);
|
|
return 0;
|
|
}
|