mirror of
https://github.com/anoma/juvix.git
synced 2025-01-07 16:22:14 +03:00
186f4f66ef
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
24 lines
477 B
Plaintext
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;
|