Inlining parameterized type seems to work, but needs more explicit tests
Dave Rolsky [Sun, 10 Apr 2011 16:40:18 +0000 (11:40 -0500)]
lib/Moose/Meta/TypeConstraint/Parameterizable.pm
lib/Moose/Meta/TypeConstraint/Parameterized.pm

index 1e050f3..6f82a34 100644 (file)
@@ -43,6 +43,14 @@ sub _can_coerce_constraint_from {
     };
 }
 
+sub generate_inline_for {
+    my ($self, $type, $val) = @_;
+
+    return unless $self->has_inline_generator;
+
+    return $self->inline_generator->( $type, $val );
+}
+
 sub _parse_type_parameter {
     my ($self, $type_parameter) = @_;
     return Moose::Util::TypeConstraints::find_or_create_isa_type_constraint($type_parameter);
index 70f0828..369599d 100644 (file)
@@ -66,18 +66,19 @@ sub compile_type_constraint {
 sub has_inlined_type_constraint {
     my $self = shift;
 
-    return $self->has_parameterized_from
-        && $self->has_parameterized_from->has_inline_generator;
+    return
+           $self->has_parameterized_from
+        && $self->parameterized_from->has_inline_generator
+        && $self->type_parameter->has_inlined_type_constraint;
+
 }
 
 sub _inline_check {
     my $self = shift;
 
-    return
-        unless $self->has_parameterized_from
-            && $self->has_parameterized_from->has_inline_generator;
+    return unless $self->has_inlined_type_constraint;
 
-    return $self->parameterized_from->generate_inline_for( $self->type, @_ );
+    return $self->parameterized_from->generate_inline_for( $self->type_parameter, @_ );
 }
 
 sub create_child_type {