Skip to content

Commit

Permalink
dotnet#6928 - Removed SByte and Byte from default case requirement an…
Browse files Browse the repository at this point in the history
…d added check for complete match.
  • Loading branch information
gdziadkiewicz committed Aug 24, 2019
1 parent f5a8360 commit 67406ec
Show file tree
Hide file tree
Showing 3 changed files with 540 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/fsharp/PatternMatchCompilation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,7 @@ let (|ConstNeedsDefaultCase|_|) c =
| Const.Decimal _
| Const.String _
| Const.Single _
| Const.Double _
| Const.SByte _
| Const.Byte _
| Const.Double _
| Const.Int16 _
| Const.UInt16 _
| Const.Int32 _
Expand Down Expand Up @@ -1081,9 +1079,10 @@ let CompilePatternBasic
match getDiscrimOfPattern p with
| Some discrim -> List.exists (isDiscrimSubsumedBy g amap exprm discrim) simulSetOfDiscrims
| None -> false

match simulSetOfDiscrims with
| DecisionTreeTest.Const (Const.Bool _b) :: _ when simulSetOfCases.Length = 2 -> None
| DecisionTreeTest.Const (Const.Byte _) :: _ when simulSetOfCases.Length = 256 -> None
| DecisionTreeTest.Const (Const.SByte _) :: _ when simulSetOfCases.Length = 256 -> None
| DecisionTreeTest.Const (Const.Unit) :: _ -> None
| DecisionTreeTest.UnionCase (ucref, _) :: _ when simulSetOfCases.Length = ucref.TyconRef.UnionCasesArray.Length -> None
| DecisionTreeTest.ActivePatternCase _ :: _ -> error(InternalError("DecisionTreeTest.ActivePatternCase should have been eliminated", matchm))
Expand Down
Loading

0 comments on commit 67406ec

Please sign in to comment.