# New Ticket Created by  Chris Dolan 
# Please include the string:  [perl #60366]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60366 >


There are two bugs here.  The attached patch fixes bug #2 but not bug  
#1.

Bug #1) "role A::B" is not interpreted as a role, but just as a module.

   ./perl6 -e 'role A { method foo { say "Foo"; } }; say A.WHAT'
   Role

   ./perl6 -e 'role A::B { method foo { say "Foo"; } }; say A::B.WHAT'
   Module

Bug #2) applying a role searches for the role in the wrong namespace.

   ./perl6 -e 'role A { method foo { say "Foo"; } }; class B does A  
{}; B.new.foo'
   Foo

   ./perl6 -e 'role A { method foo { say "Foo"; } }; class A::B::C  
does A {}; A::B::C.new.foo'
   Foo

   ./perl6 -e 'role A::B { method foo { say "Foo"; } }; class B does  
A::B {}; B.new.foo'
   Method 'foo' not found for invocant of class 'B'

   ./perl6 -e 'role A::B { method foo { say "Foo"; } }; class A::B::C  
does A::B {}; A::B::C.new.foo'
   Method 'foo' not found for invocant of class 'A;B;C'


With the patch, I instead get:

   ./perl6 -e 'role A::B { method foo { say "Foo"; } }; class B does  
A::B {}; B.new.foo'
   does keyword can only be used with roles.

which suggests that if the module/role bug were fixed, this code  
would work.

Attachment: role.patch
Description: Binary data

Reply via email to