Fix Moo support: stash keys, &{} overload, and local @_ in eval#321
Merged
Conversation
Two fixes for Moo compatibility:
1. Stash keys for nested packages must include trailing `::`
- `keys %Foo::Bar::` was returning `Baz` instead of `Baz::`
- This broke Role::Tiny::_load_module which checks for `/::\z/` suffix
- Fix: HashSpecialVariable.java - include `::` in entryKey
2. \&{$blessed_obj} must throw "Not a subroutine reference"
- For objects without &{} overload, was creating symbolic reference
- Perl throws "Not a subroutine reference" in this case
- Fix: RuntimeCode.java - check blessId and throw if no &{} overload
Moo test results: 61/71 programs passing (86%), 765/829 subtests (92%)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <noreply@cognition.ai>
When compiling local @_ = (...) in string eval, the compiler was localizing @main::_ (global array) instead of register 1 which holds the actual @_ for the subroutine. In PerlOnJava, @_ in a subroutine (register 1) and @main::_ are different arrays. This caused Sub::Quote local @_ = ($value) inlinification pattern to fail silently. Fix: For reserved variables like @_, use PUSH_LOCAL_VARIABLE on the register directly instead of loading and localizing the global array. Moo test results: 62/71 programs (87%), 768/829 subtests (93%) - method-generate-accessor.t: 49/49 (was 46/49) Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
When *a = *b is followed by *a = \@x, both aliased globs should be updated because they share the same glob slots. Previously, only the directly assigned glob was updated, breaking ISA resolution. Added glob alias tracking: - GlobalVariable.globAliases map tracks which globs share slots - getGlobAliasGroup() returns all globs aliased to the same target - When assigning array/hash refs to a glob, all aliased globs are updated This fixes the regression where mro/isa_aliases.t dropped from 11/13 to 10/13 passing tests. Now all 13 tests pass. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <noreply@cognition.ai>
Owner
Author
Additional Fix: Glob Aliasing RegressionAdded a fix for the mro/isa_aliases.t regression (11/13 → 13/13 now passing). Root Cause: When Solution: Added glob alias tracking:
This also fixes previously failing tests 10 and 12 in mro/isa_aliases.t (going from 11/13 to 13/13). |
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 issues discovered while improving Moo CPAN module support:
Phase 22: Stash Keys and Overload Handling
Phase 23: Local @_ in String Eval
Files Changed
Test Results
Test plan
Generated with Devin