unison/unison-src/tests/fix1640.u

26 lines
598 B
Plaintext
Raw Normal View History

2020-07-29 16:31:38 +03:00
unique type Color = Red | Black
unique type RBTree a = Leaf | Tree Color (RBTree a) a (RBTree a)
-- interesting, this typechecks fine
2020-07-29 16:31:38 +03:00
isRed = cases
Color.Red -> true
Color.Black -> false
-- as does this
RBTree.isRed1 = cases
RBTree.Tree _ _ _ _ -> true
_ -> false
-- but this did not (before this fix)
2020-07-29 16:31:38 +03:00
RBTree.isRed = cases
RBTree.Tree Color.Red _ _ _ -> true
_ -> false
-- In fixing this bug, I noticed that the parser would previously reject
-- this perfectly cromulent pattern match, so I fixed that too.
thisIsTotallyLegit = cases
[RBTree.Tree _ _ _ _] -> true
_ -> false