-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
error handlingHandling of exceptions by Julia or the userHandling of exceptions by Julia or the userparserLanguage parsing and surface syntaxLanguage parsing and surface syntax
Description
I'm opening this issue based on a question on discourse.
Consider the following code:
if true
x +
endThis will result in (at least on Julia 1.7.0)
ERROR: syntax: unexpected "end"This error makes sense from the parser's perspective: the end is unexpected because a second argument to + is expected. But from the programmer's perspective, one could argue that the end is exactly where one would expect. The real error is that the + function call is missing an argument.
Could the error message be changed to point to the missing argument instead? Something like
ERROR: syntax: attempted to call an infix operator with just one argumentThe unexpected "end" error also occurs when x + is replaced with, e.g., f(x,. In this case, a better error message might be something like
ERROR: syntax: incomplete function call - missing closing parenthesis ")"cstjean
Metadata
Metadata
Assignees
Labels
error handlingHandling of exceptions by Julia or the userHandling of exceptions by Julia or the userparserLanguage parsing and surface syntaxLanguage parsing and surface syntax