Skip to content

Commit

Permalink
Able to remap DecisionTreeTest.Error (#10187)
Browse files Browse the repository at this point in the history
  • Loading branch information
TIHan committed Sep 26, 2020
1 parent 903ba29 commit 81d1d91
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fsharp/TypedTreeOps.fs
Expand Up @@ -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)
Expand Down
Expand Up @@ -40,6 +40,7 @@
<Compile Include="ErrorMessages\WarnExpressionTests.fs" />
<Compile Include="ErrorMessages\WrongSyntaxInForLoop.fs" />
<Compile Include="ErrorMessages\ConfusingTypeName.fs" />
<Compile Include="Language\RegressionTests.fs" />
<Compile Include="Language\XmlComments.fs" />
<Compile Include="Language\CompilerDirectiveTests.fs" />
<Compile Include="Language\CodeQuotationTests.fs" />
Expand Down
21 changes: 21 additions & 0 deletions 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 =

[<Fact>]
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

0 comments on commit 81d1d91

Please sign in to comment.