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

orelse + block in a string gets the wrong $_ #6553

Closed
p6rt opened this issue Sep 27, 2017 · 3 comments
Closed

orelse + block in a string gets the wrong $_ #6553

p6rt opened this issue Sep 27, 2017 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 27, 2017

Migrated from rt.perl.org#132172 (status was 'resolved')

Searchable as RT132172$

@p6rt
Copy link
Author

p6rt commented Sep 27, 2017

From @zoffixznet

Here, instead of the Failure, the $_ is an Any​:

13​:59 m​: sub x { my $ver = .lines.uc with "blazr".IO.open orelse note "meow {.exception.message}" and return 42; "meow$ver" }; dd x
13​:59 camelia rakudo-moar 9af560​: OUTPUT​: «No such method 'exception' for invocant of type 'Any'␤ in sub x at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»

But if we remove the block, then we get the right $_​:
14​:00 Zoffix m​: sub x { my $ver = .lines.uc with "blazr".IO.open orelse note "meow " ~ .exception.message and return 42; "meow$ver" }; dd x
14​:00 camelia rakudo-moar 9af560​: OUTPUT​: «meow Failed to open file /home/camelia/blazr​: No such file or directory␤42␤»

It's possible this issue also affects andthen and notandthen

@p6rt
Copy link
Author

p6rt commented Jan 26, 2018

From @zoffixznet

On Wed, 27 Sep 2017 07​:09​:16 -0700, cpan@​zoffix.com wrote​:

Here, instead of the Failure, the $_ is an Any​:

13​:59 m​: sub x { my $ver = .lines.uc with "blazr".IO.open
orelse note "meow {.exception.message}" and return 42; "meow$ver" };
dd x
13​:59 camelia rakudo-moar 9af560​: OUTPUT​: «No such method
'exception' for invocant of type 'Any'␤ in sub x at <tmp> line 1␤ in
block <unit> at <tmp> line 1␤␤»

But if we remove the block, then we get the right $_​:
14​:00 Zoffix m​: sub x { my $ver = .lines.uc with "blazr".IO.open
orelse note "meow " ~ .exception.message and return 42; "meow$ver" };
dd x
14​:00 camelia rakudo-moar 9af560​: OUTPUT​: «meow Failed to
open file /home/camelia/blazr​: No such file or directory␤42␤»

It's possible this issue also affects andthen and notandthen

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@1ee89b54074e80c
Test​: Raku/roast@2f2998733a2d8132c

@p6rt
Copy link
Author

p6rt commented Jan 26, 2018

@zoffixznet - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Jan 26, 2018
@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