-
Notifications
You must be signed in to change notification settings - Fork 219
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
"::" token provides poor error when in place of ":" token #1153
Comments
The first error issued is a bit clearer, at least hinting that it is a parsing error:
This is actually a somewhat difficult case to issue a better error for. Since we hit an unexpected token, the error we'd normally expect to issue would be:
And indeed, the parser does generate this error internally before it is thrown away and we attempt to parse a block expression instead. The block expression expects nested expression separated by I'll look at seeing if I can improve this error in any way. It may be related to parser recovery after an error as well. Since normally would need to be two separate expressions separated by a |
@jfecher what is the current status of this issue? |
Still open with the same error message. Looks like the parser may be failing in parsing a constructor so it tries to parse an identifier followed by a block, hence the odd error message. |
Another example that appears to be related (missing
Gives the error: error: Expected a Ident but found {.
┌─ /Users/michaelklein/Coding/rust/noir/test_programs/compile_failure/missing_comma_error/src/main.nr:2:19
│
2 │ use dep::foo::{
│ -
│
Aborting due to 1 previous error |
Aim
Take this example of correctly using ":" to specify an object's fields:
This works. However, imagine you fat finger (in the real case, this was deep in a nested structure):
Point { x: x, y:: y }
You get the wrong category of error:
Expected behavior
Expected error is more like when the y field is omitted:
The ideal error, but I appreciate if this is too naunced for this case, is something like
Cannot bind constructor fields with '::', did you mean a single ':'"?
. The biggest gain is just having the right category of error. For whatever reason, find_variable was called on Point instead of the usual error path if Point wasn't defined.Bug
See above
To reproduce
See above
Installation method
Compiled from source
Nargo version
nargo 0.3.2 (git version hash: 7528f59, is dirty: false)
@noir-lang/noir_wasm version
N/A
@noir-lang/barretenberg version
N/A
@noir-lang/aztec_backend version
N/A
Additional context
No response
Submission Checklist
The text was updated successfully, but these errors were encountered: