Skip to content

Commit

Permalink
Fix for subtype pattern matching (#13178) (#13190)
Browse files Browse the repository at this point in the history
* tentative fix for pattern matching logic

* add test matrix

Co-authored-by: Don Syme <dsyme@users.noreply.github.com>
  • Loading branch information
vzarytovskii and dsyme authored May 24, 2022
1 parent 058e7a7 commit 211fd76
Show file tree
Hide file tree
Showing 2 changed files with 494 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/fsharp/PatternMatchCompilation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ let CompilePatternBasic
[]

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

match discrim with
| DecisionTreeTest.IsInst (_srcTy, tgtTy2) ->
match computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 with
match computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy2 tgtTy1 with
| Implication.Succeeds ->
match pbindOpt with
| Some pbind ->
Expand All @@ -1531,7 +1531,7 @@ let CompilePatternBasic
[frontier]

| DecisionTreeTest.IsNull _ ->
match computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy1 with
match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy1 with
| Implication.Succeeds -> [Frontier (i, newActives, valMap)]
| Implication.Fails -> []
| Implication.Nothing -> [frontier]
Expand All @@ -1548,7 +1548,7 @@ let CompilePatternBasic
| DecisionTreeTest.IsNull ->
[Frontier (i, newActives, valMap)]
| DecisionTreeTest.IsInst (_, tgtTy) ->
match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy with
match computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy with
| Implication.Succeeds -> [Frontier (i, newActives, valMap)]
| Implication.Fails -> []
| Implication.Nothing -> [frontier]
Expand Down
Loading

0 comments on commit 211fd76

Please sign in to comment.