Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nil return type constraint interferes with block interpolation in strings #5747

Open
p6rt opened this issue Oct 14, 2016 · 3 comments
Open
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 14, 2016

Migrated from rt.perl.org#129874 (status was 'new')

Searchable as RT129874$

@p6rt
Copy link
Author

p6rt commented Oct 14, 2016

From @zoffixznet

<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

@p6rt
Copy link
Author

p6rt commented Oct 14, 2016

From @zoffixznet

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​:

<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

@p6rt
Copy link
Author

p6rt commented Oct 14, 2016

From @zoffixznet

<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␤»

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant