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

Regression: Strange behavior with labels and error messages #656

Open
ThePuzzlemaker opened this issue Aug 3, 2024 · 0 comments
Open

Regression: Strange behavior with labels and error messages #656

ThePuzzlemaker opened this issue Aug 3, 2024 · 0 comments

Comments

@ThePuzzlemaker
Copy link

I apologize that I wasn't able to minimize this one.

Here's the code.
Additionally, here's the code that calls the parser:

    let (items, parse_errs) = parse::item()
        .separated_by(parse::maybe_nls())
        .collect::<Vec<_>>()
        .then_ignore(end())
        .parse_with_state(stream, &mut &*gcx)
        .into_output_errors();

With this input:

fn invalid_syntax_here() -> fn true -> 0

As of bbb0d70, this error is generated:

Error: Unexpected token `true`, expected: number, `true`, `false`, `-`, `!`, `(`
   ╭─[<input>:1:32]
   │
 1 │ fn invalid_syntax_here() -> fn true -> 0
   │                                ──┬─  
   │                                  ╰─── didn't expect this token
───╯

Before 6837537, this error is generated, which is sensible (as true cannot possibly match in this context):

Error: Unexpected token `true`, expected: `(`, expression
   ╭─[<input>:1:32]
   │
 1 │ fn invalid_syntax_here() -> fn true -> 0
   │                                ──┬─  
   │                                  ╰─── didn't expect this token
───╯

This line of code is to blame; reverting this one-line change returns to the original behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant