Files
sx/examples/modules/0757-modules-same-name-struct-self-ref.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

17 lines
813 B
Plaintext

// issue 0105 / F1 regression — a SELF-REFERENCE inside a same-name struct shadow.
// Two flat-imported modules each declare a top-level `Box`; module B's `Box` has
// a field `next: *Box` referencing its own name. The shadow must resolve that
// self-ref to ITS OWN nominal identity, not the first same-name author (A's
// `Box`), so `head.next.*.y` reads B's `y` (= 42). Proves the reserve-before-
// fields ordering: a shadow author's decl key is recorded before its fields are
// resolved, so a self / forward ref binds via `type_decl_tids`, never the global
// findByName first-author fallback.
#import "modules/std.sx";
#import "0757-modules-same-name-struct-self-ref/a.sx";
#import "0757-modules-same-name-struct-self-ref/b.sx";
main :: () -> i32 {
print("a={} b={}\n", a_box(), b_chain());
0
}