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

Unterminated qw subscript should say the line number where it was started ( say “$<x” ) #6359

Open
p6rt opened this issue Jun 24, 2017 · 1 comment

Comments

@p6rt
Copy link

p6rt commented Jun 24, 2017

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

Searchable as RT131640$

@p6rt
Copy link
Author

p6rt commented Jun 24, 2017

From @AlexDaniel

Let's say you have this code​:

my $x;

say �$x<�;

my %h = <a 1 b 2>;
for %h.kv -> $k, $v {
  say â��$k $vâ��
}

The error message you will get​:

===SORRY!=== Error while compiling -e
Variable '$k' is not declared
at -e​:6
------> for %h.kv -> �$k, $v {

In a way, this is understandable. I don't know if it is possible to print something better in this case.

However, let's say you realize what is happening. The issue, obviously, is somewhere above the line where you are getting in the error message. In theory, if you delete everything on that line and onwards, the error message would complain about unclosed something, and this will lead the developer to the line which causes the problem.

So let's try it.

Code​:

my $x;

say �$x<�;

my %h = <a 1 b 2>;

Result​:
Unable to parse quote-words subscript; couldn't find right angle quote
at -e​:6
------> <BOL>�<EOL>
  expecting any of​:
  postfix

It says �couldn't find right angle quote� but does not say where the left angle quote was.

It should say �couldn't find right angle quote (corresponding left angle quote was at line X)�. We already have this kind of thing for other unclosed things (e.g. #`{{{ )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant