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

Incorrect useless use warning in andthen/notandthen/orelse #6315

Closed
p6rt opened this issue Jun 3, 2017 · 3 comments
Closed

Incorrect useless use warning in andthen/notandthen/orelse #6315

p6rt opened this issue Jun 3, 2017 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 3, 2017

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

Searchable as RT131499$

@p6rt
Copy link
Author

p6rt commented Jun 3, 2017

From @zoffixznet

In none of these cases is the use of variables actually useless​:

<Zoffix__> m​: my ($sensor1, $sensor2, $sensor3); $sensor1 notandthen $sensor2 notandthen $sensor3 notandthen 'did not find a working sensor!'.say;
<camelia> rakudo-moar 64e898​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use of $sensor3 in sink context (line 1)␤Useless use of $sensor2 in sink context (line 1)␤did not find a working sensor!␤»

<Zoffix__> m​: my ($sensor1, $sensor2, $sensor3) := (1, 2, 3); $sensor1 andthen $sensor2 andthen $sensor3 andthen 'did not find a working sensor!'.say;
<camelia> rakudo-moar 64e898​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use of $sensor3 in sink context (line 1)␤Useless use of $sensor2 in sink context (line 1)␤did not find a working sensor!␤»

<Zoffix__> m​: m​: my ($sensor1, $sensor2, $sensor3); $sensor1 orelse $sensor2 orelse $sensor3 orelse 'did not find a working sensor!'.say;
<camelia> rakudo-moar 64e898​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use of $sensor3 in sink context (line 1)␤Useless use of $sensor2 in sink context (line 1)␤did not find a working sensor!␤»

@p6rt
Copy link
Author

p6rt commented Jan 10, 2018

From @zoffixznet

On Sat, 03 Jun 2017 07​:14​:59 -0700, cpan@​zoffix.com wrote​:

In none of these cases is the use of variables actually useless​:

<Zoffix__> m​: my ($sensor1, $sensor2, $sensor3); $sensor1 notandthen
$sensor2 notandthen $sensor3 notandthen 'did not find a working
sensor!'.say;
<camelia> rakudo-moar 64e898​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use
of $sensor3 in sink context (line 1)␤Useless use of $sensor2 in sink
context (line 1)␤did not find a working sensor!␤»

<Zoffix__> m​: my ($sensor1, $sensor2, $sensor3) := (1, 2, 3); $sensor1
andthen $sensor2 andthen $sensor3 andthen 'did not find a working
sensor!'.say;
<camelia> rakudo-moar 64e898​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use
of $sensor3 in sink context (line 1)␤Useless use of $sensor2 in sink
context (line 1)␤did not find a working sensor!␤»

<Zoffix__> m​: m​: my ($sensor1, $sensor2, $sensor3); $sensor1 orelse
$sensor2 orelse $sensor3 orelse 'did not find a working sensor!'.say;
<camelia> rakudo-moar 64e898​: OUTPUT​: «WARNINGS for <tmp>​:␤Useless use
of $sensor3 in sink context (line 1)␤Useless use of $sensor2 in sink
context (line 1)␤did not find a working sensor!␤»

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@d30e5b1e32
Tests​: rakudo/rakudo@d30e5b1e32

@p6rt
Copy link
Author

p6rt commented Jan 10, 2018

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

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