fix: make Date::Calc test suite fully pass#510
Merged
Conversation
Address several issues surfaced by `jcpan -t Date::Calc`, getting all
3005 subtests across 51 files to pass (previously 38 failures in 3 files).
- Stash hash deref through glob: %{*main::F::} now resolves to the F::
stash (strip redundant leading "main::" in getGlobalHash).
- Overload autogeneration order: for lt/gt/le/ge/eq/ne (and numeric
< > <= >= == !=), try direct operator -> autogenerate from cmp/<=>
-> nomethod, matching Perl's documented order. Previously nomethod
was invoked before autogeneration, so classes that define cmp plus
a dying nomethod (e.g. Date::Calc) could not auto-generate lt/gt.
Added tryTwoArgumentOverloadDirect and tryTwoArgumentNomethod.
- x / x= operator overloading: wire up "(x" and "(x=" overload
dispatch for Operator.repeat and REPEAT_ASSIGN.
- Anonymous sub caller name: caller() inside an anon sub defined
within Foo::import now reports Foo::__ANON__, not Foo::import.
Root cause: EmitSubroutine copied the parent sub's name into the
anon sub's compile-time context.
- @db::args outside debug mode: caller() in package DB now populates
@db::args from a new pristine-args stack snapshotted at sub entry,
so Carp's stack traces include argument lists (and remain pristine
even if the sub later shifts @_).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Fixes a regression in op/attrs.t (test 49, "Bogus CODE attribute shared should fail") caused by the previous @db::args fix. Once @db::args is populated with a CODE ref, Carp calls format_arg -> _maybe_isa. In our bundled Carp, _maybe_isa is installed via _fetch_sub("UNIVERSAL","isa"), which needs *UNIVERSAL::{HASH} to return the UNIVERSAL:: stash. - RuntimeGlob.getGlobSlot("HASH"): for stash globs (globName ends with "::"), always return the package's stash via getGlobalHash, even if nothing has explicitly materialized it yet. Matches Perl 5 where the stash is an intrinsic property of the package. - GlobalVariable.existsGlobalHash: also normalize "main::Pkg::" -> "Pkg::" for stash lookups (mirrors the existing normalization in getGlobalHash). Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
d256c8e to
9f38ef5
Compare
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 several issues surfaced by
jcpan -t Date::Calc. All 3005 subtests across 51 files now pass (previously 38 failures in 3 files:t/f035.t,t/m002.t,t/m006.t).Fixes
Stash hash deref through glob (
GlobalVariable.java) —%{*main::F::}now resolves to theF::stash.getGlobalHashnormalizes stash keys by stripping a redundant leadingmain::.Overload autogeneration order (
OverloadContext.java,CompareOperators.java) — Forlt/gt/le/ge/eq/ne(and numeric</>/<=/>=/==/!=), we now try direct operator → autogenerate fromcmp/<=>→nomethod, matching Perl's documented order. Previouslynomethodwas invoked before autogeneration, so classes that definecmptogether with a dyingnomethod(e.g.Date::Calc) could not auto-generatelt/gt. New helperstryTwoArgumentOverloadDirectandtryTwoArgumentNomethod.x/x=operator overloading (Operator.java,OpcodeHandlerExtended.java) — Wire up(xand(x=overload dispatch forOperator.repeatandREPEAT_ASSIGN.Anonymous sub caller name (
EmitSubroutine.java) —caller()inside an anon sub defined withinFoo::importnow reportsFoo::__ANON__, notFoo::import. Root cause: the emitter copied the parent sub's name into the anon sub's compile-time context.@DB::argsoutside debug mode (RuntimeCode.java) —caller()in packageDBnow populates@DB::argsfrom a new pristine-args stack that snapshots@_at sub entry, soCarp's stack traces include argument lists — and remain pristine even if the sub latershifts from@_.Test plan
make— all unit tests pass./jcpan -t Date::Calc— Files=51, Tests=3005, Result: PASSperlGenerated with Devin