Skip to content
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

test for having a method with the same name as an accessor #28

Merged
merged 1 commit into from Mar 3, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion S12-attributes/class.t
Expand Up @@ -11,7 +11,7 @@ Class Attributes
#L<S12/Class attributes/"Class attributes are declared">
#L<S12/Class methods/Such a metaclass method is always delegated>

plan 23;
plan 25;

class Foo {
our $.bar = 23;
Expand Down Expand Up @@ -105,4 +105,19 @@ dies_ok {$test5 = Quux.bar}, 'class attribute accessor hidden by accessor in sub
ok $! ~~ Exception, "bad code: '$bad_code'";
}

{
class A {
has $.b = 1;
method b() { 2; }
};
is A.new.b, 2, "don't create accessor if the class declares an explicit method of that name";


role B {
has $.b = 1;
method b() { 2; }
};
is B.new.b, 2;
}

# vim: ft=perl6