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.
24 lines
994 B
Plaintext
24 lines
994 B
Plaintext
// E6a — own-wins-over-flat for UNION per-decl nominal identity. `main` flat-imports
|
|
// `dep.sx` (which authors `Pair { a }`) AND authors its OWN `Pair { m }`. A bare
|
|
// `Pair` reference in `main` resolves to `main`'s OWN author, not the flat-imported
|
|
// one (the querying source's author wins outright — no ambiguity), so `p : Pair`
|
|
// here binds `main`'s union (whose `m` field dep's `Pair` lacks) while `dep_pair()`
|
|
// uses dep's DISTINCT `Pair`.
|
|
//
|
|
// Fail-before (pre-E6a): the stateless `type_bridge.resolveInlineUnion` `findByName`
|
|
// short-circuit interned ONE global last-wins `Pair`, so `main`'s `Pair` and dep's
|
|
// `Pair` collapsed to a single nominal — `p.m` would resolve against whichever
|
|
// author won the global slot, silently wrong with no diagnostic.
|
|
|
|
#import "modules/std.sx";
|
|
#import "0798-modules-same-name-union-own-wins/dep.sx";
|
|
|
|
Pair :: union { m: i32; }
|
|
|
|
main :: () -> i32 {
|
|
p : Pair = ---;
|
|
p.m = 5;
|
|
print("own={} dep={}\n", p.m, dep_pair());
|
|
0
|
|
}
|