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

error message when a semicolon is missing before a while loop (my $x = 5 while True {}) #5852

Open
p6rt opened this issue Dec 3, 2016 · 2 comments
Labels
LTA

Comments

@p6rt
Copy link

@p6rt p6rt commented Dec 3, 2016

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

Searchable as RT130251$

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Dec 3, 2016

From @AlexDaniel

Code​:
my $x = 5

while True {
}

Result​:
===SORRY!=== Error while compiling -e
Unexpected block in infix position (missing statement control word before the expression?)
at -e​:3
------> while True⏏ {
  expecting any of​:
  infix
  infix stopper

So it is parsed as a statement modifier, that's fine, but the problem is that the error message is way off whet it trips over a block. “Did you forget a semicolon on the previous line?” would be a good addition, but we'd need some heuristic for that.

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Dec 5, 2016

From mefzz@cpan.org

On Sat, 03 Dec 2016 07​:51​:07 -0800, alex.jakimenko@​gmail.com wrote​:

Code​:
my $x = 5

while True {
}

Result​:
===SORRY!=== Error while compiling -e
Unexpected block in infix position (missing statement control word
before the expression?)
at -e​:3
------> while True⏏ {
expecting any of​:
infix
infix stopper

So it is parsed as a statement modifier, that's fine, but the problem
is that the error message is way off whet it trips over a block. “Did
you forget a semicolon on the previous line?” would be a good
addition, but we'd need some heuristic for that.

This is a good suggestion, I would say. The error information is a bit complex for a very simple semicolon missing.
--
'There is only two types of testing. One, a testing by the developer. Two, a
testing by the end user.

@p6rt p6rt added the LTA label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.