noir icon indicating copy to clipboard operation
noir copied to clipboard

Parse block test fails with uninformative message

Open michaeljklein opened this issue 10 months ago • 5 comments

Aim

The parse_all_failing tests in parse_block include a test case with a message where the expected and found tokens are both empty, defaulting to EOF.

By modifying the following, it's possible to see that it fails with an opaque error. (i.e. the 'expected' and 'found' are both empty)

// src/parser/errors.rs
impl chumsky::Error<Token> for ParserError {
    fn expected_input_found<Iter>(span: Self::Span, expected: Iter, found: Option<Token>) -> Self

Expected Behavior

Return an error that explains what went wrong

Bug

Error is appx. expected token EOF while found EOF. Inspecting the expected/found tokens shows both are empty. Likely due to

To Reproduce

Run the mentioned test and modify expected_input_found to panic when both expected and found are empty.

Project Impact

Nice-to-have

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Installation Method

None

Nargo Version

No response

NoirJS Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

michaeljklein avatar Apr 09 '24 15:04 michaeljklein