Files
sx/examples/0840-modules-imported-fn-param-type-source-pin.sx
agra 5b18048abb ir: AST-callee param typing pins the callee module's source context
The two not-yet-lowered fn_ast_map paths in resolveCallParamTypes (the
qualified `ns.f(...)` call and the plain free-fn call) resolved each
param type in the CALL SITE's visibility context, so a namespaced
import's param type that is bare-visible only in its own module
diagnosed "type 'X' is not visible" at calls whose caller never names
the type bare. Route both through the E4 source pin
(resolveParamTypeInSource), as the method paths already do.

A generic callee's bare T leaves are not nominal names in that module:
astCalleeParamTypes installs the call's inferred $T -> concrete
bindings (the one binding builder) before resolving, or the pin turns
the unbound leaf into "unknown type 'T'" (regressed examples/0129
through math/scalar.sx's clamp).

Regression: examples/0840 (namespaced fn with a module-bare param
type; failed "not visible" pre-pin).
2026-06-12 07:41:18 +03:00

14 lines
543 B
Plaintext

// A namespaced import's fn param type (`Failure`) is bare-visible only
// inside its own module. Typing this call's args resolves each param in
// the CALLEE module's context — resolved at the call site, the bare leaf
// is namespaced-only and the call diagnoses "type 'Failure' is not
// visible" even though the caller never names it bare.
#import "modules/std.sx";
m :: #import "0840-modules-imported-fn-param-type-source-pin/m.sx";
main :: () {
f : m.Failure = .{ code = 7, message = "boom" };
print("{}\n", m.describe(f));
}