Skip to content

fix: make Date::Calc test suite fully pass#510

Merged
fglock merged 2 commits intomasterfrom
fix/date-calc-tests
Apr 20, 2026
Merged

fix: make Date::Calc test suite fully pass#510
fglock merged 2 commits intomasterfrom
fix/date-calc-tests

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 20, 2026

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 the F:: stash. getGlobalHash normalizes stash keys by stripping a redundant leading main::.

  • Overload autogeneration order (OverloadContext.java, CompareOperators.java) — For lt/gt/le/ge/eq/ne (and numeric </>/<=/>=/==/!=), we now try direct operator → autogenerate from cmp/<=>nomethod, matching Perl's documented order. Previously nomethod was invoked before autogeneration, so classes that define cmp together with a dying nomethod (e.g. Date::Calc) could not auto-generate lt/gt. New helpers tryTwoArgumentOverloadDirect and tryTwoArgumentNomethod.

  • x / x= operator overloading (Operator.java, OpcodeHandlerExtended.java) — Wire up (x and (x= overload dispatch for Operator.repeat and REPEAT_ASSIGN.

  • Anonymous sub caller name (EmitSubroutine.java) — caller() inside an anon sub defined within Foo::import now reports Foo::__ANON__, not Foo::import. Root cause: the emitter copied the parent sub's name into the anon sub's compile-time context.

  • @DB::args outside debug mode (RuntimeCode.java) — caller() in package DB now populates @DB::args from a new pristine-args stack that snapshots @_ at sub entry, so Carp's stack traces include argument lists — and remain pristine even if the sub later shifts from @_.

Test plan

  • make — all unit tests pass
  • ./jcpan -t Date::Calc — Files=51, Tests=3005, Result: PASS
  • Minimal reproducers for each fix confirmed against system perl

Generated with Devin

fglock and others added 2 commits April 20, 2026 14:34
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>
@fglock fglock force-pushed the fix/date-calc-tests branch from d256c8e to 9f38ef5 Compare April 20, 2026 12:35
@fglock fglock merged commit 7c17eb9 into master Apr 20, 2026
2 checks passed
@fglock fglock deleted the fix/date-calc-tests branch April 20, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant