-
Notifications
You must be signed in to change notification settings - Fork 832
Parser: add recovery for unfinished match clauses #10872
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
Conversation
|
@auduchinok , perhaps you could resolve the conflicts, and could we also have some kind of test. Kevin |
Fixes recovery for missing right hand sides: ``` match () with | x ```
110377c to
7bfec2c
Compare
1a9f12e to
fcef94f
Compare
12fe68d to
fcb54ab
Compare
653b462 to
2b82f1b
Compare
|
I'm not able to reproduce the desired behaviour in the remaining test, I am also unable to debug the test in neither Rider nor Visual Studio 2019, since there're some different issues when trying to build Salsa test project or its dependencies in both IDEs on my machine. |
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.
Added some comments
| | atomicPatterns | ||
| { SynArgPats.Pats $1 } | ||
| { let mWhole = rhs parseState 1 | ||
| let m = (mWhole.StartRange, $1) ||> unionRangeWithListBy (fun p -> p.Range) |
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.
maybe call this mAll
| [<Test>] | ||
| let ``Match clause 03 - When`` () = | ||
| let parseResults = getParseResults """ | ||
| match () with |
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.
Could you add a test for this, assuming it works?
match () with
| x
| _ -> ()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.
Also see if this recovers:
match () with
| x ->
| _ -> ()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.
Added both cases, both are green. 🙂
tests/service/Common.fs
Outdated
|
|
||
| let getSingleExprInModule (input: ParsedInput) = | ||
| match getSingleModuleLikeDecl input with | ||
| | SynModuleOrNamespace (decls = decls) -> |
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.
Would normally use
let (SynModuleOrNamespace (decls = decls)) = getSingleModuleLikeDecl inputThere 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.
Why not call getSingleModuleMemberDecls here?
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.
Why not call getSingleModuleMemberDecls here?
I think that's what I originally had wanted and didn't finish while were debugging the tests. Thanks, I'll update it.
Given the validation steps you did then we could consider disabling the test. I'll try to reproduce. |
|
Yay, all is green, sans the disabled test. |
|
Locally I just got this on this branch
So it is confusing. The test does however relate to the area that you're changing. Hmmm... |
| list = ["PrivateMethod"]) | ||
|
|
||
| [<Test>] | ||
| // [<Test>] |
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.
Best to use Disabled or Skip or whatever this test suite uses
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.
Sorry, I should've tried to use some attribute indeed. I looked at the code around and used the same approach.
|
I will merge this, partly because the error recovery implemented is far more useful that the very corner-case test (which may not be a true failure since we can't repro it locally) |
It was the VS test suite, not the FSharpQA one. Could you try that one too? |
The following examples will now produce match clauses (previously it'd fail and skip them):
The first case recovery and diagnostic improvements were done by @dsyme during our parser recovery session.