sub _role_differences {
my ($class_meta_name, $super_meta_name) = @_;
- my @super_role_metas = $super_meta_name->meta->can('calculate_all_roles_with_inheritance')
- ? $super_meta_name->meta->calculate_all_roles_with_inheritance
- : $super_meta_name->meta->can('calculate_all_roles')
- ? $super_meta_name->meta->calculate_all_roles
- : ();
- my @role_metas = $class_meta_name->meta->can('calculate_all_roles_with_inheritance')
- ? $class_meta_name->meta->calculate_all_roles_with_inheritance
- : $class_meta_name->meta->can('calculate_all_roles')
- ? $class_meta_name->meta->calculate_all_roles
- : ();
+ my @super_role_metas
+ = grep { !$_->isa('Moose::Meta::Role::Composite') }
+ $super_meta_name->meta->can('calculate_all_roles_with_inheritance')
+ ? $super_meta_name->meta->calculate_all_roles_with_inheritance
+ : $super_meta_name->meta->can('calculate_all_roles')
+ ? $super_meta_name->meta->calculate_all_roles
+ : ();
+ my @role_metas
+ = grep { !$_->isa('Moose::Meta::Role::Composite') }
+ $class_meta_name->meta->can('calculate_all_roles_with_inheritance')
+ ? $class_meta_name->meta->calculate_all_roles_with_inheritance
+ : $class_meta_name->meta->can('calculate_all_roles')
+ ? $class_meta_name->meta->calculate_all_roles
+ : ();
my @differences;
for my $role_meta (@role_metas) {
push @differences, $role_meta
--- /dev/null
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+use Test::Moose;
+
+{
+ package Foo::Role;
+ use Moose::Role;
+}
+
+{
+ package Bar::Role;
+ use Moose::Role;
+}
+
+{
+ package Parent;
+ use Moose;
+ Moose::Util::MetaRole::apply_metaroles(
+ for => __PACKAGE__,
+ class_metaroles => { class => ['Foo::Role'] },
+ );
+}
+
+{
+ package Child;
+ use Moose;
+ Moose::Util::MetaRole::apply_metaroles(
+ for => __PACKAGE__,
+ class_metaroles => { class => ['Foo::Role', 'Bar::Role'] },
+ );
+ ::lives_ok { extends 'Parent' };
+}
+
+with_immutable {
+ isa_ok('Child', 'Parent');
+ isa_ok(Child->meta, Parent->meta->_real_ref_name);
+ does_ok(Parent->meta, 'Foo::Role');
+ does_ok(Child->meta, 'Foo::Role');
+ does_ok(Child->meta, 'Bar::Role');
+} 'Parent', 'Child';
+
+done_testing;