Files
sx/examples/packs/0544-packs-imported-pack-fn-fixed-param-source-pin.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

// Regression (stdlib E4): an imported pack function whose fixed-prefix param
// type is visible only in its defining module must resolve during pack
// monomorphization. `lib.sx` imports `dep.sx` (which defines `Needs`) and
// exposes `make() -> Needs` plus `use_pack(n: Needs, ..$args)`. `main` imports
// ONLY `lib.sx`, so `Needs` is two flat hops away and not bare-visible here —
// main never names it.
//
// Before the fix, `monomorphizePackFn` restored the caller's source before
// re-binding the fixed-prefix params, so `n: Needs` was resolved in main's
// context and rejected with "type 'Needs' is not visible" — even though the
// control plain fn `use_plain(n: Needs)` (typed via the source-pinned call-arg
// path) ran fine. The fixed-prefix param is now resolved under the pack fn's own
// source (`fd.body.source_file`), matching the rest of the pack signature/body.
#import "modules/std.sx";
#import "0544-packs-imported-pack-fn-fixed-param-source-pin/lib.sx";
main :: () -> i32 {
x := make();
print("plain {}\n", use_plain(x));
print("pack {}\n", use_pack(x, 1, 2));
return 0;
}