Skip to content

Commit

Permalink
dotnet#6928 - WIP - Removed SByte, Byte, Int16, UInt16 from default c…
Browse files Browse the repository at this point in the history
…ase requirement and add check for complete match similar to the one executed for bool.
  • Loading branch information
gdziadkiewicz committed Aug 21, 2019
1 parent 6558b7d commit e2bd926
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/fsharp/PatternMatchCompilation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -528,11 +528,7 @@ let (|ConstNeedsDefaultCase|_|) c =
| Const.Decimal _
| Const.String _
| Const.Single _
| Const.Double _
| Const.SByte _
| Const.Byte _
| Const.Int16 _
| Const.UInt16 _
| Const.Double _
| Const.Int32 _
| Const.UInt32 _
| Const.Int64 _
Expand Down Expand Up @@ -1081,9 +1077,12 @@ 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.Int16 _) :: _ when simulSetOfCases.Length = 65536 -> None
| DecisionTreeTest.Const (Const.UInt16 _) :: _ when simulSetOfCases.Length = 65536 -> 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

0 comments on commit e2bd926

Please sign in to comment.