Skip to content

Tidy MooseX::Types libraries that have a Moose metaclass - #205

Merged
oalders merged 1 commit into
mainfrom
fix-202
Oct 7, 2026
Merged

oalders merged 1 commit into
mainfrom
fix-202

Conversation

@oalders

@oalders oalders commented Oct 7, 2026

Copy link
Copy Markdown
Member

Closes #202

Cause

With MooseX::Types 0.50, MooseX::Types and MooseX::Types::Base load Moose, so type libraries such as MooseX::Types::Moose end up with a Moose metaclass. uses_moose was then true, _build_is_ignored skipped the whole include, and missing type imports (e.g. Str in t/moosex-types-moose.t) were never added. 0.51 dropped the Moose dependency, which is why the test passed there.

Changes

  • Include.pm: do not ignore includes for MooseX::Types type libraries (is_moose_type_class), even if they have a Moose metaclass.
  • ExportInspector.pm: uses_moose now loads the module itself before looking for a metaclass, rather than relying on an earlier check having loaded it.
  • New fixture type library that explicitly initializes a Moose metaclass, plus t/moose-type-library-with-meta.t, so the regression is covered regardless of the installed MooseX::Types version.
  • Changes entry.

Testing

  • Reproduced the failure locally by putting MooseX::Types 0.50 on PERL5LIB.
  • New test fails without the fix and passes with it.
  • Full suite (prove -lr t, 99 files / 337 tests) passes against both MooseX::Types 0.50 and 0.51.

🤖 Generated with Claude Code · Opus 5.5

@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.73%. Comparing base (db0baf4) to head (aa2bf85).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #205      +/-   ##
==========================================
+ Coverage   88.71%   88.73%   +0.01%     
==========================================
  Files          10       10              
  Lines        1134     1136       +2     
  Branches      271      272       +1     
==========================================
+ Hits         1006     1008       +2     
  Misses         73       73              
  Partials       55       55              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

With MooseX::Types 0.50, type libraries such as MooseX::Types::Moose have
a Moose metaclass. The uses_moose check then caused the whole include to
be ignored, so missing type imports were never added. Don't ignore
includes for MooseX::Types type libraries.

Also make uses_moose load the module itself before looking for a
metaclass, rather than relying on an earlier check having loaded it.

Add a fixture type library which explicitly initializes a metaclass so
that the behaviour is tested regardless of the installed MooseX::Types
version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oalders
oalders marked this pull request as ready for review October 7, 2026 18:35
@oalders
oalders merged commit 48b3e10 into main Oct 7, 2026
1 check passed
@oalders
oalders deleted the fix-202 branch October 7, 2026 18:35
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.

Test t/moosex-types-moose.t fails with MooseX::Types 0.50

1 participant