Bug
When a procedure is marked inline and takes an Any parameter, calls produce completely wrong output. Without inline, the same procedure works correctly.
Reproduction
// examples/17/17.10_inline.jai
println :: inline (arg: Any) { print("%\n", arg); }
n := 14;
m := 36;
println("Hello, world!"); // should print "Hello, world!"
println(1); // should print "1"
println("% %", n, m); // should print "14 36"
println("The end."); // should print "The end."
Expected: Four lines of output
Actual: Only outputs 1 total
Removing the inline keyword makes all four calls work correctly. This confirms the bug is specifically in the inline + Any parameter interaction.
Root Cause Analysis
The tryInlineProcCall path in bytecode_gen.zig likely doesn't properly handle the Any type boxing that happens when an argument is passed to an Any-typed parameter. The normal call path boxes the argument correctly; the inline expansion skips the boxing or mishandles the type coercion.
Severity
High — inline is a common Jai idiom, and Any parameters are used for variadic printing. This combination completely breaks output.
Files
bootstrap/src/bytecode_gen.zig (tryInlineProcCall, inline parameter handling)
Bug
When a procedure is marked
inlineand takes anAnyparameter, calls produce completely wrong output. Withoutinline, the same procedure works correctly.Reproduction
Expected: Four lines of output
Actual: Only outputs
1totalRemoving the
inlinekeyword makes all four calls work correctly. This confirms the bug is specifically in the inline + Any parameter interaction.Root Cause Analysis
The
tryInlineProcCallpath inbytecode_gen.ziglikely doesn't properly handle theAnytype boxing that happens when an argument is passed to anAny-typed parameter. The normal call path boxes the argument correctly; the inline expansion skips the boxing or mishandles the type coercion.Severity
High —
inlineis a common Jai idiom, andAnyparameters are used for variadic printing. This combination completely breaks output.Files
bootstrap/src/bytecode_gen.zig(tryInlineProcCall, inline parameter handling)