Don't try to inline a coercion unless the type constraint has a coercion
Dave Rolsky [Mon, 19 Jul 2010 17:01:28 +0000 (12:01 -0500)]
lib/Moose/Meta/Method/Accessor.pm

index 7b6517a..fa637b2 100644 (file)
@@ -166,7 +166,7 @@ sub _inline_check_coercion {
 
     my $attr = $self->associated_attribute;
 
-    return '' unless $attr->should_coerce;
+    return '' unless $attr->should_coerce && $attr->type_constraint->has_coercion;
     return "$value = \$attr->type_constraint->coerce($value);";
 }