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.
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
// G3 — own-wins HALVES for the route-all surfaces 0815 covered only on the
|
|
// ambiguous half. `main` authors its OWN `Box { m }` and flat-imports `dep.sx`
|
|
// (`Box { a }`); each surface below must bind main's OWN `Box`, observed by a
|
|
// `.m` access (disjoint field sets → a wrong-author binding is a hard compile
|
|
// error). Complements 0816 (which covered only the union body-builder child):
|
|
// - pointer wrapper-alias element `BoxPtr :: *Box`
|
|
// - tuple element `(Box, i32)`
|
|
// - enum body-builder child `WrapE :: enum { V: Box }`
|
|
// - inline-anonymous union child `x : union { b: Box }`
|
|
|
|
#import "modules/std.sx";
|
|
#import "0822-route-all-own-wins-surfaces/dep.sx";
|
|
|
|
Box :: struct { m: i32; }
|
|
BoxPtr :: *Box;
|
|
WrapE :: enum { V: Box; }
|
|
|
|
main :: () -> i32 {
|
|
own : Box = ---;
|
|
own.m = 10;
|
|
|
|
// *Named wrapper-alias element own-wins
|
|
bp : BoxPtr = @own;
|
|
|
|
// tuple element own-wins
|
|
t : (Box, i32) = ---;
|
|
t.0.m = 12;
|
|
|
|
// enum body-builder child own-wins (payload must be main's `Box`)
|
|
we : WrapE = .V(own);
|
|
ev := we.V.m;
|
|
|
|
// inline-anonymous union child own-wins
|
|
x : union { b: Box; n: i32 } = ---;
|
|
x.b.m = 13;
|
|
|
|
print("bp={} t={} ev={} x={} dep={}\n", bp.m, t.0.m, ev, x.b.m, dep_box());
|
|
0
|
|
}
|