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

Parser can't handle call on block #7654

Closed
asterite opened this issue Mar 11, 2025 · 0 comments · Fixed by #7655
Closed

Parser can't handle call on block #7654

asterite opened this issue Mar 11, 2025 · 0 comments · Fixed by #7655
Assignees
Labels
bug Something isn't working

Comments

@asterite
Copy link
Collaborator

Aim

Apparently Rust supports this syntax:

fn main() -> i32 {
  { 1 }.abs()
}

That is, calling a method on a block. In Noir it gives a syntax error, but it should be allowed too.

(both Rust and Noir disallow other type of expressions after a block, for example making a function call like { 1 }(2, 3) because that could be a call or a block followed by a tuple, and both Rust and Noir default to the latter, but with method calls there's no ambiguity)

(found while working on #7613)

Expected Behavior

The above code should parse in Noir as well.

Bug

It gives a syntax error.

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

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

@asterite asterite added the bug Something isn't working label Mar 11, 2025
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Mar 11, 2025
@asterite asterite self-assigned this Mar 11, 2025
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Mar 11, 2025
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