Merged
Conversation
…d message
Three fixes that reduce Module::Runtime test failures from 23 to 8:
1. Honor #line directive in use statement caller info
- parseUseDeclaration now uses getSourceLocationAccurate() to get the
#line-adjusted filename and line number for CallerStack.push()
- Fixes t/import_error.t tests where eval'd use statements with #line
directives were reporting wrong locations
2. Prevent %^H hints hash from leaking into require'd modules
- doFile() now saves, clears, and restores %^H around PerlLanguageProvider.executePerlCode()
- In Perl >= 5.11 (which we emulate), hints don't leak into required files
- Fixes tests that check $^H{...} is undef in BEGIN blocks of required modules
3. Fix cached require failure error message
- Changed 'Compilation failed in require at <file>' to 'Attempt to reload <file> aborted.'
- Matches Perl's actual error message for cached compilation failures
- Fixes the 'broken module is visibly broken when re-required' tests
Remaining 8 failures are due to caller()[10] (hints hash per stack frame)
returning undef - this is a known limitation requiring more complex tracking.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Base.java: Add isa check before adding to @isa, matching Perl base.pm behavior (skip redundant base classes when Middle->isa(Parent)) - PerlCompilerException.java, FileTestOperator.java: Add missing period before " at file line N" in error messages Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…e error messages - NameNormalizer: Add normalizePackageName() to convert Foo'Bar to Foo::Bar - InheritanceResolver, DFS: Normalize package names when reading @isa - Universal.isa: Normalize argument for consistent comparison - ModuleOperators: Include module name hint and @inc entries in "Can't locate" error message, matching Perl 5.17.5+ behavior All 8 parent.pm tests now pass. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- RegexFlags: Enable UNICODE_CHARACTER_CLASS so \w, \d, \s match Unicode characters by default (matches Perl behavior) - FileSpec.abs2rel: Fix to use user.dir property for relative base paths (Java Path.toAbsolutePath() ignores System.setProperty changes) - FileSpec.rel2abs: Same fix for relative base paths Module::Metadata tests: 137/138 pass (1 taint test expected to fail) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
In Perl, $Foo::x and $main::Foo::x refer to the same variable, but PerlOnJava stores top-level package symbols without the 'main::' prefix. This caused %main:: (the main stash) to not include entries like 'Foo::' for top-level packages. The fix extends HashSpecialVariable.entrySet() to also include keys that start with a top-level package name (e.g., "Foo::test") when enumerating %main::. This allows Class::Inspector::_subnames to correctly find all child packages. Test results: - Class::Inspector: 55/56 tests pass (1 failure is unrelated INC hook issue) - All unit tests pass Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
When substr() is called with a negative offset that goes before the
beginning of the string, Perl's behavior is:
1. If the adjusted length would still be positive, clip offset to 0
and reduce length by the overshoot amount (no warning)
Example: substr("a", -2, 2) returns "a"
2. If the adjusted length would be non-positive, warn and return undef
Example: substr("hello", -10, 1) warns and returns undef
This also fixes the 4-argument substr replacement behavior to correctly
replace only the extracted portion when clipping occurs.
Example: substr("ab", -3, 2, "X") returns "a" and sets str to "Xb"
Test results:
- All unit tests pass
- Class::Inspector tests pass (no more substr outside of string warnings)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Instead of unconditionally enabling UNICODE_CHARACTER_CLASS (which broke 308 tests in re/charset.t), now properly track the /u modifier and only enable Unicode character class matching when /u is specified. This fixes the regressions in: - re/charset.t: 5282/5552 (matches master) - uni/variables.t: 66880/66880 (matches master) - re/regex_sets.t: restored to master level - re/pat.t: restored to master level The /u flag can be used to enable Unicode matching: /\w+/u # matches Unicode word characters Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Perl's error message for a cached compilation failure includes both: - 'Attempt to reload <file> aborted.' - 'Compilation failed in require at <file>' The previous fix only included the first part, which broke comp/require.t test 32. Now includes both parts to match Perl. Fixes: comp/require.t 1743/1747 (matches master) 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
Three fixes that reduce Module::Runtime test failures from 23 to 8 subtests:
1. Honor #line directive in use statement caller info
parseUseDeclarationnow usesgetSourceLocationAccurate()to get the #line-adjusted filename and line number forCallerStack.push()t/import_error.ttests where eval'd use statements with #line directives were reporting wrong locations2. Prevent %^H hints hash from leaking into require'd modules
doFile()now saves, clears, and restores%^HaroundPerlLanguageProvider.executePerlCode()$^H{...}is undef in BEGIN blocks of required modules3. Fix cached require failure error message
Compilation failed in require at <file>toAttempt to reload <file> aborted.Test Results
Before: 23/360 subtests failed (5/11 test files)
After: 8/360 subtests failed (4/11 test files)
The remaining 8 failures are due to
caller()[10](hints hash per stack frame) returning undef - this is a known limitation that would require tracking compile-time hints per stack frame.Test Plan
makepasses (all unit tests)./jcpan -t Module::Runtimeshows improvementGenerated with Devin