for my $name (keys %$map) {
my $method = $map->{$name};
- # Modifiers are always fine.
- next if $method->isa('Class::MOP::Method::Wrapped')
- || $method->isa('Moose::Meta::Method::Overridden')
+ # override and augment modifiers are always fine.
+ next if $method->isa('Moose::Meta::Method::Overridden')
|| $method->isa('Moose::Meta::Method::Augmented');
+ # Since we can implicitly override and wrap in the same class, we
+ # need to be a little more careful here.
+ if ($method->isa('Class::MOP::Method::Wrapped')) {
+ my $orig_method = $method->get_original_method;
+ next if $method->associated_metaclass->name
+ ne $orig_method->associated_metaclass->name;
+ }
+
# Generated methods
next if $method->isa('Class::MOP::Method::Generated');
after foo => sub {};
+#-----------------------------------------------------------------------------
+
+## name Pull in a method from a role. Could go either way here.
+## failures 1
+## cut
+
+package Parent;
+use Moose;
+
+sub foo {}
+
+package Role;
+use Moose::Role;
+
+sub foo {}
+
+package Child;
+use Moose;
+extends 'Parent';
+with 'Role';
+
+#-----------------------------------------------------------------------------
+
+## name Grandparent
+## failures 1
+## cut
+
+package Grandparent;
+use Moose;
+
+sub foo {}
+
+package Parent;
+use Moose;
+extends 'Grandparent';
+
+sub bar {}
+
+package Child;
+use Moose;
+extends 'Parent';
+
+sub foo {}
+
+#-----------------------------------------------------------------------------
+
+## name Grandparent with modifiers
+## failures 0
+## cut
+
+package Grandparent;
+use Moose;
+
+sub foo {}
+
+package Parent;
+use Moose;
+extends 'Grandparent';
+
+before foo => sub {};
+
+package Child;
+use Moose;
+extends 'Parent';
+
+after foo => sub {};
+
+#-----------------------------------------------------------------------------
+
+## name Wrapping an implicit override
+## failures 1
+## cut
+
+package Parent;
+use Moose;
+
+sub foo {}
+
+package Child;
+use Moose;
+extends 'Parent';
+
+before foo => sub {};
+sub foo {}