Subject: | The order of definitions of type constraints shouldn't matter |
Hi,
The order of definitions of type constraints matters:
#!perl
{
package Foo;
use Moose;
has bar =>
is => 'rw',
isa => 'Positive_Int'
;
}
{
package My::Types;
use Mouse::Util::TypeConstraints;
subtype 'Positive_Int' => (
as 'Int',
where { $_ >= 0 },
);
}
__END__
The first 'Positive_Int' is dealt as a class type, and
the second as a custom subtype, but if the order of definitions is
reversed, both 'Positive_Int' are dealt as the same custom subtype.
This behaviour seems confusing, so I think it should throw the error.
This ticket is based on a bug report to Mouse:
https://rt.cpan.org/Ticket/Display.html?id=61076
Regards,
--
Goro Fuji (gfx) GFUJI at CPAN.org