bug where sub-subtypes can be incorrectly parameterized abandoned/subtype-of-parameterizable
Hans Dieter Pearcey [Fri, 4 Sep 2009 01:04:43 +0000 (21:04 -0400)]
t/040_type_constraints/011_container_type_constraint.t

index c27d4b8..d1f4802 100644 (file)
@@ -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/;
+}
+