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

Better return type error message #2105

Closed
rahul-kothari opened this issue Aug 1, 2023 · 2 comments · Fixed by #2302
Closed

Better return type error message #2105

rahul-kothari opened this issue Aug 1, 2023 · 2 comments · Fixed by #2302
Assignees
Labels
enhancement New feature or request

Comments

@rahul-kothari
Copy link

Problem

image

Happens when I write:

fn lotsofRead() -> pub Field {
....
// I return nothing!
}

Happy Case

Could be Expected return type Field, but a value of type () was actually returned

Alternatives Considered

No response

Additional Context

No response

Would you like to submit a PR for this Issue?

No

Support Needs

No response

@rahul-kothari rahul-kothari added the enhancement New feature or request label Aug 1, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Aug 1, 2023
@kevaundray
Copy link
Contributor

@f01dab1e can you take this on?

@kevaundray kevaundray self-assigned this Aug 8, 2023
@ghost
Copy link

ghost commented Aug 11, 2023

maybe add an annotation like in Rust:

  |
1 | fn lotsofRead() -> usize {
  |    ----------      ^^^^^ expected `usize`, found `()`
  |    |
  |    implicitly returns `()` as its body has no tail or `return` expression

@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants