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

(fuzzer) - The parser does not allow parenthesizing in two type locations #2375

Closed
pczarn opened this issue Aug 19, 2023 · 1 comment · Fixed by #2388
Closed

(fuzzer) - The parser does not allow parenthesizing in two type locations #2375

pczarn opened this issue Aug 19, 2023 · 1 comment · Fixed by #2388
Assignees
Labels
bug Something isn't working compiler frontend `noirc_frontend` crate

Comments

@pczarn
Copy link
Contributor

pczarn commented Aug 19, 2023

Aim

I tried to compile types with parentheses in two locations:

  • str<(Foo)> - string type with a parethesized argument
  • [Foo; (Bar)] - array type with a parenthesized length

Expected Behavior

Expected the types to compile with at most a warning.

Bug

This is inconsistent with other type expressions in Noir, and with the Rust parser which gives a warning (I know we differ from Rust grammar, but still).

To Reproduce

Compile:

fn foo<Bar>(bar: [Bar; (123)]) {}

-> Error: Expression is invalid in an array-length type: 'Error'. Only unsigned integer constants, globals, generics, +, -, *, /, and % may be used in this context.

fn foo<Foo>(bar: str<(Foo)>) {}

-> ???

Installation Method

Compiled from source

Nargo Version

No response

Additional Context

Bug found with the parser-fuzzer tool.

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@pczarn pczarn added the bug Something isn't working label Aug 19, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Aug 19, 2023
@jfecher jfecher added compiler frontend `noirc_frontend` crate P-LOW and removed discussion labels Aug 21, 2023
@jfecher jfecher self-assigned this Aug 21, 2023
@jfecher
Copy link
Contributor

jfecher commented Aug 21, 2023

@f01dab1e want to take this one on?

@kevaundray kevaundray changed the title (nitpick) The parser does not allow parenthesizing in two type locations (fuzzer) The parser does not allow parenthesizing in two type locations Aug 21, 2023
@kevaundray kevaundray changed the title (fuzzer) The parser does not allow parenthesizing in two type locations (fuzzer) - The parser does not allow parenthesizing in two type locations Aug 21, 2023
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler frontend `noirc_frontend` crate
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants