Files
sx/examples/modules/0818-modules-qualified-annotation-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

22 lines
829 B
Plaintext

// G1 (struct) — a qualified `a.Box` annotation selects the NAMESPACE target's OWN
// `Box`, distinct from `main`'s same-name bare author. `main` authors its OWN
// `Box { m }` AND namespace-imports `a` (which authors `Box { a }`). A bare `Box`
// binds main's own author (own-wins); the qualified `a.Box` binds `a`'s DISTINCT
// nominal even though main has a same-name bare author. The field sets are
// disjoint, so a cross-binding (`q.m` / `own.a`) is a hard compile error — the
// example compiling and running proves the two `Box`es are distinct nominals.
#import "modules/std.sx";
a :: #import "0818-modules-qualified-annotation-own-wins/dep.sx";
Box :: struct { m: i32; }
main :: () -> i32 {
own : Box = ---;
own.m = 5;
q : a.Box = ---;
q.a = 9;
print("own.m={} q.a={}\n", own.m, q.a);
0
}