Skip to content

Fix wantarray void context in eval STRING#232

Merged
fglock merged 1 commit into
masterfrom
fix-interpreter-package-blocks
Feb 25, 2026
Merged

Fix wantarray void context in eval STRING#232
fglock merged 1 commit into
masterfrom
fix-interpreter-package-blocks

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Feb 25, 2026

Remove the erroneous VOID-to-SCALAR promotion in BytecodeCompiler.compile(). The JVM compiler (EmitEval.java) passes ctx.contextType unchanged to evalStringWithInterpreter -- the bytecode compiler now does exactly the same. This fixes wantarray() inside eval STRING called in void context returning false (scalar) instead of undef (void). Result: op/eval.t passes 153/153 in both JVM and interpreter modes.

The VOID-to-SCALAR promotion in BytecodeCompiler.compile() was wrong.
It caused wantarray() inside an eval STRING called in void context to
return false (scalar) instead of undef (void).

Fix: remove the promotion entirely, passing the true outer context
unchanged — exactly as the JVM compiler does in EmitEval.java
(emitterVisitor.ctx.contextType passed as-is to evalStringWithInterpreter).

Result: op/eval.t now passes 153/153 in both JVM and interpreter modes.
@fglock fglock merged commit afc689b into master Feb 25, 2026
2 checks passed
@fglock fglock deleted the fix-interpreter-package-blocks branch February 25, 2026 09:49
fglock added a commit that referenced this pull request Mar 3, 2026
Fix wantarray void context in eval STRING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant