* We now load the roles needed for native delegations only as needed. This
speeds up the compilation time for Moose itself. (doy)
+ [BUG FIXES]
+
+ * When using native delegations, if an array or hash ref member failed a
+ type constraint check, Moose ended up erroring out with "Can't call method
+ "get_message" on unblessed reference" instead of generating a useful error
+ based on the failed type constraint. Reported by t0m. (Dave Rolsky)
1.19 Tue, Nov 2, 2010
$self->_inline_throw_error(
'"A new member value for ' . $attr_name
. ' does not pass its type constraint because: "'
- . ' . $member_tc->get_message($_)',
+ . ' . $member_tc_obj->get_message($_)',
'data => $_',
) . ';',
'}',
);
}
+{
+ package Bar;
+ use Moose;
+}
+
+{
+ package HasArray;
+ use Moose;
+
+ has objects => (
+ isa => 'ArrayRef[Foo]',
+ traits => ['Array'],
+ handles => {
+ push_objects => 'push',
+ },
+ );
+}
+
+{
+ my $ha = HasArray->new();
+
+ like(
+ exception { $ha->push_objects( Bar->new ) },
+ qr/\QValidation failed for 'Foo'/,
+ 'got expected error when pushing an object of the wrong class onto an array ref'
+ );
+}
+
done_testing;