A coerced attribute of an union type with an Undef member fails to apply
constraints.
$ perl -Moose -le'
has a=>(is=>"rw",isa=>"Undef|Undef",coerce=>1);
__PACKAGE__->new(a=>"abc");
print "BAD";
'
BAD
$ perl -Moose -e'
has a=>(is=>"rw",isa=>"Undef",coerce=>1);
__PACKAGE__->new(a=>"abc");
print "BAD";
'
Attribute (a) does not pass the type constraint because: Validation
failed for 'Undef' failed with value abc at [snip backtrace]
$ perl -Moose -e'
has a=>(is=>"rw",isa=>"Num|Num",coerce=>1);
__PACKAGE__->new(a=>"abc");
print "BAD";
'
Attribute (a) does not pass the type constraint because: Validation
failed for 'Num|Num' failed with value undef at [snip backtrace]
$ perl -Moose -e'
has a=>(is=>"rw",isa=>"Undef|Undef",coerce=>0);
__PACKAGE__->new(a=>"abc");
print "BAD";
'
Attribute (a) does not pass the type constraint because: Validation
failed for 'Undef|Undef' failed with value abc at [snip backtrace]