diff --git a/src/fsharp/TypedTreeOps.fs b/src/fsharp/TypedTreeOps.fs
index 2736d6f3e12..0e511a19646 100644
--- a/src/fsharp/TypedTreeOps.fs
+++ b/src/fsharp/TypedTreeOps.fs
@@ -5348,7 +5348,7 @@ and remapDecisionTree g compgen tmenv x =
| DecisionTreeTest.IsInst (srcty, tgty) -> DecisionTreeTest.IsInst (remapType tmenv srcty, remapType tmenv tgty)
| DecisionTreeTest.IsNull -> DecisionTreeTest.IsNull
| DecisionTreeTest.ActivePatternCase _ -> failwith "DecisionTreeTest.ActivePatternCase should only be used during pattern match compilation"
- | DecisionTreeTest.Error _ -> failwith "DecisionTreeTest.Error should only be used during pattern match compilation"
+ | DecisionTreeTest.Error(m) -> DecisionTreeTest.Error(m)
TCase(test', remapDecisionTree g compgen tmenv y)) csl,
Option.map (remapDecisionTree g compgen tmenv) dflt,
m)
diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
index 27f4cb4c6dd..74d960c1c92 100644
--- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
+++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
@@ -40,6 +40,7 @@
+
diff --git a/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs
new file mode 100644
index 00000000000..4e878fddae5
--- /dev/null
+++ b/tests/FSharp.Compiler.ComponentTests/Language/RegressionTests.fs
@@ -0,0 +1,21 @@
+// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
+
+namespace FSharp.Compiler.ComponentTests.Language
+
+open Xunit
+open FSharp.Test.Utilities.Compiler
+
+module RegressionTests =
+
+ []
+ let ``No internal errors should be raised``() =
+ FSharp """
+namespace FSharpBug
+
+type TestItemSeq =
+ static member Test1 item = item
+ static member Test2 item = match item with Typo2 x -> x
+ """
+ |> compile
+ |> withErrorCodes [39]
+ |> ignore