Skip to content

Commit 211fd76

Browse files
vzarytovskiidsyme
andauthored
Fix for subtype pattern matching (#13178) (#13190)
* tentative fix for pattern matching logic * add test matrix Co-authored-by: Don Syme <[email protected]>
1 parent 058e7a7 commit 211fd76

File tree

2 files changed

+494
-4
lines changed

2 files changed

+494
-4
lines changed

src/fsharp/PatternMatchCompilation.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ let CompilePatternBasic
14951495
[]
14961496

14971497
| DecisionTreeTest.IsNull _ ->
1498-
match computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy1 with
1498+
match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy1 with
14991499
| Implication.Succeeds -> [Frontier (i, newActives, valMap)]
15001500
| Implication.Fails -> []
15011501
| Implication.Nothing -> [frontier]
@@ -1509,7 +1509,7 @@ let CompilePatternBasic
15091509

15101510
match discrim with
15111511
| DecisionTreeTest.IsInst (_srcTy, tgtTy2) ->
1512-
match computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 with
1512+
match computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy2 tgtTy1 with
15131513
| Implication.Succeeds ->
15141514
match pbindOpt with
15151515
| Some pbind ->
@@ -1531,7 +1531,7 @@ let CompilePatternBasic
15311531
[frontier]
15321532

15331533
| DecisionTreeTest.IsNull _ ->
1534-
match computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy1 with
1534+
match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy1 with
15351535
| Implication.Succeeds -> [Frontier (i, newActives, valMap)]
15361536
| Implication.Fails -> []
15371537
| Implication.Nothing -> [frontier]
@@ -1548,7 +1548,7 @@ let CompilePatternBasic
15481548
| DecisionTreeTest.IsNull ->
15491549
[Frontier (i, newActives, valMap)]
15501550
| DecisionTreeTest.IsInst (_, tgtTy) ->
1551-
match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy with
1551+
match computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy with
15521552
| Implication.Succeeds -> [Frontier (i, newActives, valMap)]
15531553
| Implication.Fails -> []
15541554
| Implication.Nothing -> [frontier]

0 commit comments

Comments
 (0)