From: Shawn M Moore Date: Sun, 3 May 2009 19:26:59 +0000 (-0400) Subject: Handle aliasing too X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aa65a014df13d9b66246a792d3aeb701d014b3b9;p=gitmo%2FPerl-Critic-Dynamic-Moose.git Handle aliasing too --- diff --git a/lib/Perl/Critic/Policy/DynamicMoose/ClassOverridesRole.pm b/lib/Perl/Critic/Policy/DynamicMoose/ClassOverridesRole.pm index 9f1c589..9c0dc9b 100644 --- a/lib/Perl/Critic/Policy/DynamicMoose/ClassOverridesRole.pm +++ b/lib/Perl/Critic/Policy/DynamicMoose/ClassOverridesRole.pm @@ -20,6 +20,7 @@ sub violates_metaclass { my $role = $application->role; for my $method ($role->get_method_list) { next if $application->is_method_excluded($method); + next if $application->is_method_aliased($method); my $method_object = $class->get_method($method) or next; diff --git a/t/DynamicMoose/ClassOverridesRole.run b/t/DynamicMoose/ClassOverridesRole.run index 75df069..1a62da9 100644 --- a/t/DynamicMoose/ClassOverridesRole.run +++ b/t/DynamicMoose/ClassOverridesRole.run @@ -68,3 +68,20 @@ use Moose; with 'Role::A'; with 'Role::B'; +#----------------------------------------------------------------------------- + +## name Name collision with aliasing +## failures 0 +## cut + +package Role; +use Moose::Role; + +sub foo {} + +package Class; +use Moose; +with 'Role' => { alias => { foo => 'foo_bar' } }; + +sub foo {} +