# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #62968] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=62968 >
With Rakudo 153a4a8 on Parrot r36239, I get the following: $ perl6 -e 'role O {}; class C { method a(O $o) { .foo(42) for $o } }; class V does O { method foo($b) { say "OH HAI" } }; my $c = C.new; $c.a(V.new);' OH HAI Doing '$o.list' instead of '$o' inside the method also works. As expected. Having a 'foo' method in the role O makes no difference. However, when taking the route through a typed attribute: $ perl6 -e 'role O {}; class C { has O @!o; method a(O $o) { push @!o, $o; .foo(42) for @!o } }; class V does O { method foo($b) { say "OH HAI" } }; my $c = C.new; $c.a(V.new);' Could not locate a method 'foo' to invoke on class 'Role'. [...] The error message seems all wrong on this one. I have a feeling that the O protoobject is being pushed to the array @!o. Removing the typing on @!o resolves the problem. A different error is exhibited when repeating the exercise with a typed variable instead: $ perl6 -e 'role O {}; my O @!o; sub a(O $o) { $o.foo(42) }; class V does O { method foo($b) { say "OH HAI" } }; a(V.new);' shift_string() not implemented in class 'Perl6Role' [...]