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

improve error message for using ** #34706

Merged
merged 4 commits into from
Feb 12, 2020
Merged

Conversation

oscardssmith
Copy link
Member

based on https://discourse.julialang.org/t/syntax-use-instead-of-and-syntax-is-not-a-unary-operator/34258/5, it seems that while well intentioned, this error message might be causing more confusion than it fixes. I took a stab at addressing it, but I think possibly the better change would be to parse ** as an operator, and then we could define specific methods that threw better error messages. Specifically, a**b should have the error, but if we see **a, we should instead be telling people to use splatting, as that is more likely what they were trying to do.

based on https://discourse.julialang.org/t/syntax-use-instead-of-and-syntax-is-not-a-unary-operator/34258/5, it seems that while well intentioned, this error message might be causing more confusion than it fixes. I took a stab at addressing it, but I think possibly the better change would be to parse `**` as an operator, and then we could define specific methods that threw better error messages. Specifically, `a**b` should have the error, but if we see `**a`, we should instead be telling people to use splatting, as that is more likely what they were trying to do.
also gives direct advice in the case of splatting.
@oscardssmith
Copy link
Member Author

Also, how do I make it so commits don't re-run ci. I know I'm being wasteful here, but I thought that putting [ci skip] in the title would fix it.

@oxinabox
Copy link
Contributor

oxinabox commented Feb 8, 2020

Also, how do I make it so commits don't re-run ci. I know I'm being wasteful here, but I thought that putting [ci skip] in the title would fix it.

You need to put it in the commit message, not in the PR title.

But this is not the kind of PR that should skip CI anyway, your not just updating spelling in the docs, you are changing the parser and if you had made a typo and forgotten a closing quote etc CI would catch it.

@DilumAluthge
Copy link
Member

Yeah, definitely do not skip CI for this PR/these commits.

@KristofferC
Copy link
Sponsor Member

parse-error: read: invalid escape sequence

in CI so indeed, not really a good PR for ci skip.

@oscardssmith oscardssmith changed the title improve error message for using ** [ci skip] improve error message for using ** Feb 9, 2020
@oscardssmith
Copy link
Member Author

You'd really think I'd be able to edit a single string without typos. Oh well. Fixed.

@JeffBezanson JeffBezanson added the parser Language parsing and surface syntax label Feb 10, 2020
@JeffBezanson JeffBezanson merged commit f705905 into JuliaLang:master Feb 12, 2020
@oscardssmith
Copy link
Member Author

Thanks for merging this!.

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

Successfully merging this pull request may close these issues.

6 participants