Fix Specio test failures: Unicode properties, B::perlstring, openhandle, eval @_ capture#375
Merged
Conversation
Two bugs were causing Specio test failures:
1. \P{IsPrint} matching all characters (76 test failures)
- ICU4J doesn't recognize Is-prefixed property names like IsPrint
- Fixed by stripping 'Is' prefix (e.g., IsPrint -> Print) before ICU lookup
- The 'Is' prefix is a Perl/Java convention, not an official Unicode property
2. B::perlstring not escaping $ and \@ (caused Sub::Quote failures)
- quote_sub() generates code like: my $_UNQUOTED = ${...->{"\"}}
- Without escaped $, the hash key was interpolated as variable
- This caused deferred subs to return undef instead of executing
Test results improved from 76/311 failed to 6/311 failed.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Previously openhandle was a placeholder always returning false. Now it properly checks if the argument is a GLOB/GLOBREFERENCE with an open IO handle (not ClosedIOHandle) and returns the filehandle itself if open, undef otherwise. This fixes FileHandle type detection in Specio. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
When code was compiled via eval, the args stack (used by List::Util::any, all, etc. to pass the outer @_ to code blocks) was not being maintained correctly. The issue was that InterpretedCode.apply() overrode RuntimeCode.apply() but bypassed the pushArgs/popArgs calls that maintain the args stack. Similarly, BytecodeInterpreter fast path for calling InterpretedCode also bypassed these calls. Fixed by: 1. Making RuntimeCode.pushArgs/popArgs public 2. Adding pushArgs/popArgs to InterpretedCode.apply() 3. Adding pushArgs/popArgs to BytecodeInterpreter direct-call fast path This fixes Specio t/dict.t test which uses slurpy Dict types that rely on List::Util::all accessing $_[0] from the enclosing scope. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
Fixes four issues discovered while running
./jcpan -t Specio:1. Unicode Is-prefix properties not recognized (UnicodeResolver.java)
\P{IsPrint}was matching ALL characters instead of only non-printable onesIsprefix before ICU lookup (e.g., IsPrint -> Print)2. B::perlstring not escaping $ and @ (B.pm)
Sub::Quote::quote_sub()generates code with hash keys like\$_UNQUOTED$, the hash key was interpolated as empty stringundefinstead of executing3. Scalar::Util::openhandle was a placeholder (ScalarUtil.java)
false4. @_ not captured in nested blocks for eval-compiled code (InterpretedCode.java, BytecodeInterpreter.java)
Test Results
Remaining 3 failures are pre-existing edge cases:
t/parameterized.t(2 tests) - line number tracking differencest/t-clean.t(1 test) - namespace::autoclean can't detect imported vs local subsGenerated with Devin