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

Parser: add recovery for missing fields after 'of' in union case #10708

Merged
merged 7 commits into from
Dec 20, 2020

Conversation

auduchinok
Copy link
Member

@auduchinok auduchinok commented Dec 14, 2020

Fixes parsing and subsequent analysis for unfinished union cases and exceptions like

type U =
    | A of

exception E of

Before:
Screenshot 2020-12-15 at 00 21 02

After:
Screenshot 2020-12-15 at 00 20 42

@auduchinok
Copy link
Member Author

auduchinok commented Dec 15, 2020

There's some tests failure, but tests got broken again, so I can't debug it: #10719

@cartermp
Copy link
Contributor

FCS tests pass, this one is an annoying timeout based one that seems to fail from time to time:

FSharp.Core.UnitTests.Control.AsyncModule.AwaitWaitHandle.Timeout

So restarting the PR or pushing a new change will probably have it resolve.

fsharpqa test failure looks like it's just a bad expectation, changing this:

//<Expects id="FS0042" span="(10,12-11,1)" status="warning">This construct is deprecated: it is only for use in the F# library</Expects>

to this:

-  span="(10,12-11,1)"
+  span="(10,12-12,24)"

should fix it I think. The fsharpqa logs at least show that this was the range reported with your PR, which looks more accurate.

@cartermp
Copy link
Contributor

grr, that should have done it. This is the failure log from CI:

+++ Conformance\BasicTypeAndModuleDefinitions\UnionTypes (W_UnionCaseProduction01.fsx) +++
--------------------------------------------------------
Results from hosted compiler
msg: Compiling
cmd: fsc   -a --test:ErrorRanges W_UnionCaseProduction01.fsx 
Exit code: 0
Error:     1
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
(10,12-10,24): warning FS0042: This construct is deprecated: it is only for use in the F# library
(10,12-10,24): warning FS0042: This construct is deprecated: it is only for use in the F# library
--------------------------------------------------------
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
(10,12-10,24): warning FS0042: This construct is deprecated: it is only for use in the F# library
(10,12-10,24): warning FS0042: This construct is deprecated: it is only for use in the F# library

*** The following necessary lines were never matched:
***	\(10,12-12,24\):.+warning FS0042:.+This construct is deprecated: it is only for use in the F# library


*** The following necessary lines were incorrectly matched:

Unexpected Compiler Output 
FAIL

Does that imply that the warning was given twice or something? I don't know how to read this (cc @KevinRansom @dsyme)

@auduchinok
Copy link
Member Author

OK, let's see if it helps (though, it's not expected indeed).

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be the one that actually does it if I'm reading the log correctly.

Although it's strange that we would get two diagnostics.

…s/UnionTypes/W_UnionCaseProduction01.fsx

Co-authored-by: Phillip Carter <[email protected]>
@cartermp cartermp merged commit 722757e into dotnet:main Dec 20, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
…net#10708)

* Parser: add recovery for missing fields after 'of' in union case

* Remove redundant opt_OBLOCKSEP

* Recover in exceptions too

* Fix test

* Update test baseline

* Add second warning

* Update tests/fsharpqa/Source/Conformance/BasicTypeAndModuleDefinitions/UnionTypes/W_UnionCaseProduction01.fsx

Co-authored-by: Phillip Carter <[email protected]>

Co-authored-by: Phillip Carter <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants