fix(lower): free-fn UFCS auto-address-of + lazy lowering (issue 0063)
A free function called via UFCS (recv.fn(args)) whose first param is *T was passed the receiver by value (LLVM "Call parameter type does not match function signature"), and a function reached only via UFCS was declared but never emitted (undefined symbol at link). The bare-name UFCS fallback now mirrors the qualified-method path: it lazily lowers the target body and calls fixupMethodReceiver + coerceCallArgs, so the value receiver gets the same implicit address-of as a struct-defined method and mutations through *T are visible. Regression: 0039-basic-free-fn-ufcs-pointer-receiver.sx.
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
# 0063 — free-function UFCS with a pointer first-param passes the struct by value
|
||||
|
||||
> **✅ RESOLVED (2026-06-01).** The free-function UFCS fallback in
|
||||
> [src/ir/lower.zig](../src/ir/lower.zig) ("Try to resolve as bare function
|
||||
> name") built `method_args` with the value receiver but never called
|
||||
> `fixupMethodReceiver`, and never lazily lowered the target — so the receiver
|
||||
> was passed by value (LLVM signature mismatch) and a UFCS-only function was
|
||||
> declared but never emitted (link error). Fix: that path now (1) lazily lowers
|
||||
> `fa.field` if it's a known fn not yet lowered, and (2) calls
|
||||
> `fixupMethodReceiver` + `coerceCallArgs` exactly like the qualified-method
|
||||
> path. The explicit `bump(@p)` form was always fine. Regression:
|
||||
> [examples/0039-basic-free-fn-ufcs-pointer-receiver.sx](../examples/0039-basic-free-fn-ufcs-pointer-receiver.sx).
|
||||
|
||||
## Symptom
|
||||
|
||||
Calling a **free** function via UFCS where the function's first parameter is a
|
||||
|
||||
Reference in New Issue
Block a user