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


Attempting to give a map some invalid arg or a sub gives an error:

     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6 -e '^4 .map: {};'
     ===SORRY!===
     Cannot find method 'count' on object of type NQPMu
     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6  -e '^4 .map: 42;'
     ===SORRY!===
     Cannot find method 'count' on object of type NQPMu
     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6 -e 'sub foo ($) {say  
"meow"}; ^4 .map: &foo;'
     ===SORRY!===
     Cannot find method 'count' on object of type NQPMu


However, everything works fine, if we turn off the optimizer:

     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6 --optimize=off -e '^4  
.map: {};'
     Cannot map a Range to a Hash.
     Did you mean to add a stub ({...}) or did you mean to .classify?
       in block <unit> at -e line 1

     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6 --optimize=off -e '^4  
.map: 42;'
     Cannot resolve caller map(Range: Int); none of these signatures match:
         ($: Hash \h, *%_)
         (\SELF: &block;; :$label, :$item, *%_)
         (HyperIterable:D $: &block;; :$label, *%_)
       in block <unit> at -e line 1

     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6 --optimize=off -e  
'sub foo ($) {say "meow"}; ^4 .map: &foo;'
     meow
     meow
     meow
     meow
     zoffix@VirtualBox:~/CPANPRC/rakudo$


Or, if we wrap the range into parenths:

     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6 -e '(^4).map: {};'
     Cannot map a Range to a Hash.
     Did you mean to add a stub ({...}) or did you mean to .classify?
       in block <unit> at -e line 1

     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6  -e '(^4).map: 42;'
     Cannot resolve caller map(Range: Int); none of these signatures match:
         ($: Hash \h, *%_)
         (\SELF: &block;; :$label, :$item, *%_)
         (HyperIterable:D $: &block;; :$label, *%_)
       in block <unit> at -e line 1

     zoffix@VirtualBox:~/CPANPRC/rakudo$ ./perl6 -e 'sub foo ($) {say  
"meow"}; (^4).map: &foo;'
     meow
     meow
     meow
     meow


Reply via email to