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


Hi,
I was trying to make an array of hashes which had one member an
anonymous class for some tests, so I did:

    my @f = %{ class => class { has Int $.attr; }, }; say @f.perl

Which gave rise to:

    When invoking 2 '', provided outer frame 0x2b11cb0 (4 '<unit>') does
    not match expected static frame 0x2b11db8 (3 '')
      in block <unit> at -e line 1

Which was definitely unexpected and not something I had seen before.

Naming the class gives a different errror but suggests everything
inside the outer curlies is being interpreted as a block for some
reason:

    my @f = %{ class => class Foo { has Int $.attr; }, }; say @f.perl

Giving:

    Odd number of elements found where hash initializer expected:
    Only saw: -> ;; $_? is raw { #`(Block|50212200) ... }
      in block <unit> at -e line 1

Inlining the class does work like that does work without the additional
curlies:

    my %f =  class => class  { has Int $.attr; }; say %f.perl

Giving:

    {:class(<anon|60919760>)}

Of course what I actually meant originally was:

    my @f = (%( "class" => class  { has Int $.attr; }, ),); say @f.perl

So I guess at the very least it's a LTA error message but does seem to
point to some other bug.

Reply via email to