Skip Menu |
Report information
Id: 130763
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: jns [at] gellyfish.co.uk
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: rakudobug <rakudobug [...] perl.org>
Subject: [BUG][LTA] Weird error in anonymous class value in Hash
From: Jonathan Stowe <jns [...] gellyfish.co.uk>
Date: Sun, 12 Feb 2017 15:18:44 +0000
Download (untitled) / with headers
text/plain 1.1k
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.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 248b
Golfed a bit: <Zoffix> m: { foo => class {} }() <camelia> rakudo-moar 266f34: OUTPUT«When invoking 1 '', provided outer frame 0x322f4e0 (3 '<unit>') does not match expected static frame 0x322f5e8 (2 '')␤ in block <unit> at <tmp> line 1␤␤»
Date: Sun, 12 Feb 2017 16:57:22 +0100
To: perl6-compiler [...] perl.org
Subject: Re: [perl #130763] [BUG][LTA] Weird error in anonymous class value in Hash
From: Timo Paulssen <timo [...] wakelift.de>
Download (untitled) / with headers
text/plain 428b
This is caused by the way we differentiate between anonymous blocks and hashes; we just parse it as a block first, and if at the end it turns out it should be a hash instead, we change it around. I suppose at that point the class will already have been defined and its stuff will point at the "not actually a block any more" thing that we had as a "stand-in" when we weren't sure yet whether it should be a hash or a block ...


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org