Skip to content

Commit

Permalink
eval test for match side-conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Jan 30, 2025
1 parent 9a37076 commit 7cfa465
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
6 changes: 1 addition & 5 deletions test/Core/Eval/Negative.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,5 @@ tests =
NegTest
"Erroneous Church numerals"
$(mkRelDir ".")
$(mkRelFile "test009.jvc"),
NegTest
"Empty letrec"
$(mkRelDir ".")
$(mkRelFile "test010.jvc")
$(mkRelFile "test009.jvc")
]
7 changes: 6 additions & 1 deletion test/Core/Eval/Positive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -367,5 +367,10 @@ tests =
"Test065: Let / LetRec type inference"
$(mkRelDir ".")
$(mkRelFile "test065.jvc")
$(mkRelFile "out/test065.out")
$(mkRelFile "out/test065.out"),
PosTest
"Test066: Match side-conditions"
$(mkRelDir ".")
$(mkRelFile "test066.jvc")
$(mkRelFile "out/test066.out")
]
1 change: 1 addition & 0 deletions tests/Core/positive/out/test066.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8
17 changes: 17 additions & 0 deletions tests/Core/positive/test066.jvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
type Unit {
unit : Unit;
};

type Box {
box : Any -> Box;
};

def f := \x
match box 9, x, unit with {
box z, box y, unit if y < z := 1;
box z, box y, unit if y = z + 1 := 0;
box z, box y, unit if y > z := 10;
_, _, _ := 11;
};

3 * f (box 11) * f (box 7) - f (box 10) - 2 * f (box 9)

0 comments on commit 7cfa465

Please sign in to comment.