Files
sx/examples/modules/0754-modules-same-name-struct-own-wins.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

16 lines
622 B
Plaintext

// issue 0105 case 3 — own-wins-over-flat. `main` flat-imports `dep.sx` (which
// authors `Widget { a }`) AND authors its OWN `Widget { m }`. A bare `Widget`
// reference in `main` resolves to `main`'s OWN author, not the flat-imported one
// (the querying source's author wins outright — no ambiguity), so `Widget.{ m }`
// builds `main`'s type while `dep_widget()` returns `dep`'s distinct `Widget`.
#import "modules/std.sx";
#import "0754-modules-same-name-struct-own-wins/dep.sx";
Widget :: struct { m: i64; }
main :: () -> i32 {
w := Widget.{ m = 5 };
print("own={} dep={}\n", w, dep_widget());
0
}