-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Better errors for missing
fn
keyword (#4154)
# Description Using `force(just(Token::EOF))` to ensure the whole file is parsed appears to hide the module error. ## Problem\* Resolves #3768 ## Summary\* Before: ```bash ❯ cargo run build error: Parser: expected an end of input but found #[aztec(private)] ┌─ /Users/michaelklein/Coding/rust/noir/test_programs/compile_failure/no_fn_keyword/src/main.nr:1:1 │ 1 │ #[aztec(private)] │ ----------------- │ Aborting due to 1 previous error ``` After: ```bash error: Unexpected main, expected one of fn, internal, open, pub, struct, unconstrained, Attribute ┌─ /Users/michaelklein/Coding/rust/noir/test_programs/compile_failure/no_fn_keyword/src/main.nr:2:1 │ 2 │ main() { │ ---- │ Aborting due to 1 previous error ``` ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[Exceptional Case]** 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. --------- Co-authored-by: jfecher <jake@aztecprotocol.com>
- Loading branch information
1 parent
4421ce4
commit 057c208
Showing
1 changed file
with
16 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters