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,3 @@
|
||||
// Module A authors its OWN `Box` (one field `x`) — the FIRST same-name author.
|
||||
Box :: struct { x: i64; }
|
||||
a_box :: () -> Box { return Box.{ x = 7 }; }
|
||||
12
examples/modules/0757-modules-same-name-struct-self-ref/b.sx
Normal file
12
examples/modules/0757-modules-same-name-struct-self-ref/b.sx
Normal file
@@ -0,0 +1,12 @@
|
||||
// Module B authors a same-name `Box` shadow whose field SELF-REFERENCES its own
|
||||
// name (`next: *Box`). Pre-fix the self-ref resolved to A's `Box` (registered
|
||||
// first under the bare name), so `next.*.y` failed with "field 'y' not found on
|
||||
// type 'Box'". The shadow's slot is now reserved BEFORE its fields resolve, so
|
||||
// `*Box` binds to B's OWN nominal TypeId and the deref sees B's `y`.
|
||||
Box :: struct { y: i64; next: *Box; }
|
||||
b_chain :: () -> i64 {
|
||||
tail := Box.{ y = 42, next = null };
|
||||
head := Box.{ y = 1, next = @tail };
|
||||
// Walk the self-referential link; reads B's own `y`, not A's `x`.
|
||||
return head.next.*.y;
|
||||
}
|
||||
Reference in New Issue
Block a user