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


This is one of those weird issues which happens for a specific constellation of 
seemingly unrelated features.

Here's the golfed demo program which reliably produces the error for me:

    grammar G { ... }
    class A { ... }

    for ("a",).race {
        G.parse($_, actions => A);
    }

    grammar G {
        token TOP { . }
    }
    class A {
        method TOP ($/) { return }
    }

It gives this error:

    Cannot invoke this object
      in method TOP at ./test.p6:12
      in regex TOP at ./test.p6:9
      in block  at ./test.p6:5

*Each* of the following changes to the demo program gets rid of the error:

1) Removing the explicit 'return' statement in the action method.
2) Removing the '.race' method call in the loop header.
3) Moving the full definition of 'class A' *before* the 'for' loop.


---
(perl6 version 2015.09-433-g26617f9 built on MoarVM version 2015.09-79-gee9fc2b)

Reply via email to