The following code creates the errors FS0192, FS0073 and again FS0192 in VS IDE Preview. I found this while creating a repro for the "40 min delay during between keystrokes"-bug (see #9201). This may be a regression, as earlier versions of VS 2019 do not exhibit this behavior.
```f#
namespace FSharpBug
type TestItemSeq =
static member foo item = item
static member bar item = match item with Typo2 x -> x

When compiling, it shows:
1>D:\Projects\FSharpBug9201\BaseForTest.fs(5,46): error FS0039: The pattern discriminator 'Typo2' is not defined.
1>D:\Projects\FSharpBug9201\BaseForTest.fs(5,36): warning FS0025: Incomplete pattern matches on this expression.
1>typecheck error FS0192: error : DecisionTreeTest.Error should only be used during pattern match compilation
1>typecheck error FS0073: error : DecisionTreeTest.Error should only be used during pattern match compilation (Failure)
1>parameter error FS0192: error : DecisionTreeTest.Error should only be used during pattern match compilation
```
The first error is expected, the warning is surprising, it normally doesn't show when the line has an error. The latter three errors are certainly unexpected ;).
FSC does not show this behavior, nor do earlier non-preview versions of the VS IDE.
Repro steps
*.fs file. Expected behavior
Only two errors should be shown.
Actual behavior
Three internal errors are also shown. Internal errors are generally unexpected and, I believe, typically mean that something is wrong with the compiler. The internal errors are:
typecheck error FS0192: error : DecisionTreeTest.Error should only be used during pattern match compilation
typecheck error FS0073: error : DecisionTreeTest.Error should only be used during pattern match compilation (Failure)
parameter error FS0192: error : DecisionTreeTest.Error should only be used during pattern match compilation
Known workarounds
If you fix the typo in your code, the internal error disappears. I noticed this behavior most prominently when doing solution-wide renames. Since the Rename Feature doesn't catch all cases, it can lead to this error. Above code is the smallest repro I could find.
Related information
static member foo.EDIT: it seems remarkably similar to this line, but the text is slightly different: https://github.com/dotnet/fsharp/blob/be621d8725e3ea88cb832f4d457bc0bf377172ed/src/fsharp/TypedTreePickle.fs#L2406
@abelbraaksma The assertion error was introduced in #7711 and there was no reports about it up until very recently.
I didn't manage to find a stable repro yet, so thank you so much for it, I can reliably reproduce it in Rider too (which presumably uses FCS that is similar to FCP in Visual Studio you're using), and I'm going to look into it.
Thanks @auduchinok!
@auduchinok have you had a chance to look into this?
@cartermp I've looked into it once but didn't find the cause. I'm going to try again during this release cycle. I've also found new cases where recovery is missing in pattern matching, and perhaps digging deeper into it can help finding what's going wrong.
Great to have this solved! Thanks @TIHan.
Most helpful comment
@abelbraaksma The assertion error was introduced in #7711 and there was no reports about it up until very recently.
I didn't manage to find a stable repro yet, so thank you so much for it, I can reliably reproduce it in Rider too (which presumably uses FCS that is similar to FCP in Visual Studio you're using), and I'm going to look into it.