JuliaLang / JuliaLang/JuliaSyntax.jl
`i++` could use a better error message
- Dominant language
- Julia
- Stars
- 293
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
I'm opening this issue based on a [question on discourse](https://discourse.julialang.org/t/compiler-complains-about-unexpected-end/83037).
Consider the following code:
```julia
i = 0
for n = 1:5
i++
end
```
This will result in (at least on Julia 1.7.0)
```julia
ERROR: syntax: unexpected "end"
```
This error message could benefit from JuliaLang/julia#45791. However, I'm doing a separate issue for this special case because a new user might write `i++` not knowing it is not equivalent to `i += 1` (or even that `++` is parsed as an infix operator). Would it be possible to have a more specific error message? Something like
```julia
ERROR: syntax: attempted to call an infix operator with just one argument - perhaps you meant "i += 1"?
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.