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

strange parse error for +.( ... ) #22498

Closed
JeffBezanson opened this issue Jun 23, 2017 · 4 comments
Closed

strange parse error for +.( ... ) #22498

JeffBezanson opened this issue Jun 23, 2017 · 4 comments
Labels
bug Indicates an unexpected problem or unintended behavior error handling Handling of exceptions by Julia or the user minor change Marginal behavior change acceptable for a minor release parser Language parsing and surface syntax

Comments

@JeffBezanson
Copy link
Member

JeffBezanson commented Jun 23, 2017

Was just looking at #20540 and noticed this:

julia> +.(1,2)
ERROR: syntax: numeric constant "." cannot be implicitly multiplied because it ends with "."

At the very least, the error message doesn't make sense.

Tasks

No tasks being tracked yet.
@JeffBezanson JeffBezanson added bug Indicates an unexpected problem or unintended behavior parser Language parsing and surface syntax labels Jun 23, 2017
@simonster simonster added the error handling Handling of exceptions by Julia or the user label Jun 25, 2017
@JeffBezanson
Copy link
Member Author

Noticed in a different form here: #32860 (comment)

julia> +.
ERROR: LoadError: ArgumentError: invalid base 10 digit '.' in "."

Because + can be part of numeric literals, we try to parse the dot as one. For example +.1 works. We should do what non-numeric-literal unary operators do:

julia> !.
ERROR: syntax: invalid identifier name "."

@JeffBezanson JeffBezanson added the minor change Marginal behavior change acceptable for a minor release label Aug 11, 2019
@brenhinkeller
Copy link
Contributor

Still reproduces in 1.8.3

@adienes
Copy link
Contributor

adienes commented Jun 23, 2023

We should do what non-numeric-literal unary operators do

this is now the observed behavior now with JuliaSyntax merged.

julia> +.
ERROR: ParseError:
# Error @ REPL[7]:1:2
+.
#╙ ── invalid identifier
Stacktrace:
 [1] top-level scope
   @ none:1

@vtjnash vtjnash closed this as completed Jan 31, 2024
@vtjnash
Copy link
Member

vtjnash commented Jan 31, 2024

This could use a test, if you would be willing to write one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior error handling Handling of exceptions by Julia or the user minor change Marginal behavior change acceptable for a minor release parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

5 participants