Subject: | Type expressions are unnecessarily passed to Moose::Util::TypeConstraints::find_or_create_isa_type_constraint |
If the type expression returns a blessed object, the result is still passed to find_or_create_isa_type_constraint. Not only is this redundant; it prevents people from using type expressions with non-Moose type libraries (e.g. Type::Tiny or MouseX::Types).
A patch is attached that skips calling reify_type when the type expression returns something that is already a blessed object.
Subject: | reify-type-patch.diff |
--- Parameters.xs-orig 2013-06-04 14:31:17.601883207 +0100
+++ Parameters.xs 2013-06-04 14:31:58.246084748 +0100
@@ -798,7 +798,9 @@
sentinel_disarm(expr_sentinel);
}
*ptype = my_eval(aTHX_ sen, floor, expr);
- *ptype = reify_type(aTHX_ sen, declarator, *ptype);
+ if (!sv_isobject(*ptype)) {
+ *ptype = reify_type(aTHX_ sen, declarator, *ptype);
+ }
if (!sv_isobject(*ptype)) {
croak("In %"SVf": (%"SVf") doesn't look like a type object", SVfARG(declarator), SVfARG(*ptype));
}