Skip Menu |
Report information
Id: 129874
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: cpan [at] zoffix.com
Cc:
AdminCc:

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



From: cpan [...] zoffix.com
To: rakudobug [...] perl.org
Subject: [BUG] Strange closure-related issue in block interpolation
Date: Thu, 13 Oct 2016 21:30:47 -0400
Download (untitled) / with headers
text/plain 1.2k
<Zoffix> Hm. Found a strange bug in core that I can't reproduce. <Zoffix> m: Bag.new-from-pairs: 1 => -1; <camelia> rakudo-moar a09c8d: OUTPUT«Use of Nil in string context␤ in block <unit> at <tmp> line 1␤Use of Nil in string context␤ in block <unit> at <tmp> line 1␤Found negative values for in ␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> l…» <Zoffix> Those Nils? It's the two interpolated blocks on this line: https://github.com/rakudo/rakudo/blob/a09c8dc99ef7ae60876ad7a7cc478f7e303eb804/src/core/Baggy.pm#L48 <Zoffix> If I change it to this: my $wat = @toolow.join: ' '; my $name = self.^name; fail "Found negative values for $wat in $name" if @toolow; then the bug goes away. <Zoffix> m: role Foo { method !meow { my @meows = <foo bar ber>; fail "some {@meows}" if @meows; }; method moo { self!meow; 42 } }; class :: does Foo {}.moo <camelia> rakudo-moar a09c8d: OUTPUT«some foo bar ber␤ in method meow at <tmp> line 1␤ in method moo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in method moo at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤» <Zoffix> But can't reproduce it ^ :/ https://irclog.perlgeek.de/perl6-dev/2016-10-14#i_13399643
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.7k
Spoke too soon. The issue is the Nil return type constraint. Golfed: <Zoffix> m: sub (-->Nil) { fail "{42}"; }() <camelia> rakudo-moar a09c8d: OUTPUT«Use of Nil in string context␤ in sub at <tmp> line 1␤␤ in sub at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤» On Thu Oct 13 18:31:07 2016, cpan@zoffix.com wrote: Show quoted text
> > <Zoffix> Hm. Found a strange bug in core that I can't reproduce. > <Zoffix> m: Bag.new-from-pairs: 1 => -1; > <camelia> rakudo-moar a09c8d: OUTPUT«Use of Nil in string context␤ > in > block <unit> at <tmp> line 1␤Use of Nil in string context␤ in block > <unit> at <tmp> line 1␤Found negative values for in ␤ in block > <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at > <tmp> > l…» > <Zoffix> Those Nils? It's the two interpolated blocks on this line: > https://github.com/rakudo/rakudo/blob/a09c8dc99ef7ae60876ad7a7cc478f7e303eb804/src/core/Baggy.pm#L48 > <Zoffix> If I change it to this: my $wat = @toolow.join: ' '; my > $name = self.^name; fail "Found negative values for $wat in $name" > if > @toolow; then the bug goes away. > <Zoffix> m: role Foo { method !meow { my @meows = <foo bar ber>; > fail > "some {@meows}" if @meows; }; method moo { self!meow; 42 } }; class > :: > does Foo {}.moo > <camelia> rakudo-moar a09c8d: OUTPUT«some foo bar ber␤ in method > meow > at <tmp> line 1␤ in method moo at <tmp> line 1␤ in block <unit> at > <tmp> line 1␤␤Actually thrown at:␤ in method moo at <tmp> line 1␤ > in > block <unit> at <tmp> line 1␤␤» > <Zoffix> But can't reproduce it ^ :/ > > https://irclog.perlgeek.de/perl6-dev/2016-10-14#i_13399643
Download (untitled) / with headers
text/plain 260b
<Zoffix> m: sub (-->Nil) { say "wat {42} heh"; }() <camelia> rakudo-moar a09c8d: OUTPUT«Use of Nil in string context␤ in sub at <tmp> line 1␤wat heh␤» <Zoffix> m: sub () { say "wat {42} heh"; }() <camelia> rakudo-moar a09c8d: OUTPUT«wat 42 heh␤»


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