-
Notifications
You must be signed in to change notification settings - Fork 219
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
feat: Improved error message for unexpected return type #2302
Conversation
For totality, can you provide images of the before and after? |
before:
after (empty function):
after (non-empty function):
Perhaps it's necessary to store a span for the return type and point it specifically to this location, rather than just the function name. |
for comparison with Rust: noir:
rust:
probably need something like this |
Can you include that as part of this PR? Where this error message is generated we should have access to the function body which you can match on and get the location of the last expression if it is a block expression, or just get the location of the overall body if not. |
@f01dab1e can you give an updated before and after with the return type span? |
|
Some very good improvements to the error messages here |
* master: (34 commits) chore: move orphaned integration tests to new directory (#2331) chore(noir): Release 0.10.1 (#2328) feat(ssa): Switch mem2reg pass to be per function rather than per block (#2243) feat(ssa): Perform dead instruction elimination on intrinsic functions (#2276) feat: Add full call stacks to runtime errors (#2310) chore(ci): fix mismatched input name to publish workflow (#2327) chore: add README for integration test structure (#2277) feat: Improved error message for unexpected return type (#2302) feat(stdlib): Implement `str` `as_bytes` and `into_bytes` function (#2298) chore(ci): automatically convert changelog entries to sentence case (#2325) chore(noir): Release 0.10.0 (#2039) fix(lsp): Ensure lsp does not crawl past the root specified (#2322) fix: Prevent panic when passing relative paths to `--program-dir` (#2324) fix: Overflowing assignment will result in an error (#2321) chore: clippy fixes (#2320) chore: Parameterize the build mode for noir-wasm (#2317) chore: Make `wasm` tests pull from `result` directory (#2319) chore: Fix typo (#2315) chore: Reuse workspace target directory in wasm build script (#2312) feat(nargo): Add `--workspace` flag to run commands in every package (#2313) ...
* master: (25 commits) chore: update noir-source-resolver from `1.1.2` to `^1.1.3` (#2349) chore(ci): Avoid writing to cache in workflows triggered by the merge queue (#2341) chore(noir): Release 0.10.3 (#2344) feat(lsp): Add `Execute` code lens for `main` functions (#2330) feat(lsp): Add `Compile` code lens for `main` function and contracts (#2309) feat: Allow calling higher-order functions with closures (#2335) fix: Display warning if last expression of block is unused (#2314) chore(noir): Release 0.10.2 (#2343) fix: Prevent dead instruction elimination of brillig functions which may contain side-effects (#2340) chore: Separate integration tests for contracts and programs (#2339) chore: move orphaned integration tests to new directory (#2331) chore(noir): Release 0.10.1 (#2328) feat(ssa): Switch mem2reg pass to be per function rather than per block (#2243) feat(ssa): Perform dead instruction elimination on intrinsic functions (#2276) feat: Add full call stacks to runtime errors (#2310) chore(ci): fix mismatched input name to publish workflow (#2327) chore: add README for integration test structure (#2277) feat: Improved error message for unexpected return type (#2302) feat(stdlib): Implement `str` `as_bytes` and `into_bytes` function (#2298) chore(ci): automatically convert changelog entries to sentence case (#2325) ...
Description
better return type error message
Problem
Resolves #2105
PR Checklist
cargo fmt
on default settings.