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

17 lines
740 B
Plaintext

// `lib.sx` imports `dep.sx`, so `Needs` is bare-visible HERE. A module that
// imports only `lib.sx` cannot see `Needs` (non-transitive). The pack fn's
// fixed-prefix param `n: Needs` must therefore resolve in this module's
// context, not the caller's.
#import "modules/std.sx";
#import "dep.sx";
make :: () -> Needs => Needs.{ v = 7 };
// Control: a plain (non-pack) fn with the same fixed param already resolves in
// its defining module — the cross-module call-arg typing path is source-pinned.
use_plain :: (n: Needs) -> i64 => n.v;
// Pack fn: the fixed-prefix param `n: Needs` is bound during pack
// monomorphization. Its type must resolve under this module's source.
use_pack :: (n: Needs, ..$args) -> i64 => n.v + args[0];