# New Ticket Created by  Tobias Leich 
# Please include the string:  [perl #125169]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=125169 >


grammar D { our token doo { doo }; }; say 'doo' ~~ &D::doo 
rakudo-moar a6f563: OUTPUT«Type check failed in binding <anon>; expected 'D' 
but got 'Cursor'␤  in regex doo at /tmp/8wglQQkyMB:1␤  in block <unit> at 
/tmp/8wglQQkyMB:1␤␤»

grammar D { token doo is export { doo }; }; import D; say 'doo' ~~ &doo 
rakudo-moar a6f563: OUTPUT«Type check failed in binding <anon>; expected 'D' 
but got 'Cursor'␤  in regex doo at /tmp/anZydiSimC:1␤  in block <unit> at 
/tmp/anZydiSimC:1␤␤»

It works when we mess with the invocant:
grammar D { our token doo(Mu:) { doo }; }; say 'doo' ~~ &D::doo 
rakudo-moar a6f563: OUTPUT«「doo」␤»

grammar D { token doo(Mu:) is export { doo }; }; import D; say 'doo' ~~ &doo 
rakudo-moar a6f563: OUTPUT«「doo」␤»

grammar D { our token doo(Mu:) { doo }; }; say 'doo' ~~ / <&D::doo> / 
rakudo-moar a6f563: OUTPUT«「doo」␤»

It should work without "restricting" the invocant to Mu.

Reply via email to