Fix bytecode my-extraction, stat on filehandles, and signatures.t regression#246
Merged
Fix bytecode my-extraction, stat on filehandles, and signatures.t regression#246
Conversation
stat _ and lstat _ now use the cached stat buffer instead of re-statting the last filename. Returns EBADF when no prior stat succeeded, matching Perl behavior. Added STAT_LASTHANDLE/LSTAT_LASTHANDLE bytecode opcodes so the bytecode compiler correctly handles stat _ (previously compiled _ as a bareword string, causing stat on filename "_"). Both JVM and bytecode paths now pass calling context to statLastHandle/lstatLastHandle so scalar context correctly returns empty string on failure. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Two fixes: 1. Move package inheritance from BytecodeCompiler.compile() to EmitterMethodCreator.compileToInterpreter(). The compile() method is called by all paths including eval STRING (RuntimeCode and EvalStringHandler), which already set the package correctly via setCompilePackage(). The unconditional override in compile() clobbered the correct package with the post-parse symbolTable package, breaking 155 signature tests that use eval(). 2. Fix signature error messages: use "expected N" instead of "expected at most/least N" when min == max parameters. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mydeclarations before conditional jumps in&&/||///so variables are always initialized to undef even when the branch is short-circuited (e.g.,my $x = expr if COND)AUTOLOADdispatch when a forward-declared stub exists — useInheritanceResolverto find the realAUTOLOADin the inheritance chainfilePathinRuntimeIOatopen()time sostat($fh)and-f $fhwork correctly instead of returning EBADFstat _parsing: Move the special_handler before the ALLCAPS bareword check inOperatorParser.parseStat()sostat _uses the last-stat bufferstat _/lstat _cached buffer: Use cached stat attributes instead of re-statting; return EBADF when no prior stat succeededBytecodeCompiler.compile()toEmitterMethodCreator.compileToInterpreter()— the genericcompile()path was clobbering the correct eval STRING package set bysetCompilePackage(), breaking 155 signature testsTest plan
./gradlew testpassest/op/signatures.t: 307 failures (down from 462 regression, matching baseline)t/op/stat_errors.t: 0 failuresGenerated with Devin