-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouse won't warn when overwriting a method with an accessor #86
Comments
Warning will be issued if code in comments restored (lib/Mouse/Meta/Attribute.pm line 260 ~ 264). |
Probably we must pass the tests in t/020_attributes/027_accessor_override_method.t? |
メソッドをアクセッサでオーバーライドしたとき警告を出す処理の部分(lib/Mouse/Meta/Attribute.pm の 260 ~ 264行目)のコメントアウトを解除し、 t/020_attributes/027_accessor_override_method.t のテストをスキップせずすべて実行したところ、passしてました。 |
Changelog diff is: diff --git a/Changes b/Changes index 7e69336..808e88e 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for Mouse {{$NEXT}} + +v2.5.5 2018-08-13T15:41:32Z - Warn if accessors overwrite methods/functions (ybrliiu #86, #90, #93) - Fix for threads and XS; use newSVpvs instead of newSVpvs_share (sergeykolychev #92)
Changelog diff is: diff --git a/Changes b/Changes index 808e88e..f31e5e0 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,9 @@ Revision history for Mouse {{$NEXT}} +v2.5.6 2018-08-13T22:47:57Z + - Revert "Warn if accessors overwrite methods/functions" for now; it may cause crashes in perl 5.28.0 (#94) + v2.5.5 2018-08-13T15:41:32Z - Warn if accessors overwrite methods/functions (ybrliiu #86, #90, #93) - Fix for threads and XS; use newSVpvs instead of newSVpvs_share (sergeykolychev #92)
use strict;
use warnings;
{
package Foo::Role;
use Mouse::Role;
has 'bar' => (
is => 'rw',
isa => 'Int',
default => sub { 10 },
);
package Foo;
use Mouse;
with 'Foo::Role';
has '+bar' => (default => sub { 100 });
} This code is valid and should not emit redefine warnings, so I've merged PR #93. On the other hand, it may cause crashes in perl 5.28.0 :/ I will consider how to fix/workaround this. |
I see. |
In Moose
=> You are overwriting a locally defined method (hello) with an accessor
In Mouse
=> No warning and error
I guess Mouse should warn in such case.
The text was updated successfully, but these errors were encountered: