Fix use statement list context and sort method call parsing#358
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>
When a decimal version like '1.0' was passed to version->new(), PerlOnJava was incorrectly setting qv=true and storing 'v1.0' as the original string. This caused CPAN::Meta::Requirements to format versions as '<= v1.0.0' instead of '<= 1.0', breaking CPAN::Meta::Check tests. The fix: - Track the original version string before prepending 'v' for internal use - Set qv=true only if the ORIGINAL input started with 'v' - Store the original input string for stringify(), not the modified one Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1. Version.java: Strip trailing zeros from double versions
- version->new(1.0203) now stringifies to '1.0203' not '1.020300'
- version->new(1.23) now stringifies to '1.23' not '1.230000'
2. version.pm: Add overload operators that throw errors for math ops
- +, -, *, /, abs, +=, -=, *=, /= now die with
'operation not supported with version object'
Version tests: 93.7% -> 99.5% pass rate (220/221 passing)
Remaining failures are infrastructure issues:
- 02derived.t: File::Temp directory behavior differs
- 07locale.t: POSIX::locale_h not implemented
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Support TEMPLATE => 'nameXXXXXX' as hash option for tempfile/tempdir - Support PERMS => 0400 for custom file permissions - Return open filehandle from _mkstemp_perl to avoid re-open issues - Apply chmod after filehandle is obtained (avoids permission denied) File::Temp tests improved: - tempfile.t: 22/30 pass (cleanup issues due to chdir) - posix.t: 7/7 pass - cmp.t: 18/19 pass - object.t: 28/35 pass Remaining failures are mostly cleanup-related when test uses chdir into temp directory (can't delete directory while in it). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Convert paths to absolute when registering for cleanup - Handle cleanup when current directory is the temp dir to be deleted (chdir out before rmtree, like system Perl) - Add _wrap_file_spec_tmpdir() for compatibility - Load Cwd early to avoid CORE::GLOBAL::stat conflicts All 30 tempfile.t tests now pass, including cleanup after chdir. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Anonymous globs created by 'open(my $fh, ...)' have a null globName and cannot use GlobalVariable to store their SCALAR, ARRAY, and HASH slots. This commit adds local slot storage for anonymous globs. Changes: - Add scalarSlot, arraySlot, hashSlot private fields to RuntimeGlob - Add getGlobHash() and getGlobArray() methods to RuntimeGlob - Update getGlobSlot() to handle null globName with local slots - Fix scalarDeref(), scalarDerefNonStrict() to use glob.hashDerefGet() - Fix hashDeref(), hashDerefNonStrict() to use glob.getGlobHash() - Fix arrayDeref(), arrayDerefNonStrict() to use glob.getGlobArray() This enables File::Temp OO interface which stores metadata in glob slots. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Changes: - CustomFileChannel.fileno(): Return synthetic fd instead of undef This allows code checking defined fileno to work correctly - FileTemp.java: Fix argument parsing for _mkstemp/_mkstemps/_mkdtemp Methods now support both function calls and method calls - FileTemp.java: Fix path handling when template prefix ends with / Properly handle templates like /tmp/XXXXXX where the prefix is a directory path with trailing separator - File/Temp.pm: Fix _replace_XX to only replace trailing Xs Previously replaced all Xs in template, now matches Perl 5 behavior - File/Temp.pm: Add autoflush() method for OO interface Uses select/$| to set autoflush on the underlying filehandle - file_temp.t: Fix test for template with only Xs Check basename instead of full path for pattern matching Tests 9 and 12 (Cleanup/destructor) remain failing due to known limitation: PerlOnJava does not call DESTROY when objects go out of scope (Java GC does not support deterministic destruction). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The synthetic fd approach caused regressions in: - io/perlio_leaks.t (12/12 -> 0/12) - io/dup.t (25/29 -> 17/29) - op/require_37033.t (7/10 -> 6/10) These tests rely on fileno returning undef for handles without real fds, since is(undef, undef) passes in comparisons. Updated file_temp.t to check handle validity using ref() instead of fileno() since Java cannot expose real OS file descriptors. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…gories - CompareOperators.java: Add checkSpaceshipResult() to emit "uninitialized value" warning when overloaded <=> returns undef in derived comparison ops - CompareOperators.java: Improve callerWhere() to skip internal Test::* frames for correct warning location reporting - warnings/register.pm: Implement proper warnings::register with import() - WarningFlags.java: Add registerCategory() for runtime custom warning category registration, globalWarningsEnabled flag for runtime scope checks - Warnings.java: Add register_categories(), fix warnif() to use WarnDie.warn() - ScopedSymbolTable.java: Add registerCustomWarningCategory() for bit allocation Fixes t/29overload.t completely. Improves t/46warnings.t (3/6 tests pass). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Parser changes:
- Fix parsing of "bareword { block } args" when bareword is undefined
- Correctly parse as indirect object syntax: (block_result)->bareword(args)
- This matches Perl behavior for try/catch style constructs without imports
Note: t/48rt-115983.t still fails because namespace::autoclean is a stub.
The test expects DateTime to clean imported try/catch from its namespace,
but implementing autoclean properly causes regressions in other tests.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Remove runtime suppression stack that was breaking local $SIG{__WARN__}
- Handle no warnings; (without arguments) to disable all warnings
- warnings::warnif now properly goes through $SIG{__WARN__} handler
- Test::Warnings::warnings { } now captures warnif warnings correctly
Note: Lexical warning suppression (no warnings category) works at
compile time but does not propagate through module calls at runtime.
This is a known limitation requiring future work to pass warning bits
through the call stack.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Phase 1 of lexical warning scope propagation: - Add scope ID tracking to WarningFlags.java - registerScopeWarnings() assigns unique scope IDs - isWarningDisabledInScope() checks if category is suppressed - Design doc in dev/design/warnings-scope.md This enables "no warnings 'DateTime'" to propagate to warnif() calls in DateTime.pm via the local $^WARNING_SCOPE mechanism. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This allows "no warnings 'Category'" in user code to suppress
warnings::warnif('Category', $msg) calls in library code (e.g., DateTime.pm).
Implementation:
- Add ${^WARNING_SCOPE} global variable to track runtime warning scope
- noWarnings() registers disabled categories with unique scope IDs
- CompilerFlagNode carries scope ID, emits local ${^WARNING_SCOPE} = id
- warnIf() checks ${^WARNING_SCOPE} to see if category is suppressed
- FindDeclarationVisitor detects scope nodes for proper cleanup
Files changed:
- WarningFlags.java: Scope ID tracking infrastructure
- Warnings.java: Register scopes, check in warnIf()
- GlobalContext.java: Initialize ${^WARNING_SCOPE}
- CompilerFlagNode.java: Add warningScopeId field
- StatementParser.java: Pass scope ID to CompilerFlagNode
- EmitCompilerFlag.java: Emit local assignment bytecode
- FindDeclarationVisitor.java: Detect scope nodes for cleanup
Test: DateTime t/46warnings.t now passes 6/6 (was 3/6)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Add isWarningSuppressedAtRuntime() helper to WarningFlags and use it in RuntimeIO to check both compile-time and runtime warning suppression for syscalls warnings (e.g., nul character in pathname). This fixes io/open.t test 192 which tests "no warnings 'syscalls'". Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- dev/architecture/README.md: Overview of PerlOnJava architecture
- dev/architecture/dynamic-scope.md: local mechanism and DynamicVariableManager
- dev/architecture/lexical-pragmas.md: Warnings, strict, and ${^WARNING_SCOPE}
These documents explain:
- How local saves/restores variable state on scope exit
- How the same mechanism is used for defer, regex state, warning scope
- How lexical pragmas work at compile-time vs runtime
- The ${^WARNING_SCOPE} mechanism for warnif() propagation
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The stringConcatWarnUninitialized method was calling getDefinedBoolean() to check for undef values before calling toString(). Both methods trigger FETCH on tied scalars, causing extra FETCH calls. Fix: resolve tied scalars once upfront, then use the resolved value for both the definedness check and the string conversion. This fixes the op/gmagic.t regression (31 tests pass vs 29 before). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Add setVoid() method for operations that don't need the assignment result (like chop/chomp) to avoid unnecessary FETCH-after-STORE - For TIED_SCALAR wrapper in RuntimeScalar.set(), delegate to the tied object's set() method instead of doing FETCH-after-STORE directly - Override set() in TieScalar to do FETCH-after-STORE for actual tied scalars (needed for chained assignments like $s = $tied = value) - TiedVariableBase.set() (used by hash/array proxy entries) just does STORE without extra FETCH, which is correct for those cases This fixes the op/gmagic.t concat-assignment tests (37 passing, up from 31) and the tie_hash.t FETCH count test. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
In Perl, the /i flag makes matching case-insensitive for literals,
but does NOT affect Unicode property matching (\p{...}).
Changes:
- RegexPreprocessorHelper: Wrap \p{...} translations in (?-i:...) to
disable case-insensitive matching for property references
- RegexPreprocessor: Skip over \p{...}, \P{...}, \N{...}, \x{...},
\o{...} constructs during case-fold expansion to prevent mangling
property names (e.g., 'k' in 'Blk' was being expanded)
- ExtendedCharClass: Wrap output in (?-i:...) since Perl's (?[...])
applies /i only to literals, not Unicode properties
This fixes re/regex_sets.t tests 26-27 and enables many more tests
to pass (79/88 up from 25/88).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The previous commits introduced regressions in multiple test suites:
- op/eval.t: -49 tests (FETCH called when method does not exist)
- re/regex_sets_compat.t: -16 tests ((?-i:...) wrapper broke /i flag)
- op/bop.t: -9 tests (extra FETCH calls for tied vec operations)
- re/subst.t: -7 tests (extra FETCH calls)
Reverted changes:
- TieScalar: Remove set() override that did STORE+FETCH
- RuntimeScalar: Revert FETCH-after-STORE changes for tied scalars
- StringOperators: Revert tied scalar concat handling changes
- ExtendedCharClass: Remove (?-i:...) wrapper
- RegexPreprocessorHelper: Remove (?-i:...) wrapper around \p{...}
Test results after fix match or exceed baselines.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The previous revert accidentally removed the fix that prevents double FETCH on tied scalars during string concatenation with warning checks. This restores the fix from commit 38832fe which resolves tied variables once upfront, then uses the resolved values for both definedness check and string conversion. Test results: - op/gmagic.t: 31/42 (was 29/42 after revert) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…sses
- /i flag no longer incorrectly affects \p{} property matching
- Extended char classes now properly expand literals for case-insensitive matching
- Interpolated extended char classes retain their original /i flag setting
- /i on outer extended char class does not leak to interpolated inner patterns
Fixes:
- re/regex_sets.t tests 26, 47-50 now pass (76->81 passing)
- Unicode property \p{Blk=ASCII} no longer matches case-folded chars under /i
- KELVIN SIGN with /i correctly matches K and k in extended char classes
Implementation:
- Wrap Unicode property translations in (?-i:...) to protect from /i
- Expand all literals (not just special folds) in extended char classes
- Track /i flag through nested extended char class processing
- Skip extended char classes in expandMultiCharFolds() preprocessing
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Handle ^ at the start of a character class as the negation metacharacter, not as the start of a range. This fixes [^-b] which should mean "not hyphen or b", not "range from ^ to b". Also track atStart flag to properly handle - as a literal when it appears immediately after ^ or at the very start. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Add LONG S (U+017F) to special case fold mappings
- Handle \x{...} escape sequences with case expansion
- Handle \N{...} named characters with case expansion for non-special folds
- Add special Unicode case folds (KELVIN, LONG S) for ranges like [a-z]
This fixes regressions where:
- /[a-z]/i did not match KELVIN SIGN in extended char class
- /[A-Z]/i did not match LATIN SMALL LETTER LONG S
- /[\x{c1}]/i did not match lowercase a-acute
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The test target was missing blib/lib in @inc, causing all module tests to fail with Can't locate Module/X.pm errors. Test::Harness runs each test file as a subprocess, so -I flags on the parent process do not propagate. The fix sets PERL5LIB to include $(INST_LIB) and $(INST_ARCHLIB), making the built module available to test subprocesses. This enables jcpan to properly run module tests during installation. Module::Runtime tests now pass 352/360 (previously 0/360). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Add blib.pm (core module for module development/testing) - Set NO_PERLLOCAL and NO_PACKLIST in MM_PerlOnJava to avoid errors when Makefile tries to write to jar:PERL5LIB (not a real path) This fixes the perllocal.pod error during module installation and enables tests that use 'use blib' to find modules in blib/lib. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Two fixes for jcpan module testing: 1. ArgumentParser.java: When -M modules are specified without -e and stdin is interactive, run modules directly instead of waiting for stdin input. This matches Perl behavior where 'perl -MModule=args' runs the module import and exits. 2. MakeMaker.pm: Add PERL5LIB to stub Makefile test target so test subprocesses can find modules in blib/lib. These fixes resolve the hang during Test::Needs installation where IPC::Open3 subprocess tests would block waiting for input. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Required by Devel::InnerPackage which is used by Module::Pluggable. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Bump version numbers to 7.78 to match CPAN version and prevent CPAN from trying to upgrade the bundled ExtUtils::MakeMaker. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
In non-threaded Perl (and PerlOnJava), lock() is a no-op that simply returns its argument. For scalar variables, it returns the dereferenced value; for arrays and hashes, it returns the reference itself. This matches Perl behavior where lock() is available but effectively a no-op without threading support. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit addresses two related issues that were causing Module::Pluggable
tests to fail:
1. **use statement arguments evaluated in wrong context**
The expression passed to `use lib EXPR` was being evaluated in VOID context
instead of LIST context. This caused expressions like:
use lib (($path) =~ /^(.*)$/);
to fail because the regex match was returning 1 (scalar success) instead of
the captured path. Fixed by:
- Adding an optional context parameter to `executePerlAST()` in
PerlLanguageProvider.java
- Adding an optional context parameter to `runSpecialBlock()` in
SpecialBlockParser.java
- Passing LIST context when executing `use` statement argument lists in
StatementParser.java
2. **sort misparses method calls on bareword class names**
`sort MyClass->method` was incorrectly parsed as `sort MyClass (->method)`
where `MyClass` was treated as a comparison subroutine name. Fixed by
checking if the identifier is followed by `->` after parsing it, and if so,
backtracking to parse it as a method call expression instead.
These fixes reduce Module::Pluggable test failures from 33/45 to 1/45.
Generated with [Devin](https://cli.devin.ai/docs)
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Owner
Author
|
Closing - all changes already merged to master via PR #356 (squash merge) |
When evaluating \&{*glob}, the glob was being stringified to *main::name
which caused normalizeVariableName to look up the wrong subroutine name.
Now createCodeReference handles GLOB types specially by extracting the
glob name and directly looking up the CODE slot from GlobalVariable.
This fixes overload::Method() which uses this pattern, and enables
Path::Tiny and Test::Deep to load and work correctly.
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
This PR fixes several parsing/execution issues that were causing CPAN module tests to fail:
1. use statement arguments evaluated in wrong context
The expression passed to
use lib EXPRwas being evaluated in VOID context instead of LIST context. This caused expressions like:to fail because the regex match was returning 1 (scalar success) instead of the captured path.
Changes:
executePerlAST()in PerlLanguageProvider.javarunSpecialBlock()in SpecialBlockParser.javausestatement argument lists in StatementParser.java2. sort misparses method calls on bareword class names
Was incorrectly parsed as
sort MyClass (->method)whereMyClasswas treated as a comparison subroutine name.Fix: Check if the identifier is followed by
->after parsing it, and if so, backtrack to parse it as a method call expression instead.3. Fix glob-to-code dereference (&{*glob})
When evaluating
\&{*glob}, the glob was being stringified to*main::name(with asterisk prefix), causing the wrong subroutine lookup.Fix: Added special GLOB type handling in
createCodeReferenceto extract the glob name directly and look up the CODE slot properly.This fixes
overload::Method()which uses the\&{*$globref}pattern, and enables Path::Tiny and Test::Deep to load and work correctly.Test Results
Test plan
makepassesuse libwith regex capture expression works correctlysort Class->methodparses correctly\&{*glob}returns correct CODE referenceGenerated with Devin