Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
don't create accessor if the class declares an explicit method of tha…
…t name
  • Loading branch information
dagurval committed Mar 3, 2013
1 parent 7156048 commit 76a86f7
Showing 1 changed file with 16 additions and 1 deletion.
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

0 comments on commit 76a86f7

Please sign in to comment.