X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod%2FAccessor%2FNative%2FWriter.pm;fp=lib%2FMoose%2FMeta%2FMethod%2FAccessor%2FNative%2FWriter.pm;h=2b55aae5726c55c13da22e19396af5d8f65983b1;hb=d85da60f4f8a33dd3a34401e754f9a7a10da3846;hp=57a4a707cd17e29f8d1bea267b23f46bcffaadc1;hpb=4e1ce2ecdafddc8ac9d8c223416499323b8b2bc2;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method/Accessor/Native/Writer.pm b/lib/Moose/Meta/Method/Accessor/Native/Writer.pm index 57a4a70..2b55aae 100644 --- a/lib/Moose/Meta/Method/Accessor/Native/Writer.pm +++ b/lib/Moose/Meta/Method/Accessor/Native/Writer.pm @@ -4,6 +4,7 @@ use strict; use warnings; use List::MoreUtils qw( any ); +use Moose::Util; use Moose::Role; @@ -85,11 +86,20 @@ sub _constraint_must_be_checked { sub _is_root_type { my $self = shift; - my ($type) = @_; - - my $name = $type->name; - - return any { $name eq $_ } @{ $self->root_types }; + my $type = shift; + + if ( + Moose::Util::does_role( $type, 'Type::Constraint::Role::Interface' ) ) + { + require Type::Library::Builtins; + return + any { $type->is_same_type_as( Type::Library::Builtins::t($_) ) } + @{ $self->root_types }; + } + else { + my $name = $type->name; + return any { $name eq $_ } @{ $self->root_types }; + } } sub _inline_copy_native_value {