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

@@ -1,4 +1,23 @@
# 0127: namespaced generic call's result mis-types as the unbound `T` stub
# RESOLVED — 0127: namespaced generic call's result mis-types as the unbound `T` stub
> **RESOLVED** (2026-06-12). Root cause: the call-PLAN producer's
> namespace-fn arms (src/ir/calls.zig, the `fn_ast_map`-backed qualified
> and bare-name fallbacks) returned the DECLARED return type — `T`,
> resolving to the unbound stub — without checking `type_params`, while
> the bare-identifier path routes generics through
> `inferGenericReturnType`. Lowering dispatched the right mono (the
> value was correct); only the planned result type was wrong, so
> pack-fn callers (print's Any boxing) mis-tagged it — and a non-s64
> binding (f64) failed LLVM verification outright, the pack being
> monomorphized for the stub while the call returned `double`. Fix:
> both arms now classify a `type_params.len > 0` callee as
> `.generic_fn` and infer the return type through the call's bindings,
> mirroring the flat path. Regression test:
> `examples/0213-generics-namespaced-call-result.sx` (s64 + f64
> bindings via print, concrete type flowing into arithmetic; pre-fix:
> `T{}` boxing / LLVM verification failure — both demonstrated).
> Gates: zig build test 426/426, suite 595/595, distribution repo
> 14/14.
## Symptom