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.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// E6b — own-wins for an ERROR-SET name in a CLOSURE-LITERAL return annotation
|
||||
// (`closure(() -> !IoErr { … })`). `main` flat-imports `dep.sx` (which authors
|
||||
// `IoErr { Net }`) AND authors its OWN `IoErr { Disk }`. The closure literal's
|
||||
// `-> !IoErr` channel must resolve to `main`'s OWN author (own-wins), so the
|
||||
// `raise error.Disk` inside the closure body validates against main's `{ Disk }`;
|
||||
// meanwhile `dep_err` keeps dep's DISTINCT `IoErr { Net }`.
|
||||
//
|
||||
// Fail-before (attempt-1): `lowerLambda` resolved the explicit `lam.return_type`
|
||||
// through the STATELESS `type_bridge.resolveAstType`, so the closure's `!IoErr`
|
||||
// channel bound the global last-wins author (dep's `{ Net }`); `error.Disk` was
|
||||
// then "not in error set 'IoErr'" and the program exited 1.
|
||||
//
|
||||
// Pass-after: the lambda return annotation routes through the source-aware
|
||||
// `resolveTypeWithBindings` (same path as the regular function-return channel),
|
||||
// main's own `IoErr` wins, `error.Disk` validates, exit 0.
|
||||
|
||||
#import "modules/std.sx";
|
||||
#import "0813-modules-same-name-error-set-lambda-own-wins/dep.sx";
|
||||
|
||||
IoErr :: error { Disk }
|
||||
|
||||
main :: () -> i32 {
|
||||
fail_own := closure(() -> !IoErr { raise error.Disk; });
|
||||
fail_own() catch (e) {
|
||||
if e == error.Disk { print("own=Disk\n"); }
|
||||
};
|
||||
d := dep_err();
|
||||
print("dep={}\n", d);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user