Fix two bugs coercions for union types
authorDave Rolsky <autarch@urth.org>
Sun, 4 Jul 2010 16:36:52 +0000 (11:36 -0500)
committerDave Rolsky <autarch@urth.org>
Fri, 27 Aug 2010 15:15:34 +0000 (10:15 -0500)
commit4beacd39f48c283cd92d9c6231b97e5413076e14
tree25026f5c3d3401cce33ebab635c0616f55962881
parentd21262bd42c2539c47e5d41e7506710ecd27ad65
Fix two bugs coercions for union types

First, the union type always made a coercion, even if none its constituent types had a coercion.

Second, the union coercion always returned undef if none of the coercions
actually coerced. This caused union types which included undef to always pass
the constraint. In other case, returning undef simply led to a bad error
message saying undef did not pass the type constraint.
Changes
lib/Moose/Meta/TypeCoercion/Union.pm
lib/Moose/Meta/TypeConstraint/Union.pm
t/040_type_constraints/009_union_types_and_coercions.t