From: Hans Dieter Pearcey Date: Fri, 4 Sep 2009 01:04:43 +0000 (-0400) Subject: bug where sub-subtypes can be incorrectly parameterized X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3486f137761c3f34b6c6e832c0bb9b388a1f1cb5;p=gitmo%2FMoose.git bug where sub-subtypes can be incorrectly parameterized --- diff --git a/t/040_type_constraints/011_container_type_constraint.t b/t/040_type_constraints/011_container_type_constraint.t index c27d4b8..d1f4802 100644 --- a/t/040_type_constraints/011_container_type_constraint.t +++ b/t/040_type_constraints/011_container_type_constraint.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 24; +use Test::More tests => 25; use Test::Exception; BEGIN { @@ -71,3 +71,20 @@ ok(!$array_of_array_of_ints->check( my $param_type = $anon_type->type_parameter; isa_ok( $param_type, 'Moose::Meta::TypeConstraint::Class' ); } + +# Parameterizing subtypes + +{ + use Moose::Util::TypeConstraints; + subtype 'MyArray', + as 'ArrayRef[Int]'; + + subtype 'MySubArray', + as 'MyArray'; + + throws_ok { + subtype 'MySubSubArray', + as 'MySubArray[Str]'; + } qr/Str is not a subtype of Int/; +} +