my @role_differences = $self->_role_differences(
$class_meta_name, $super_meta_name,
);
+
+ # handle the case where we need to fix compatibility between a class and
+ # its parent, but all roles in the class are already also done by the
+ # parent
+ # see t/050/054.t
+ return Class::MOP::class_of($super_meta_name)
+ unless @role_differences;
+
return Moose::Meta::Class->create_anon_class(
superclasses => [$super_meta_name],
roles => \@role_differences,
--- /dev/null
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+
+{
+ package Foo::Meta::Constructor1;
+ use Moose::Role;
+}
+
+{
+ package Foo::Meta::Constructor2;
+ use Moose::Role;
+}
+
+{
+ package Foo;
+ use Moose;
+ Moose::Util::MetaRole::apply_metaroles(
+ for => __PACKAGE__,
+ class_metaroles => { constructor => ['Foo::Meta::Constructor1'] },
+ );
+}
+
+{
+ package Foo::Sub;
+ use Moose;
+ Moose::Util::MetaRole::apply_metaroles(
+ for => __PACKAGE__,
+ class_metaroles => { constructor => ['Foo::Meta::Constructor2'] },
+ );
+ extends 'Foo';
+}
+
+{
+ package Foo::Sub::Sub;
+ use Moose;
+ Moose::Util::MetaRole::apply_metaroles(
+ for => __PACKAGE__,
+ class_metaroles => { constructor => ['Foo::Meta::Constructor2'] },
+ );
+ ::lives_ok { extends 'Foo::Sub' } "doesn't try to fix if nothing is needed";
+}
+
+done_testing;