fsharp
fsharp copied to clipboard
Recover unfinished binary expressions
Adds parser recovery for unfinished binary app expressions that have their right operand missing and that are placed before other declarations or before the end of file.
End of file:
1 +
Before type decl:
1 +
type T = int
Before attributes in a decl:
1 +
[<Attr>]
let x = 1
Thanks to @dsyme for guiding me on where to look at.
I'll start adding new tests when the existing ones are green.
The following case got broken:
let f
(
a,
[<A>] b
) = ()
I'm (hopefully, temporarily) undoing the before-[<
recovery to see if anything else gets broken.
@auduchinok hey there, would you like to continue on that? I can help with resolving conflicts if needed. Also, probably some testing would be useful here.
@psfinaki Yes, I'm going to get back to it. Perhaps I'll need to rethink the approach here... I'll resolve the conflicts myself, thanks!
@auduchinok, thanks, reach out if you need any help!
This has been superseded by https://github.com/dotnet/fsharp/pull/15255 and https://github.com/dotnet/fsharp/pull/15334.
The situation with top-level expressions (i.e. at the module scope) is not as good as I'd want it to be, but it'd be really difficult to change it. The good news are local binary expressions seem to be much more common and PRs above improve the recovery very noticeably for them.