You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In argument lists, if the compiler encounters two identifiers in succession, for example fn foo(a b), the compiler currently complains that it "expected )". This is not very informative. Most of the time, I'd wager the reason the programmer has written two identifiers is that they expected the first identifier to be a keyword. The Mojo compiler should account for this, and perhaps say something like:
Did not expect to encounter identifier b after identifier a. Note: a is not a keyword.
This improvement to error messages seems especially important for today's Mojo, given that in each new release of Mojo, new keywords are being introduced, and old keywords are being removed.
Steps to reproduce
Mojo 24.5 doesn't have the out keyword, so running the following program on 24.5 produces a mysterious error:
struct Foo:
var x: Int
fn __init__(out self, x: Int):
self.x = x
error: expected ')' in argument list
fn __init__(out self, x: Int):
^
At least one Mojo learner has encountered this poor error message.
System information
No response
The text was updated successfully, but these errors were encountered:
Bug description
In argument lists, if the compiler encounters two identifiers in succession, for example
fn foo(a b)
, the compiler currently complains that it "expected)
". This is not very informative. Most of the time, I'd wager the reason the programmer has written two identifiers is that they expected the first identifier to be a keyword. The Mojo compiler should account for this, and perhaps say something like:This improvement to error messages seems especially important for today's Mojo, given that in each new release of Mojo, new keywords are being introduced, and old keywords are being removed.
Steps to reproduce
Mojo 24.5 doesn't have the
out
keyword, so running the following program on 24.5 produces a mysterious error:At least one Mojo learner has encountered this poor error message.
System information
No response
The text was updated successfully, but these errors were encountered: