Files
sx/examples/modules/0722-modules-flat-same-name-own.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

19 lines
755 B
Plaintext

// fix-0102c (issue 0102): two flat FILE imports each author a same-name free
// function `greet`. The first-wins import merge keeps exactly one `greet` in
// the merged scope, but each module's OWN code must bind its OWN author when it
// calls `greet` bare. `from_a` (in a.sx) returns 1; `from_b` (in b.sx) returns
// 2 — per-source binding, resolved by identity, not first-wins.
#import "modules/std.sx";
#import "0722-modules-flat-same-name-own/a.sx";
#import "0722-modules-flat-same-name-own/b.sx";
report :: (label: string, ok: bool) {
if ok { print("{}: ok\n", label); } else { print("{}: FAIL\n", label); }
}
main :: () -> i32 {
report("from_a binds a.greet", from_a() == 1);
report("from_b binds b.greet", from_b() == 2);
0
}