1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 14:13:27 +03:00
juvix/tests/Compilation/negative/test007.juvix
Łukasz Czajka 68a79bc8a8
Detect redundant patterns (#3101)
* Closes #3008
* Implements the algorithm from [Luc Maranget, Warnings for Pattern
Matching](https://www.cambridge.org/core/services/aop-cambridge-core/content/view/3165B75113781E2431E3856972940347/S0956796807006223a.pdf/warnings-for-pattern-matching.pdf)
to detect redundant patterns.
* Adds an option to the Core pretty printer to print match patterns in a
user-friendly format consistent with pattern syntax in Juvix frontend
language.
2024-10-30 11:38:22 +01:00

11 lines
161 B
Plaintext

module test007;
import Stdlib.Prelude open;
f (x : List Nat) : Nat :=
case x of
| nil := 0
| x :: _ if x > 0 := x;
main : Nat := f (1 :: 2 :: nil);