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


The attached file contains the following code:

> multi fib(0) { 0 }
> multi fib(1) { 1 }
> multi fib(Int $n where * >= 0 ) is cached { fib($n - 2) + fib($n - 1) }
>
> say fib(18);

...which, when run, results in the following error message:

> Cannot invoke object with invocation handler in this context
>   in block <unit> at test.p6:5

The proper way to fix this code is declare proto fib(Int $) is cached { * }, 
but that's not obvious from the error message.  I'm not sure if this happens 
with other Routine traits, but I wouldn't be surprised.

Attachment: test.p6
Description: Binary data

Reply via email to