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

Quoted Exprs from blocks fail to parse back into expressions #6036

Closed
Thunkar opened this issue Sep 13, 2024 · 0 comments · Fixed by #6040
Closed

Quoted Exprs from blocks fail to parse back into expressions #6036

Thunkar opened this issue Sep 13, 2024 · 0 comments · Fixed by #6040
Labels
bug Something isn't working

Comments

@Thunkar
Copy link
Contributor

Thunkar commented Sep 13, 2024

Aim

Quote an expression from a block expression, add it to a quote, unquote the whole thing as a new expression.

This is because the expression is an InternedStatement internally

Expected Behavior

The above should work

Bug

Compiler fails to parse the Expr:

Parsed expr Err(FailedToParseMacro {
error: ParserError { expected_tokens: {}, expected_labels: {Expression}, found: InternedStatement(InternedStatementKind(Index(0)))

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

Blocker

Blocker Context

No response

Nargo Version

No response

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@Thunkar Thunkar added the bug Something isn't working label Sep 13, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Sep 13, 2024
@jfecher jfecher changed the title Quoted Exprs fail to parse back into expressions Quoted Exprs from blocks fail to parse back into expressions Sep 13, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 13, 2024
# Description

## Problem\*

Resolves #6036

## Summary\*

Grego was having an issue from some macros where some code was taken
from a block and later put in the rhs of a `let` statement: `let _ =
$former_block_statement`. Since this expression originated from a block
statement though, it is a `Token::InternedStatement` and not a valid
expression.

I've updated the parser to accept interned statements in an expression
position, and we just later validate that they're either
`StatementKind::Expression` or `StatementKind::Semi` nodes.

## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Sep 13, 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.

1 participant