fix(0127): namespaced generic calls type their result from the call's bindings

The plan producer's namespace-fn arms returned the declared return type
without checking type_params, so a qualified generic call's result
carried the unbound T stub: print boxed it as 'T{}', and a non-s64
binding failed LLVM verification (pack monomorphized for the stub,
call returning double). Both fn_ast_map-backed arms now classify
generic callees as generic_fn and infer the return through
inferGenericReturnType, mirroring the bare-identifier path.
This commit is contained in:
agra
2026-06-12 08:53:25 +03:00
parent 70363dda56
commit 515ecebea7
7 changed files with 62 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
// A NAMESPACED call to a generic free function types its result from the
// call's inferred bindings — not the unbound `T` stub (issue 0127:
// `m.pick(3, 9)` boxed as `T{}` while the flat spelling printed `9`).
#import "modules/std.sx";
m :: #import "0213-generics-namespaced-call-result/m.sx";
main :: () {
print("{}\n", m.pick(3, 9)); // s64 binding
print("{}\n", m.pick(1.5, 0.25)); // f64 binding
v := m.double(21);
w : s64 = v + 0; // the concrete type flows onward
print("{}\n", w);
}

View File

@@ -0,0 +1,9 @@
#import "modules/std.sx";
pick :: (a: $T, b: T) -> T {
if a > b then a else b
}
double :: (x: $T) -> T {
x + x
}

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,3 @@
9
1.500000
42