Union inlining should always be surrounded by its own set of parens, for safety
Dave Rolsky [Mon, 25 Apr 2011 01:40:41 +0000 (20:40 -0500)]
lib/Moose/Meta/TypeConstraint/Union.pm

index ae0ea12..f1c0262 100644 (file)
@@ -81,9 +81,12 @@ sub _inline_check {
     my $self = shift;
     my $val  = shift;
 
-    return
-        join ' || ', map { '(' . $_->_inline_check($val) . ')' }
-        @{ $self->type_constraints };
+    return '('
+               . (
+                  join ' || ', map { '(' . $_->_inline_check($val) . ')' }
+                  @{ $self->type_constraints }
+                 )
+           . ')';
 };
 
 sub inline_environment {