fix(Scalar-List-Utils): bump bundled modules to v1.70; fix pair*, uniq, get-magic#524
Merged
fix(Scalar-List-Utils): bump bundled modules to v1.70; fix pair*, uniq, get-magic#524
Conversation
Running `./jcpan -t Scalar::Util` against the CPAN Scalar-List-Utils-1.70
distribution went from 25/38 test programs failing (209/832 subtests) to
21/38 (163/842 subtests) — a reduction of 46 subtest failures.
Changes:
* Bump bundled List::Util, Scalar::Util, Sub::Util to v1.70
(was pinned at 1.63; caused version-mismatch failures because the
tarball's List/Util/XS.pm reports the distribution version).
* List::Util.pm: add import() that touches caller's $a/$b to silence
the "Name used only once" warning (RT #88848), and define the
List::Util::_Pair class methods (key / value / TO_JSON).
* ListUtil.java:
- Validate code refs for reduce/reductions/first/any/all/none/notall
and pair*: non-CODE args now croak "Not a subroutine reference";
calls into undefined stubs croak "Undefined subroutine in <func>"
(matches XS error messages).
- pairmap / pairgrep / pairfirst now alias $a and $b to the source
list elements (matching XS semantics), so modifications inside the
block are visible to the caller.
- pairgrep / pairmap warn on odd-sized input lists.
- pairs() blesses returned arrayrefs into List::Util::_Pair so ->key,
->value, ->TO_JSON work.
- unpairs() pads short input arrayrefs with undef.
- uniq distinguishes undef from the empty string; uniq/uniqstr/
uniqint/uniqnum warn on undef with "Use of uninitialized value".
- head/tail croak "Not enough arguments for List::Util::head|tail"
when called with no args.
* ScalarUtil.java: blessed / reftype / refaddr now trigger FETCH on
tied scalars exactly once before inspecting the underlying value
(fixes t/getmagic-once.t).
Tests that now pass completely:
t/00version.t, t/getmagic-once.t, t/pair.t, t/undefined-block.t
Remaining failures are mostly in areas requiring deeper work:
- t/exotic_names.t (120 failures): stash names with NUL / control
chars / apostrophes — needs set_subname & caller() stash work.
- t/subname.t (7): related to the above.
- BigInt integration in sum / product / min (3+3+1).
- Misc overload / taint / DESTROY tracking edge cases.
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
Running
./jcpan -t Scalar::Util(which tests the CPANScalar-List-Utils-1.70distribution against the bundled PerlOnJava implementation) went from:to:
−46 subtest failures, 4 whole test programs now pass:
t/00version.t,t/getmagic-once.t,t/pair.t,t/undefined-block.t.What changed
Version sync to 1.70
List::Util,Scalar::Util,Sub::Utilfrom the 1.63 stubs to v1.70 (both the.pmfiles and the$VERSIONstrings exposed by the Java implementations).List::Util.pmnow defines:importthat touches caller's$a/$b(RT #88848, silences spurious "Name used only once" warnings);List::Util::_Pairclass withkey/value/TO_JSONmethods.ListUtil.java
reduce/reductions/first/any/all/none/notalland thepair*family:Not a subroutine reference;Undefined subroutine in <func>.pairmap/pairgrep/pairfirstnow alias$aand$bin the caller's package to the source list elements (matches Perl 5 XS semantics), so modifications inside the block propagate to the caller.pairgrep/pairmapwarn on odd-sized input lists (Odd number of elements in pairmap/pairgrep).pairs()blesses returned arrayrefs intoList::Util::_Pairso->key,->value,->TO_JSONwork.unpairs()pads short input arrayrefs withundef.uniqdistinguishesundeffrom the empty string;uniq/uniqstr/uniqint/uniqnumnow warn onundefwith the proper uninitialized-value warning.head/tailcroakNot enough arguments for List::Util::head|tailon empty argument lists.ScalarUtil.java
blessed/reftype/refaddrnow triggerFETCHon tied scalars exactly once before inspecting the underlying value (fixest/getmagic-once.t).Remaining work (not in this PR)
Most of the remaining 163 subtest failures are concentrated in:
t/exotic_names.t(120 failures): stash / sub names containing NUL, control characters, or apostrophes. Needs deeper work inset_subname+caller()to preserve embedded NULs in package/sub names.t/subname.t(7): related to the above.sum/product/min(3+3+1): large integers drop to floats because the operators usedoublearithmetic.blessed/uniqint/uniqnum, tied filehandle recognition inopenhandle,DESTROYtracking insample/shuffle/uniqstr, taint propagation, weakref edge cases.Test plan
makepasses locally (unit tests all green)../jcpan -t Scalar::Utilnow reports Failed 21/38 test programs. 163/842 subtests failed, down from 25/38 / 209/832.Generated with Devin