don't close over the type constraint for inlined tcs
Jesse Luehrs [Sun, 24 Apr 2011 20:14:05 +0000 (15:14 -0500)]
lib/Moose/Meta/Method/Accessor.pm

index d8c8d3f..f736f25 100644 (file)
@@ -43,11 +43,10 @@ sub _eval_environment {
         '$default'             => \($attr->default),
         '$meta'                => \$self,
         '$type_constraint_obj' => \$type_constraint_obj,
-        '$type_constraint'     => \(
-              $type_constraint_obj
-            ? $type_constraint_obj->_compiled_type_constraint
-            : undef
-        ),
+        ($type_constraint_obj && !$type_constraint_obj->can_be_inlined
+            ? ('$type_constraint'
+                => \($type_constraint_obj->_compiled_type_constraint))
+            : ()),
         (
             $type_constraint_obj
             ? %{ $type_constraint_obj->inline_environment }