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).
This commit is contained in:
13
examples/0840-modules-imported-fn-param-type-source-pin.sx
Normal file
13
examples/0840-modules-imported-fn-param-type-source-pin.sx
Normal file
@@ -0,0 +1,13 @@
|
||||
// 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));
|
||||
}
|
||||
10
examples/0840-modules-imported-fn-param-type-source-pin/m.sx
Normal file
10
examples/0840-modules-imported-fn-param-type-source-pin/m.sx
Normal file
@@ -0,0 +1,10 @@
|
||||
#import "modules/std.sx";
|
||||
|
||||
Failure :: struct {
|
||||
code: s64 = 0;
|
||||
message: string = "";
|
||||
}
|
||||
|
||||
describe :: (f: Failure) -> s64 {
|
||||
return f.code;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
7
|
||||
Reference in New Issue
Block a user