-
Notifications
You must be signed in to change notification settings - Fork 252
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
fix(frontend): Remove chumsky fork, attempt 2 #1213
Conversation
if self.reason.as_deref() != Some("recovery failure") | ||
&& other.reason.as_deref() != Some("recovery failure") | ||
{ | ||
// We compare spans, except for errors for recovery, because the span for recovery does not match | ||
assert_eq!(self.span, other.span); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a workaround: since spans of the recovery failure alternative do not match the spans of other alternatives, only check that spans match if neither error comes from a recovery failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether we should drop recovery failures during this merging. They are meant to never be shown to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They should likely be dropped just in case, although I'm not aware of any time in which we ever merge a recovery error with a normal user-facing error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. A few suggestions:
Here is the description of the problem I encountered when looking into the CI failure: With recovery, empty lambda arguments (||) fail to parse. Chumsky prefers to parse "something that is a failure to parse nothing as something recovered to be something" over "nothing". This case happens with recovery within a repetition (.repeated()) or optionality (.or_not()). An issue is filed for Chumsky: zesterer/chumsky#159 The workaround is: get two variants of a parser of a sequence: first without recovery, second with a recovery. Put them as alternatives: failing without recovery, the variant with recovery will be attempted. |
@jfecher Recovery doesn't seem to work after adding the workaround:
|
@pczarn does this apply to most/all recovery or is it only not working for lambda parameters? How would you say parser error recovery in general looks like before & after this change - I haven't yet pulled the PR to test myself. I suppose I'm alright with removing lambda parameter recovery as long as other recovery is working since it shows there may be a path to fixing it, but if recovery all around is worse then it is more difficult. |
For function parameter recovery: Unaffected since parameter types are mandatory, so there is always at least a colon present and no need to worry about an empty parameter list. We do not currently recover for garbage with a missing colon. For block statement recovery: unclear why an empty block is unaffected. No other places where a recovery is covered by optionality. Only one more place where a recovery is used. |
Closing this since it has become stale. I can revisit it after confirming there have been bugfixes to chumsky to fix the changed parser recovery strategies. |
Related issue
Resolves #853
Description
Summary of changes
Replace recovier_via of the chumsky fork with skip_parser from chumsky 0.9.2.
Dependency additions / changes
Test additions / changes
None.
Checklist
cargo fmt
with default settings.Documentation needs
Additional context