diff --git a/examples/pos/lambdalifting/nested.check b/examples/pos/lambdalifting/nested.check new file mode 100644 index 0000000000..6d3bb7b0cd --- /dev/null +++ b/examples/pos/lambdalifting/nested.check @@ -0,0 +1 @@ +Inner Handler! diff --git a/examples/pos/lambdalifting/nested.effekt b/examples/pos/lambdalifting/nested.effekt new file mode 100644 index 0000000000..8abb676b29 --- /dev/null +++ b/examples/pos/lambdalifting/nested.effekt @@ -0,0 +1,12 @@ +effect raise(): Int + + +def main() = + try { + val x = { + def f(n: Int): Int / {} = { do raise(); if (n == 0) { f(7) ; do raise() } else 4 } + f(1) + f(2) + } + println(x) + } with e1: raise { println("Inner Handler!") } diff --git a/examples/pos/lambdalifting/nestedif.check b/examples/pos/lambdalifting/nestedif.check new file mode 100644 index 0000000000..6d3bb7b0cd --- /dev/null +++ b/examples/pos/lambdalifting/nestedif.check @@ -0,0 +1 @@ +Inner Handler! diff --git a/examples/pos/lambdalifting/nestedif.effekt b/examples/pos/lambdalifting/nestedif.effekt new file mode 100644 index 0000000000..f0cbb4ca99 --- /dev/null +++ b/examples/pos/lambdalifting/nestedif.effekt @@ -0,0 +1,16 @@ +effect raise(): Int + + +def main() = + try { + val x = { + def f(n: Int): Int / {} = + { + val z = if (true) do raise() else { do raise() + 1 }; + z + } + val z = f(1); + f(2) + } + println(x) + } with e1: raise { println("Inner Handler!") } diff --git a/examples/pos/lambdalifting/patternmatching.check b/examples/pos/lambdalifting/patternmatching.check new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/examples/pos/lambdalifting/patternmatching.check @@ -0,0 +1 @@ +4 diff --git a/examples/pos/lambdalifting/patternmatching.effekt b/examples/pos/lambdalifting/patternmatching.effekt new file mode 100644 index 0000000000..631b0e281c --- /dev/null +++ b/examples/pos/lambdalifting/patternmatching.effekt @@ -0,0 +1,18 @@ +type Foo { + Bar(n: Int); + Baz() +} + +def consume(f: Foo) = { + val res = f match { + case Bar(n) => n + 1 + case Baz() => 0 + } + res * 2 +} + +def main() = { + val x = consume(Bar(1)); + val y = consume(Baz()); + println(x + y) +}