created regression test for type constraint change in Moose 1.05
[gitmo/MooseX-Types-Structured.git] / lib / MooseX / Meta / TypeConstraint / Structured.pm
index f199370..a9aa0e5 100644 (file)
@@ -52,6 +52,12 @@ has 'constraint_generator' => (
     predicate=>'has_constraint_generator',
 );
 
+has coercion => (
+    is      => 'ro',
+    isa     => 'Object',
+    builder => '_build_coercion',
+);
+
 =head1 METHODS
 
 This class defines the following methods.
@@ -62,14 +68,12 @@ Initialization stuff.
 
 =cut
 
-around 'new' => sub {
-    my ($new, $class, @args)  = @_;
-    my $self = $class->$new(@args);
-    $self->coercion(MooseX::Meta::TypeCoercion::Structured->new(
+sub _build_coercion {
+    my ($self) = @_;
+    return MooseX::Meta::TypeCoercion::Structured->new(
         type_constraint => $self,
-    ));
-    return $self;
-};
+    );
+}
 
 =head2 validate
 
@@ -213,9 +217,7 @@ sub is_a_type_of {
     my $other = Moose::Util::TypeConstraints::find_type_constraint($type_or_name);
 
     if ( $other->isa(__PACKAGE__) and @{ $other->type_constraints || [] }) {
-        warn "structured ( $self, $other )";
         if ( $self->parent->is_a_type_of($other->parent) ) {
-            warn "related ( $self, $other )";
             return $self->_type_constraints_op_all($other, "is_a_type_of");
         } elsif ( $self->parent->is_a_type_of($other) ) {
             return 1;
@@ -265,7 +267,7 @@ sub is_subtype_of {
 
 =head2 type_constraints_equals
 
-Checks to see if the internal type contraints are equal.
+Checks to see if the internal type constraints are equal.
 
 =cut
 
@@ -355,4 +357,4 @@ it under the same terms as Perl itself.
 
 =cut
 
-__PACKAGE__->meta->make_immutable;
+__PACKAGE__->meta->make_immutable(inline_constructor => 0);