next unless $meta && $meta->isa('Moose::Meta::Class');
next unless $meta->is_mutable;
+ # This can happen when a base class role is applied via
+ # Moose::Util::MetaRole::apply_base_class_roles. The parent is an
+ # anon class and is still mutable, but that's okay.
+ next if $meta->is_anon_class;
Carp::cluck( "Calling make_immutable on "
. $self->name
BEGIN {
eval "use Test::Output;";
plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 4;
+ plan tests => 5;
}
{
require Recursive::Parent
} qr/^Calling make_immutable on Recursive::Child, which has a mutable ancestor \(Recursive::Parent\)/,
"circular dependencies via use are caught properly";
+
+{
+ package Base::Role;
+ use Moose::Role;
+
+ sub foo { 42 }
+
+ package Bar;
+ use Moose;
+ use Moose::Util::MetaRole;
+
+ Moose::Util::MetaRole::apply_base_class_roles(
+ for_class => __PACKAGE__,
+ roles => ['Base::Role'],
+ );
+
+ ::stderr_is {
+ __PACKAGE__->meta->make_immutable
+ } '', "no warning when ancestor is a base-class role subclass of Moose::Object";
+}