# and 'hand_optimized_type_constraint' from the parent
delete $args{compiled_type_constraint};
delete $args{hand_optimized_type_constraint};
+ if(defined(my $parent_tp = $args{parent}{type_parameter})) {
+ delete $args{type_parameter} if $parent_tp == $args{type_parameter};
+ }
}
my $check;
}
# See also Moose::Meta::TypeConstraint::Parameterizable
-sub parameterize{
+sub parameterize {
my($self, $param, $name) = @_;
if(!ref $param){
--- /dev/null
+#!perl
+# https://rt.cpan.org/Public/Bug/Display.html?id=61852
+use strict;
+use warnings;
+use Test::More;
+{
+ package X;
+ use Mouse;
+ use Mouse::Util::TypeConstraints;
+
+ subtype 'List'
+ => as 'ArrayRef[Any]'
+ => where {
+ foreach my $item(@{$_}) {
+ defined($item) or return 0;
+ }
+ return 1;
+ };
+
+ has 'list' => (
+ is => 'ro',
+ isa => 'List',
+ );
+}
+
+eval { X->new(list => [ 1, 2, 3 ]) };
+is $@, '';
+
+eval { X->new(list => [ 1, undef, 3 ]) };
+like $@, qr/Validation[ ]failed[ ]for[ ]'List'/xms;
+done_testing;