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

Parser loses track of location of errors/warnings when parse is called #8353

Closed
danluu opened this issue Sep 14, 2014 · 1 comment
Closed
Labels
parser Language parsing and surface syntax

Comments

@danluu
Copy link
Contributor

danluu commented Sep 14, 2014

Here's a contrived example that demonstrates this. Let's say I have a file called log with the following:

#
#
parse("#\n;rand(3,1)[1:]")

If I run julia log I get this warning:

WARNING: deprecated syntax "x[i:]" at /home/dluu/dev/dump/fuzz/sandbox/parse-eval/log:2.
Use "x[i:end]" instead.

It says this happens on line 2 instead of line 3 of log because it's line 2 of the parse block, and I happen to be running the file log. It's pretty easy to figure out what happened in this contrived case, but that may not be true for larger cases.

Also, this is happening when I run a script that does eval(parse(...)) on random functions, without ever explicitly indexing into anything. It seems that parsing a function that produces an error/warning with parse inside log points to log instead of whatever file the bad function is defined in. I'm not 100% sure that's what's happening, but I suppose I can write a couple of functions to check this pretty easily.

I can see an argument for not specify the file that's the root cause of the error, but I believe it makes tracking down this type of thing more difficult a lot of the time.

@ihnorton ihnorton added the parser Language parsing and surface syntax label May 8, 2015
@jakebolewski
Copy link
Member

My reading of this issue is that you would want the line location of the parse method call to be propagated in the warning when calling the parse method at runtime. I don't see a reasonable way to do this so I'm going to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

3 participants