Skip to content

Commit

Permalink
Add new failing test case for 048 (clause guards)
Browse files Browse the repository at this point in the history
  It seems like we don't properly handle clause guards for wildcard
  patterns. Seems like a codegen issue here as the code type-check
  properly.
  • Loading branch information
KtorZ authored and MicroProofs committed Mar 21, 2023
1 parent bb820eb commit 8c56f47
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions examples/acceptance_tests/048/lib/tests.ak
Expand Up @@ -45,3 +45,25 @@ test foo_4() {
False
}
}

type Seasons {
Winter
Spring
Summer
Fall
}

fn is_cold(season, hour) {
when season is {
Winter | Fall ->
True
_ if hour >= 18 ->
True
_ ->
False
}
}

test foo_5() {
!is_cold(Spring, 15) && is_cold(Summer, 22)
}
4 changes: 2 additions & 2 deletions examples/acceptance_tests/048/validators/foo.ak
@@ -1,12 +1,12 @@
fn when_tuple(a: (Int, Int)) -> Int {
when a is {
(a, b) ->
(a, _b) ->
a
}
}

validator {
fn spend(a: Data, b: Data, c) -> Bool {
fn spend(a: Data, b: Data, _c) -> Bool {
when_tuple((4, 1)) == 4
}
}

0 comments on commit 8c56f47

Please sign in to comment.