Subject: | ArrayRef[Class] broken if Class is not a Mouse class |
The type constraints ArrayRef[ClassName] and HashRef[ClassName] are
broken in master for empty array and hash refs UNLESS the Class in
question is a Mouse class. I noticed this because it breaks Test::Builder2.
Moose 0.92 does not have this bug nor does Mouse 0.35.
Test is attached.
Subject: | foo.t |
#!/usr/bin/perl -w
use Test; # This bug breaks Test::More
plan tests => 4;
{
package Class;
sub new {}
}
{
package MooseClass;
use Moose;
}
{
package MouseClass;
use Mouse;
}
{
package Foo;
use Mouse;
has unknown => (
is => 'rw',
isa => 'HashRef[Unknown]'
);
has class => (
is => 'rw',
isa => 'HashRef[Class]',
);
has moose => (
is => 'rw',
isa => 'HashRef[MooseClass]',
);
has mouse => (
is => 'rw',
isa => 'HashRef[MouseClass]',
);
}
my $obj = Foo->new;
ok eval { $obj->unknown({}); };
ok eval { $obj->class({}); };
ok eval { $obj->moose({}); };
ok eval { $obj->mouse({}); };