1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-07 16:22:14 +03:00
juvix/tests/Compilation/positive/test013.juvix
Łukasz Czajka 186f4f66ef
Tests for the new compilation pipeline (#1703)
Adds Juvix tests for the compilation pipeline - these are converted from
the JuvixCore tests (those that make sense). Currently, only the
translation from Juvix to JuvixCore is checked for the tests that can be
type-checked. Ultimately, the entire compilation pipeline down to native
code / WebAssembly should be checked on these tests.

Closes #1689
2023-01-12 11:22:32 +01:00

24 lines
477 B
Plaintext

-- functions returning functions with variable capture
module test013;
open import Stdlib.Prelude;
open import Stdlib.Data.Nat.Ord;
f : Nat → Nat → Nat;
f x := if (x == 6)
λ{_ := 0}
(if (x == 5)
λ{_ := 1}
(if (x == 10)
λ{_ := λ{x := x} 2}
λ{x := x}));
main : IO;
main :=
printNatLn (f 5 6) >>
printNatLn (f 6 5) >>
printNatLn (f 10 5) >>
printNatLn (f 11 5);
end;