You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fn test_* with an inferred return: check says ok, codegen fails with 'wrong argument type' (D43 entry-point tail rule) #1862
fn test_* with an inferred return: with check says ok, codegen fails (or MIR is invalid)
Found while fixing #1855 (a runner helper named test_line_at returned str by inference).
Repro
fn test_label(k: i32): "a"
fn main:
print("x " ++ test_label(0))
with check r.w → ok, exit 0
with run r.w →
error: wrong argument type actual=i32 expected=ptr fn=main
error: wrong argument type actual=str expected=ptr fn=main
error: code generation failed
Inside src/main.w, the same shape made with check src/main.w report invalid MIR before codegen: call argument 0 is Unit but the callee parameter is not.
(v0.15.3.0-g355c20b16, darwin arm64.) Renaming the function to label compiles and prints x a.
Where
SemaCheck.fn_decl_is_entry_point (src/SemaCheck.w, D43): every function whose name starts with test_ has its tail in statement position, so test_label is inferred -> Unit (with analyze r.w 'select:stage=sema,kind=signature,name~test_label' shows the Unit return id). Sema then accepts the Unit result as an operand of ++ and as a call argument; codegen or the MIR validator is the first to notice.
Expected
Post-Sema invalid MIR is a compiler bug (D65). Either the use of the Unit result is a Sema type error with a diagnostic that names the D43 test_* rule, or the rule does not apply to a function that takes parameters (the runner cannot call it as a test: discover_test_functions in src/main.w lists any test_* function, parameters or not). Which of the two is the maintainer's call; with check saying ok is not.
Fixed on main by 792351b (stack #2007, battery green on 0f13a62). A Unit operand of ++ or arithmetic is a Sema error naming the D43 test_* rule; trait contract returns are published before default bodies are checked.
Activity
A Unit operand of `++` or arithmetic is a Sema error naming the D43 t…
Sema/MIR: CK_FN loud on a missing fn (#1859); atomics default SeqCst (#…
ehartford commentedon Oct 3, 2026
Fixed on main by 792351b (stack #2007, battery green on 0f13a62). A Unit operand of ++ or arithmetic is a Sema error naming the D43 test_* rule; trait contract returns are published before default bodies are checked.