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

LTA error message with malformed loops #4391

Closed
p6rt opened this issue Jul 11, 2015 · 5 comments
Closed

LTA error message with malformed loops #4391

p6rt opened this issue Jul 11, 2015 · 5 comments
Labels
LHF Low-hanging fruit, easy to resolve

Comments

@p6rt
Copy link

p6rt commented Jul 11, 2015

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

Searchable as RT125595$

@p6rt
Copy link
Author

p6rt commented Jul 11, 2015

From @AlexDaniel

Code​:
loop (my $i = 0; $i <= 5; $i++;) { say }

Result​:
===SORRY!=== Error while compiling ./test.pl
Missing block
at ./test.pl​:2
------> loop (my $i = 0; $i <= 5; $i++⏏;) { say }

This error message could be better. Currently it is a bit confusing and
makes me want to do this​:
loop (my $i = 0; $i <= 5; $i++ { say };) { say }

===SORRY!=== Error while compiling ./test.pl
Unexpected block in infix position (missing statement control word before
the expression?)
at ./test.pl​:2
------> loop (my $i = 0; $i <= 5; $i++⏏ { say };) { say }
  expecting any of​:
  infix
  infix stopper

STD does a much better job at detecting the actual problem and says
"Malformed loop spec" – now that's awesome.

IRC log​: http://irclog.perlgeek.de/perl6/2015-07-10#i_10879185

@p6rt
Copy link
Author

p6rt commented Jul 11, 2015

From @masak

alex (>)​:

Code​:
loop (my $i = 0; $i <= 5; $i++;) { say }

Result​:
===SORRY!=== Error while compiling ./test.pl
Missing block
at ./test.pl​:2
------> loop (my $i = 0; $i <= 5; $i++⏏;) { say }

Interesting failure mode.

That semicolon looks unnecessary but harmless to me. (It's of the "statement-ending" kind, not the "statement-separating" kind that Perl usually uses.) I wonder if it couldn't be possible to parse it correctly, but warn about "useless semicolon".

As a further data point, Perl 5 also parsefails on the corresponding code​:

$ perl -Mstrict -wE'for (my $i = 0; $i < 10; $i++;) { say $i }'
syntax error at -e line 1, near "++;"
Execution of -e aborted due to compilation errors.

@p6rt
Copy link
Author

p6rt commented Jul 11, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jul 15, 2015

From @jnthn

On Fri Jul 10 17​:06​:45 2015, alex.jakimenko@​gmail.com wrote​:

Code​:
loop (my $i = 0; $i <= 5; $i++;) { say }

Result​:
===SORRY!=== Error while compiling ./test.pl
Missing block
at ./test.pl​:2
------> loop (my $i = 0; $i <= 5; $i++⏏;) { say }

This error message could be better. Currently it is a bit confusing and
makes me want to do this​:
loop (my $i = 0; $i <= 5; $i++ { say };) { say }

===SORRY!=== Error while compiling ./test.pl
Unexpected block in infix position (missing statement control word before
the expression?)
at ./test.pl​:2
------> loop (my $i = 0; $i <= 5; $i++⏏ { say };) { say }
expecting any of​:
infix
infix stopper

STD does a much better job at detecting the actual problem and says
"Malformed loop spec" – now that's awesome.

IRC log​: http://irclog.perlgeek.de/perl6/2015-07-10#i_10879185

Error message now in line with STD, and test added in S32-exceptions/misc.t.

@p6rt
Copy link
Author

p6rt commented Jul 15, 2015

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jul 15, 2015
@p6rt p6rt added the LHF Low-hanging fruit, easy to resolve label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LHF Low-hanging fruit, easy to resolve
Projects
None yet
Development

No branches or pull requests

1 participant