Skip to content
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

Misdiagnosed parse error #4322

Closed
nventuro opened this issue Feb 9, 2024 · 1 comment · Fixed by #6180
Closed

Misdiagnosed parse error #4322

nventuro opened this issue Feb 9, 2024 · 1 comment · Fixed by #6180
Labels
bug Something isn't working

Comments

@nventuro
Copy link
Contributor

nventuro commented Feb 9, 2024

Aim

When importing multiple things from the same crate or module, it's typical to have a single use statement and use braces and a comma-separated list. When a comma is missing however (very common when copy-pasting imports or simply adding new things), the parser provides an unhelpful error message that points somewhere else.

Expected Behavior

In the following minimal example, there's a comma missing between map::Map and set::Set.

contract ParserTest {
    use dep::aztec::{
        state_vars::{map::Map set::Set},
    };

    #[aztec(private)]
    fn constructor() {}
}

Bug

The compiler emits the following error message:

error: Expected a Ident but found {
  ┌─ <...>/contracts/parser_test_contract/src/main.nr:2:21
  │
2 │     use dep::aztec::{
  │                     -

This led on a wild-goose check trying to find if I was using the use statement incorrectly, or trying to find grammar errors at some earlier line.

To Reproduce

Compile the above code with the current master of aztec-packages. See here for a minimal commit that adds this test contract to the monorepo.

Project Impact

None

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Installation Method

Compiled from source

Nargo Version

nargo version = 0.23.0 noirc version = 0.23.0+f1b91511124df89bbe9e059b87536901bdf0d6f3 (git version hash: f1b9151, is dirty: false)

NoirJS Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@nventuro nventuro added the bug Something isn't working label Feb 9, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Feb 9, 2024
@asterite
Copy link
Collaborator

asterite commented Oct 3, 2024

Here's the error message that the handwritter parser produces for this:

error: Expected a `,` separating these two use trees
  ┌─ src/main.nr:1:15
  │
1 │ use foo::{bar baz};
  │               ---

@asterite asterite mentioned this issue Oct 3, 2024
5 tasks
@TomAFrench TomAFrench linked a pull request Oct 7, 2024 that will close this issue
5 tasks
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants