1
import scala.util.continuations._
4
def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) }
5
def caller = reset { println(p(3)) }
6
def caller2 = reset { println(p2(3)) }
8
def p(i: Int): Int @cpsParam[Unit, Any] = {
13
def p2(i: Int): Int @cpsParam[Unit, Any] = {
25
object Test extends App {
26
def foo(x:Int): Int @cps[Int] = shift { k => k(x) }
28
def bar(x:Int): Int @cps[Int] = return foo(x)
30
def nocps(x: Int): Int = { return x; x }
32
def foo2(x:Int): Int @cps[Int] = 7
33
def bar2(x:Int): Int @cps[Int] = { foo2(x); return 7 }
34
def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) }
35
def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) }
36
def bar5(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else 8 }
37
println(reset { bar2(10) })
38
println(reset { bar3(10) })
39
println(reset { bar4(10) })
40
println(reset { bar5(10) })
42
/* original test case */
43
val repro = new ReturnRepro