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

23 lines
1.1 KiB
Plaintext

// fix-0102c F2 (issue 0102): two flat FILE imports each author a same-name free
// function `apply` with a DIFFERENT parameter TYPE — a.sx takes a value
// (`x: i64`), b.sx takes a pointer (`x: *i64`). The first-wins import merge
// keeps a.sx's value-typed `apply`, but each module's bare call must type its
// arguments against ITS OWN author. b.sx's `from_b` passes a local `v` to its
// pointer-param `apply` via implicit address-of; before the fix the arg was
// typed against the first-wins (value) winner, lowered as a value, then the
// resolved pointer-param author was called with that value bit-cast to a
// pointer — a segfault. Regression: per-source parameter target typing.
#import "modules/std.sx";
#import "0728-modules-flat-same-name-paramtype/a.sx";
#import "0728-modules-flat-same-name-paramtype/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.apply (value param)", from_a() == 11);
report("from_b binds b.apply (pointer param)", from_b() == 42);
0
}