Skip to content

i++ could use a better error message #376

Open
@StevenWhitaker

Description

@StevenWhitaker

I'm opening this issue based on a question on discourse.

Consider the following code:

i = 0
for n = 1:5
    i++
end

This will result in (at least on Julia 1.7.0)

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

ERROR: syntax: attempted to call an infix operator with just one argument - perhaps you meant "i += 1"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions