diff options
Diffstat (limited to 'test/files/continuations-run')
77 files changed, 0 insertions, 1227 deletions
diff --git a/test/files/continuations-run/basics.check b/test/files/continuations-run/basics.check deleted file mode 100755 index 54c059fdcb..0000000000 --- a/test/files/continuations-run/basics.check +++ /dev/null @@ -1,2 +0,0 @@ -28 -28
\ No newline at end of file diff --git a/test/files/continuations-run/basics.scala b/test/files/continuations-run/basics.scala deleted file mode 100755 index b63710bc64..0000000000 --- a/test/files/continuations-run/basics.scala +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def m0() = { - shift((k:Int => Int) => k(k(7))) * 2 - } - - def m1() = { - 2 * shift((k:Int => Int) => k(k(7))) - } - - def main(args: Array[String]) = { - - println(reset(m0())) - println(reset(m1())) - - } - -} diff --git a/test/files/continuations-run/function1.check b/test/files/continuations-run/function1.check deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/files/continuations-run/function1.check +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/files/continuations-run/function1.scala b/test/files/continuations-run/function1.scala deleted file mode 100644 index fbd413ed9d..0000000000 --- a/test/files/continuations-run/function1.scala +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Any = { - - val f = () => shift { k: (Int=>Int) => k(7) } - val g: () => Int @cps[Int] = f - - println(reset(g())) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/function4.check b/test/files/continuations-run/function4.check deleted file mode 100644 index c7930257df..0000000000 --- a/test/files/continuations-run/function4.check +++ /dev/null @@ -1 +0,0 @@ -7
\ No newline at end of file diff --git a/test/files/continuations-run/function4.scala b/test/files/continuations-run/function4.scala deleted file mode 100644 index 2ccd0b4ff2..0000000000 --- a/test/files/continuations-run/function4.scala +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Any = { - - val g: () => Int @cps[Int] = () => shift { k: (Int=>Int) => k(7) } - - println(reset(g())) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/function5.check b/test/files/continuations-run/function5.check deleted file mode 100644 index c7930257df..0000000000 --- a/test/files/continuations-run/function5.check +++ /dev/null @@ -1 +0,0 @@ -7
\ No newline at end of file diff --git a/test/files/continuations-run/function5.scala b/test/files/continuations-run/function5.scala deleted file mode 100644 index fe528e14e7..0000000000 --- a/test/files/continuations-run/function5.scala +++ /dev/null @@ -1,15 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Any = { - - val g: () => Int @cps[Int] = () => 7 - - println(reset(g())) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/function6.check b/test/files/continuations-run/function6.check deleted file mode 100644 index c7930257df..0000000000 --- a/test/files/continuations-run/function6.check +++ /dev/null @@ -1 +0,0 @@ -7
\ No newline at end of file diff --git a/test/files/continuations-run/function6.scala b/test/files/continuations-run/function6.scala deleted file mode 100644 index 54a6ffcc93..0000000000 --- a/test/files/continuations-run/function6.scala +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def main(args: Array[String]): Any = { - - val g: PartialFunction[Int, Int @cps[Int]] = { case x => 7 } - - println(reset(g(2))) - - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/ifelse0.check b/test/files/continuations-run/ifelse0.check deleted file mode 100644 index f8bc79860d..0000000000 --- a/test/files/continuations-run/ifelse0.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -9
\ No newline at end of file diff --git a/test/files/continuations-run/ifelse0.scala b/test/files/continuations-run/ifelse0.scala deleted file mode 100644 index 2facab4b98..0000000000 --- a/test/files/continuations-run/ifelse0.scala +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x:Int) = if (x <= 7) - shift { k: (Int=>Int) => k(k(k(x))) } - else - shift { k: (Int=>Int) => k(x) } - - def main(args: Array[String]): Any = { - println(reset(1 + test(7))) - println(reset(1 + test(8))) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/ifelse1.check b/test/files/continuations-run/ifelse1.check deleted file mode 100644 index 86a3fbc0c1..0000000000 --- a/test/files/continuations-run/ifelse1.check +++ /dev/null @@ -1,4 +0,0 @@ -10 -9 -8 -11
\ No newline at end of file diff --git a/test/files/continuations-run/ifelse1.scala b/test/files/continuations-run/ifelse1.scala deleted file mode 100644 index c624b84b75..0000000000 --- a/test/files/continuations-run/ifelse1.scala +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test1(x:Int) = if (x <= 7) - shift { k: (Int=>Int) => k(k(k(x))) } - else - x - - def test2(x:Int) = if (x <= 7) - x - else - shift { k: (Int=>Int) => k(k(k(x))) } - - def main(args: Array[String]): Any = { - println(reset(1 + test1(7))) - println(reset(1 + test1(8))) - println(reset(1 + test2(7))) - println(reset(1 + test2(8))) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/ifelse2.check b/test/files/continuations-run/ifelse2.check deleted file mode 100644 index f97a95b08d..0000000000 --- a/test/files/continuations-run/ifelse2.check +++ /dev/null @@ -1,4 +0,0 @@ -abort -() -alive -() diff --git a/test/files/continuations-run/ifelse2.scala b/test/files/continuations-run/ifelse2.scala deleted file mode 100644 index 506acc4d00..0000000000 --- a/test/files/continuations-run/ifelse2.scala +++ /dev/null @@ -1,16 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x:Int) = if (x <= 7) - shift { k: (Unit=>Unit) => println("abort") } - - def main(args: Array[String]): Any = { - println(reset{ test(7); println("alive") }) - println(reset{ test(8); println("alive") }) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/ifelse3.check b/test/files/continuations-run/ifelse3.check deleted file mode 100644 index 95b562c8e6..0000000000 --- a/test/files/continuations-run/ifelse3.check +++ /dev/null @@ -1,2 +0,0 @@ -6 -9 diff --git a/test/files/continuations-run/ifelse3.scala b/test/files/continuations-run/ifelse3.scala deleted file mode 100644 index 54566a421c..0000000000 --- a/test/files/continuations-run/ifelse3.scala +++ /dev/null @@ -1,21 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def util(x: Boolean) = shift { k: (Boolean=>Int) => k(x) } - - def test(x:Int) = if (util(x <= 7)) - x - 1 - else - x + 1 - - - def main(args: Array[String]): Any = { - println(reset(test(7))) - println(reset(test(8))) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/ifelse4.check b/test/files/continuations-run/ifelse4.check deleted file mode 100644 index 2545dd49a0..0000000000 --- a/test/files/continuations-run/ifelse4.check +++ /dev/null @@ -1,4 +0,0 @@ -10 -10 -10 -10 diff --git a/test/files/continuations-run/ifelse4.scala b/test/files/continuations-run/ifelse4.scala deleted file mode 100644 index 8360375283..0000000000 --- a/test/files/continuations-run/ifelse4.scala +++ /dev/null @@ -1,31 +0,0 @@ -import scala.util.continuations._ - -object Test { - def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1)))) - - def testA(x1: Int): Int @cps[Int] = { - sh(x1) - if (x1==42) x1 else sh(x1) - } - - def testB(x1: Int): Int @cps[Int] = { - if (sh(x1)==43) x1 else x1 - } - - def testC(x1: Int): Int @cps[Int] = { - sh(x1) - if (sh(x1)==44) x1 else x1 - } - - def testD(x1: Int): Int @cps[Int] = { - sh(x1) - if (sh(x1)==45) x1 else sh(x1) - } - - def main(args: Array[String]): Any = { - println(reset(1 + testA(7))) - println(reset(1 + testB(9))) - println(reset(1 + testC(9))) - println(reset(1 + testD(7))) - } -}
\ No newline at end of file diff --git a/test/files/continuations-run/infer1.scala b/test/files/continuations-run/infer1.scala deleted file mode 100644 index 10822508e7..0000000000 --- a/test/files/continuations-run/infer1.scala +++ /dev/null @@ -1,33 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x: => Int @cpsParam[String,Int]) = 7 - - def test2() = { - val x = shift { k: (Int => String) => 9 } - x - } - - def test3(x: => Int @cpsParam[Int,Int]) = 7 - - - def util() = shift { k: (String => String) => "7" } - - def main(args: Array[String]): Any = { - test { shift { k: (Int => String) => 9 } } - test { shift { k: (Int => String) => 9 }; 2 } -// test { shift { k: (Int => String) => 9 }; util() } <-- doesn't work - test { shift { k: (Int => String) => 9 }; util(); 2 } - - - test { shift { k: (Int => String) => 9 }; { test3(0); 2 } } - - test3 { { test3(0); 2 } } - - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/match0.check b/test/files/continuations-run/match0.check deleted file mode 100644 index f8bc79860d..0000000000 --- a/test/files/continuations-run/match0.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -9
\ No newline at end of file diff --git a/test/files/continuations-run/match0.scala b/test/files/continuations-run/match0.scala deleted file mode 100644 index b65d343c07..0000000000 --- a/test/files/continuations-run/match0.scala +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x:Int) = x match { - case 7 => shift { k: (Int=>Int) => k(k(k(x))) } - case 8 => shift { k: (Int=>Int) => k(x) } - } - - def main(args: Array[String]): Any = { - println(reset(1 + test(7))) - println(reset(1 + test(8))) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/match1.check b/test/files/continuations-run/match1.check deleted file mode 100644 index 73053d3f4f..0000000000 --- a/test/files/continuations-run/match1.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -9 diff --git a/test/files/continuations-run/match1.scala b/test/files/continuations-run/match1.scala deleted file mode 100644 index 20671f26ba..0000000000 --- a/test/files/continuations-run/match1.scala +++ /dev/null @@ -1,18 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test(x:Int) = x match { - case 7 => shift { k: (Int=>Int) => k(k(k(x))) } - case _ => x - } - - def main(args: Array[String]): Any = { - println(reset(1 + test(7))) - println(reset(1 + test(8))) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/match2.check b/test/files/continuations-run/match2.check deleted file mode 100644 index cbf91349cc..0000000000 --- a/test/files/continuations-run/match2.check +++ /dev/null @@ -1,2 +0,0 @@ -B -B diff --git a/test/files/continuations-run/match2.scala b/test/files/continuations-run/match2.scala deleted file mode 100644 index 5092ce3abe..0000000000 --- a/test/files/continuations-run/match2.scala +++ /dev/null @@ -1,26 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def test1() = { - val (a, b) = shift { k: (((String,String)) => String) => k("A","B") } - b - } - - case class Elem[T,U](a: T, b: U) - - def test2() = { - val Elem(a,b) = shift { k: (Elem[String,String] => String) => k(Elem("A","B")) } - b - } - - - def main(args: Array[String]): Unit = { - println(reset(test1())) - println(reset(test2())) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/patvirt.check b/test/files/continuations-run/patvirt.check deleted file mode 100644 index b5fa014ad3..0000000000 --- a/test/files/continuations-run/patvirt.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -11 diff --git a/test/files/continuations-run/patvirt.scala b/test/files/continuations-run/patvirt.scala deleted file mode 100644 index 5b4d312f20..0000000000 --- a/test/files/continuations-run/patvirt.scala +++ /dev/null @@ -1,32 +0,0 @@ -import scala.util.continuations._ - -object Test { - def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1)))) - - def test(x1: Int) = { - val o7 = { - val o6 = { - val o3 = - if (7 == x1) Some(x1) - else None - - if (o3.isEmpty) None - else Some(sh(x1)) - } - if (o6.isEmpty) { - val o5 = - if (8 == x1) Some(x1) - else None - - if (o5.isEmpty) None - else Some(sh(x1)) - } else o6 - } - o7.get - } - - def main(args: Array[String]): Any = { - println(reset(1 + test(7))) - println(reset(1 + test(8))) - } -} diff --git a/test/files/continuations-run/shift-pct.check b/test/files/continuations-run/shift-pct.check deleted file mode 100644 index fb190e770a..0000000000 --- a/test/files/continuations-run/shift-pct.check +++ /dev/null @@ -1,25 +0,0 @@ -d = 1, d2 = 1.0, pct = 1.000 -d = 2, d2 = 4.0, pct = 0.500 -d = 3, d2 = 9.0, pct = 0.333 -d = 4, d2 = 16.0, pct = 0.250 -d = 5, d2 = 25.0, pct = 0.200 -d = 6, d2 = 36.0, pct = 0.167 -d = 7, d2 = 49.0, pct = 0.143 -d = 8, d2 = 64.0, pct = 0.125 -d = 9, d2 = 81.0, pct = 0.111 -d = 10, d2 = 100.0, pct = 0.100 -d = 11, d2 = 121.0, pct = 0.091 -d = 12, d2 = 144.0, pct = 0.083 -d = 13, d2 = 169.0, pct = 0.077 -d = 14, d2 = 196.0, pct = 0.071 -d = 15, d2 = 225.0, pct = 0.067 -d = 16, d2 = 256.0, pct = 0.063 -d = 17, d2 = 289.0, pct = 0.059 -d = 18, d2 = 324.0, pct = 0.056 -d = 19, d2 = 361.0, pct = 0.053 -d = 20, d2 = 400.0, pct = 0.050 -d = 21, d2 = 441.0, pct = 0.048 -d = 22, d2 = 484.0, pct = 0.045 -d = 23, d2 = 529.0, pct = 0.043 -d = 24, d2 = 576.0, pct = 0.042 -d = 25, d2 = 625.0, pct = 0.040 diff --git a/test/files/continuations-run/shift-pct.scala b/test/files/continuations-run/shift-pct.scala deleted file mode 100644 index 7ef9922168..0000000000 --- a/test/files/continuations-run/shift-pct.scala +++ /dev/null @@ -1,30 +0,0 @@ -import scala.util.continuations._ - -object Test { - abstract class IfReturnRepro { - def s1: Double @cpsParam[Any, Unit] - def s2: Double @cpsParam[Any, Unit] - - def p(i: Int): Double @cpsParam[Unit, Any] = { - val px = s1 - val pct = if (px > 100) px else px / s2 - println("pct = %.3f".format(pct)) - pct - } - } - - def main(args: Array[String]) : Unit = { - var d: Double = 0d - def d2 = d * d - - val irr = new IfReturnRepro { - def s1 = shift(f => f(d)) - def s2 = shift(f => f(d2)) - } - 1 to 25 foreach { i => - d = i - print("d = " + i + ", d2 = " + d2 + ", ") - run(irr p i) - } - } -} diff --git a/test/files/continuations-run/t1807.check b/test/files/continuations-run/t1807.check deleted file mode 100644 index 56a6051ca2..0000000000 --- a/test/files/continuations-run/t1807.check +++ /dev/null @@ -1 +0,0 @@ -1
\ No newline at end of file diff --git a/test/files/continuations-run/t1807.scala b/test/files/continuations-run/t1807.scala deleted file mode 100644 index 278b3a9936..0000000000 --- a/test/files/continuations-run/t1807.scala +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def main(args: Array[String]): Unit = { - val z = reset { - val f: (() => Int @cps[Int]) = () => 1 - f() - } - println(z) - } -}
\ No newline at end of file diff --git a/test/files/continuations-run/t1808.scala b/test/files/continuations-run/t1808.scala deleted file mode 100644 index 125c7c1cdf..0000000000 --- a/test/files/continuations-run/t1808.scala +++ /dev/null @@ -1,10 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def main(args: Array[String]): Unit = { - reset0 { 0 } - } -}
\ No newline at end of file diff --git a/test/files/continuations-run/t1820.scala b/test/files/continuations-run/t1820.scala deleted file mode 100644 index 893ddab6d1..0000000000 --- a/test/files/continuations-run/t1820.scala +++ /dev/null @@ -1,14 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def shifted: Unit @suspendable = shift { (k: Unit => Unit) => () } - def test1(b: => Boolean) = { - reset { - if (b) shifted - } - } - def main(args: Array[String]) = test1(true) -}
\ No newline at end of file diff --git a/test/files/continuations-run/t1821.check b/test/files/continuations-run/t1821.check deleted file mode 100644 index f7b76115db..0000000000 --- a/test/files/continuations-run/t1821.check +++ /dev/null @@ -1,4 +0,0 @@ -() -() -() -()
\ No newline at end of file diff --git a/test/files/continuations-run/t1821.scala b/test/files/continuations-run/t1821.scala deleted file mode 100644 index 0d5fb553be..0000000000 --- a/test/files/continuations-run/t1821.scala +++ /dev/null @@ -1,20 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - def suspended[A](x: A): A @suspendable = x - def test1[A](x: A): A @suspendable = suspended(x) match { case x => x } - def test2[A](x: List[A]): A @suspendable = suspended(x) match { case List(x) => x } - - def test3[A](x: A): A @suspendable = x match { case x => x } - def test4[A](x: List[A]): A @suspendable = x match { case List(x) => x } - - def main(args: Array[String]) = { - println(reset(test1())) - println(reset(test2(List(())))) - println(reset(test3())) - println(reset(test4(List(())))) - } -}
\ No newline at end of file diff --git a/test/files/continuations-run/t2864.check b/test/files/continuations-run/t2864.check deleted file mode 100644 index d411bb7c1a..0000000000 --- a/test/files/continuations-run/t2864.check +++ /dev/null @@ -1 +0,0 @@ -400 diff --git a/test/files/continuations-run/t2864.scala b/test/files/continuations-run/t2864.scala deleted file mode 100644 index 7a2579e45c..0000000000 --- a/test/files/continuations-run/t2864.scala +++ /dev/null @@ -1,30 +0,0 @@ -import scala.util.continuations._ -object Test { - - def double[B](n : Int)(k : Int => B) : B = k(n * 2) - - def main(args : Array[String]) { - reset { - val result1 = shift(double[Unit](100)) - val result2 = shift(double[Unit](result1)) - println(result2) - } - } - - def foo: Int @cps[Int] = { - val a0 = shift((k:Int=>Int) => k(0)) - val x0 = 2 - val a1 = shift((k:Int=>Int) => x0) - 0 - } - -/* - def bar: ControlContext[Int,Int,Int] = { - shiftR((k:Int=>Int) => k(0)).flatMap { a0 => - val x0 = 2 - shiftR((k:Int=>Int) => x0).map { a1 => - 0 - }} - } -*/ -}
\ No newline at end of file diff --git a/test/files/continuations-run/t2934.check b/test/files/continuations-run/t2934.check deleted file mode 100644 index a92586538e..0000000000 --- a/test/files/continuations-run/t2934.check +++ /dev/null @@ -1 +0,0 @@ -List(3, 4, 5) diff --git a/test/files/continuations-run/t2934.scala b/test/files/continuations-run/t2934.scala deleted file mode 100644 index a1b8ca9e04..0000000000 --- a/test/files/continuations-run/t2934.scala +++ /dev/null @@ -1,10 +0,0 @@ -import scala.util.continuations._ - -object Test { - def main(args : Array[String]) { - println(reset { - val x = shift(List(1,2,3).flatMap[Int, List[Int]]) - List(x + 2) - }) - } -} diff --git a/test/files/continuations-run/t3199.check b/test/files/continuations-run/t3199.check deleted file mode 100644 index a065247b8c..0000000000 --- a/test/files/continuations-run/t3199.check +++ /dev/null @@ -1 +0,0 @@ -Right(7) diff --git a/test/files/continuations-run/t3199.scala b/test/files/continuations-run/t3199.scala deleted file mode 100644 index 7b54793e05..0000000000 --- a/test/files/continuations-run/t3199.scala +++ /dev/null @@ -1,20 +0,0 @@ -import _root_.scala.collection.Seq -import _root_.scala.util.control.Exception -import _root_.scala.util.continuations._ - -object Test { - - trait AbstractResource[+R <: AnyRef] { - def reflect[B] : R @cpsParam[B,Either[Throwable, B]] = shift(acquireFor) - def acquireFor[B](f : R => B) : Either[Throwable, B] = { - import Exception._ - catching(List(classOf[Throwable]) : _*) either (f(null.asInstanceOf[R])) - } - } - - def main(args: Array[String]) : Unit = { - val x = new AbstractResource[String] { } - val result = x.acquireFor( x => 7 ) - println(result) - } - } diff --git a/test/files/continuations-run/t3199b.check b/test/files/continuations-run/t3199b.check deleted file mode 100644 index b5d8bb58d9..0000000000 --- a/test/files/continuations-run/t3199b.check +++ /dev/null @@ -1 +0,0 @@ -[1, 2, 3] diff --git a/test/files/continuations-run/t3199b.scala b/test/files/continuations-run/t3199b.scala deleted file mode 100644 index 2122c963ac..0000000000 --- a/test/files/continuations-run/t3199b.scala +++ /dev/null @@ -1,11 +0,0 @@ -object Test { - - def test() = { - java.util.Arrays.asList(Array(1,2,3):_*) - } - - def main(args: Array[String]) = { - println(test()) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/t3223.check b/test/files/continuations-run/t3223.check deleted file mode 100644 index ec635144f6..0000000000 --- a/test/files/continuations-run/t3223.check +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test/files/continuations-run/t3223.scala b/test/files/continuations-run/t3223.scala deleted file mode 100644 index efed1ff581..0000000000 --- a/test/files/continuations-run/t3223.scala +++ /dev/null @@ -1,19 +0,0 @@ -import scala.util.continuations._ -object Test { - - def foo(x:Int) = { - try { - throw new Exception - shiftUnit0[Int,Int](7) - } catch { - case ex => - val g = (a:Int)=>a - 9 - } - } - - def main(args: Array[String]) { - println(reset(foo(0))) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/t3225.check b/test/files/continuations-run/t3225.check deleted file mode 100644 index df1a8a9ce4..0000000000 --- a/test/files/continuations-run/t3225.check +++ /dev/null @@ -1,12 +0,0 @@ -8 -8 -9 -9 -8 -9 -8 -8 -9 -9 -8 -9 diff --git a/test/files/continuations-run/t3225.scala b/test/files/continuations-run/t3225.scala deleted file mode 100644 index 5b6259c43f..0000000000 --- a/test/files/continuations-run/t3225.scala +++ /dev/null @@ -1,56 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - class Bla { - val x = 8 - def y[T] = 9 - } - -/* - def bla[A] = shift { k:(Bla=>A) => k(new Bla) } -*/ - - def bla1 = shift { k:(Bla=>Bla) => k(new Bla) } - def bla2 = shift { k:(Bla=>Int) => k(new Bla) } - - def fooA = bla2.x - def fooB[T] = bla2.y[T] - - def testMono() = { - println(reset(bla1).x) - println(reset(bla2.x)) - println(reset(bla2.y[Int])) - println(reset(bla2.y)) - println(reset(fooA)) - println(reset(fooB)) - 0 - } - - def blaX[A] = shift { k:(Bla=>A) => k(new Bla) } - - def fooX[A] = blaX[A].x - def fooY[A] = blaX[A].y[A] - - def testPoly() = { - println(reset(blaX[Bla]).x) - println(reset(blaX[Int].x)) - println(reset(blaX[Int].y[Int])) - println(reset(blaX[Int].y)) - println(reset(fooX[Int])) - println(reset(fooY[Int])) - 0 - } - - - // TODO: check whether this also applies to a::shift { k => ... } - - def main(args: Array[String]) = { - testMono() - testPoly() - } - -} diff --git a/test/files/continuations-run/t3501.check b/test/files/continuations-run/t3501.check deleted file mode 100644 index 08adcfe27a..0000000000 --- a/test/files/continuations-run/t3501.check +++ /dev/null @@ -1,5 +0,0 @@ -42 -42 -42 -42 -42 diff --git a/test/files/continuations-run/t3501.scala b/test/files/continuations-run/t3501.scala deleted file mode 100644 index c43b3322be..0000000000 --- a/test/files/continuations-run/t3501.scala +++ /dev/null @@ -1,15 +0,0 @@ -import scala.util.continuations._ - -object Test { - def capture(): Int @suspendable = 42 - - def main(args: Array[String]): Unit = reset { - var i = 0 - while (i < 5) { - i += 1 - val y = capture() - val s = y - println(s) - } - } -} diff --git a/test/files/continuations-run/t5314-2.check b/test/files/continuations-run/t5314-2.check deleted file mode 100644 index 35b3c93780..0000000000 --- a/test/files/continuations-run/t5314-2.check +++ /dev/null @@ -1,5 +0,0 @@ -8 -hi -8 -from try -8 diff --git a/test/files/continuations-run/t5314-2.scala b/test/files/continuations-run/t5314-2.scala deleted file mode 100644 index 8a896dec2c..0000000000 --- a/test/files/continuations-run/t5314-2.scala +++ /dev/null @@ -1,44 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cps[Any] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - def caller3 = reset { println(p3(3)) } - - def p(i: Int): Int @cps[Any] = { - val v= s1 + 3 - return v - } - - def p2(i: Int): Int @cps[Any] = { - val v = s1 + 3 - if (v > 0) { - println("hi") - return v - } else { - println("hi") - return 8 - } - } - - def p3(i: Int): Int @cps[Any] = { - val v = s1 + 3 - try { - println("from try") - return v - } catch { - case e: Exception => - println("from catch") - return 7 - } - } - -} - -object Test extends App { - val repro = new ReturnRepro - repro.caller - repro.caller2 - repro.caller3 -} diff --git a/test/files/continuations-run/t5314-3.check b/test/files/continuations-run/t5314-3.check deleted file mode 100644 index 71489f097c..0000000000 --- a/test/files/continuations-run/t5314-3.check +++ /dev/null @@ -1,4 +0,0 @@ -enter return expr -8 -hi -8 diff --git a/test/files/continuations-run/t5314-3.scala b/test/files/continuations-run/t5314-3.scala deleted file mode 100644 index 62c547f5a2..0000000000 --- a/test/files/continuations-run/t5314-3.scala +++ /dev/null @@ -1,27 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - return { println("enter return expr"); v } - } - - def p2(i: Int): Int @cpsParam[Unit, Any] = { - val v = s1 + 3 - if (v > 0) { - return { println("hi"); v } - } else { - return { println("hi"); 8 } - } - } -} - -object Test extends App { - val repro = new ReturnRepro - repro.caller - repro.caller2 -} diff --git a/test/files/continuations-run/t5314-with-if.check b/test/files/continuations-run/t5314-with-if.check deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/files/continuations-run/t5314-with-if.check +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/files/continuations-run/t5314-with-if.scala b/test/files/continuations-run/t5314-with-if.scala deleted file mode 100644 index 5840199a3c..0000000000 --- a/test/files/continuations-run/t5314-with-if.scala +++ /dev/null @@ -1,17 +0,0 @@ -import scala.util.continuations._ - -object Test extends App { - - def foo(x:Int): Int @cps[Int] = 7 - - def bar(x:Int): Int @cps[Int] = { - val v = foo(x) - if (v > 0) - return v - else - return 10 - } - - println(reset { bar(10) }) - -} diff --git a/test/files/continuations-run/t5314.check b/test/files/continuations-run/t5314.check deleted file mode 100644 index 4b35d8e6d0..0000000000 --- a/test/files/continuations-run/t5314.check +++ /dev/null @@ -1,8 +0,0 @@ -7 -7 -7 -8 -8 -hi -8 -8 diff --git a/test/files/continuations-run/t5314.scala b/test/files/continuations-run/t5314.scala deleted file mode 100644 index d611016ce4..0000000000 --- a/test/files/continuations-run/t5314.scala +++ /dev/null @@ -1,52 +0,0 @@ -import scala.util.continuations._ - -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } - def caller = reset { println(p(3)) } - def caller2 = reset { println(p2(3)) } - - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - return v - } - - def p2(i: Int): Int @cpsParam[Unit, Any] = { - val v = s1 + 3 - if (v > 0) { - println("hi") - return v - } else { - println("hi") - return 8 - } - } -} - -object Test extends App { - def foo(x:Int): Int @cps[Int] = shift { k => k(x) } - - def bar(x:Int): Int @cps[Int] = return foo(x) - - def nocps(x: Int): Int = { return x; x } - - def foo2(x:Int): Int @cps[Int] = 7 - def bar2(x:Int): Int @cps[Int] = { foo2(x); return 7 } - def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) } - def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) } - def bar5(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else 8 } - println(reset { bar2(10) }) - println(reset { bar3(10) }) - println(reset { bar4(10) }) - println(reset { bar5(10) }) - - /* original test case */ - val repro = new ReturnRepro - repro.caller - repro.caller2 - - reset { - val res = bar(8) - println(res) - res - } -} diff --git a/test/files/continuations-run/t5472.check b/test/files/continuations-run/t5472.check deleted file mode 100644 index d42e80c18e..0000000000 --- a/test/files/continuations-run/t5472.check +++ /dev/null @@ -1 +0,0 @@ -List(23, 23) diff --git a/test/files/continuations-run/t5472.scala b/test/files/continuations-run/t5472.scala deleted file mode 100644 index 3e3c76b32a..0000000000 --- a/test/files/continuations-run/t5472.scala +++ /dev/null @@ -1,90 +0,0 @@ -import scala.annotation._ -import scala.util.continuations._ -import java.util.concurrent.atomic._ - -object Test { - def main(args: Array[String]) { - val map = Map("foo" -> 1, "bar" -> 2) - reset { - val mapped = - for { - (location, accessors) <- new ContinuationizedParallelIterable(map) - } yield { - shiftUnit0[Int, Unit](23) - } - println(mapped.toList) - } - } -} - -final class ContinuationizedParallelIterable[+A](protected val underline: Iterable[A]) { - def toList = underline.toList.sortBy(_.toString) - - final def filter(p: A => Boolean @suspendable): ContinuationizedParallelIterable[A] @suspendable = - shift( - new AtomicInteger(1) with ((ContinuationizedParallelIterable[A] => Unit) => Unit) { - private val results = new AtomicReference[List[A]](Nil) - - @tailrec - private def add(element: A) { - val old = results.get - if (!results.compareAndSet(old, element :: old)) { - add(element) - } - } - - override final def apply(continue: ContinuationizedParallelIterable[A] => Unit) { - for (element <- underline) { - super.incrementAndGet() - reset { - val pass = p(element) - if (pass) { - add(element) - } - if (super.decrementAndGet() == 0) { - continue(new ContinuationizedParallelIterable(results.get)) - } - } - } - if (super.decrementAndGet() == 0) { - continue(new ContinuationizedParallelIterable(results.get)) - } - } - }) - - final def foreach[U](f: A => U @suspendable): Unit @suspendable = - shift( - new AtomicInteger(1) with ((Unit => Unit) => Unit) { - override final def apply(continue: Unit => Unit) { - for (element <- underline) { - super.incrementAndGet() - reset { - f(element) - if (super.decrementAndGet() == 0) { - continue() - } - } - } - if (super.decrementAndGet() == 0) { - continue() - } - } - }) - - final def map[B: Manifest](f: A => B @suspendable): ContinuationizedParallelIterable[B] @suspendable = - shift( - new AtomicInteger(underline.size) with ((ContinuationizedParallelIterable[B] => Unit) => Unit) { - override final def apply(continue: ContinuationizedParallelIterable[B] => Unit) { - val results = new Array[B](super.get) - for ((element, i) <- underline.view zipWithIndex) { - reset { - val result = f(element) - results(i) = result - if (super.decrementAndGet() == 0) { - continue(new ContinuationizedParallelIterable(results)) - } - } - } - } - }) -} diff --git a/test/files/continuations-run/t5506.check b/test/files/continuations-run/t5506.check deleted file mode 100644 index 38b76c63f1..0000000000 --- a/test/files/continuations-run/t5506.check +++ /dev/null @@ -1,7 +0,0 @@ -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) -List(1, 2, 3) diff --git a/test/files/continuations-run/t5506.scala b/test/files/continuations-run/t5506.scala deleted file mode 100644 index 2b5c1118f7..0000000000 --- a/test/files/continuations-run/t5506.scala +++ /dev/null @@ -1,58 +0,0 @@ -import scala.util.continuations._ - -object Test { - -def g: List[Int] @suspendable = List(1,2,3) - -def fp10: List[Int] @suspendable = { -g.map(x => x) -} - -def fp11: List[Int] @suspendable = { -val z = g.map(x => x) -z -} - - -def fp12: List[Int] @suspendable = { -val z = List(1,2,3) -z.map(x => x) -} - - - -def fp20: List[Int] @suspendable = { -g.map[Int,List[Int]](x => x) -} - - -def fp21: List[Int] @suspendable = { -val z = g.map[Int,List[Int]](x => x) -z -} - -def fp22: List[Int] @suspendable = { -val z = g.map[Int,List[Int]](x => x)(List.canBuildFrom[Int]) -z -} - -def fp23: List[Int] @suspendable = { -val z = g.map(x => x)(List.canBuildFrom[Int]) -z -} - - -def main(args: Array[String]) = { - reset { - println(fp10) - println(fp11) - println(fp12) - - println(fp20) - println(fp21) - println(fp22) - println(fp23) - } -} - -} diff --git a/test/files/continuations-run/t5538.check b/test/files/continuations-run/t5538.check deleted file mode 100644 index 457721d5e0..0000000000 --- a/test/files/continuations-run/t5538.check +++ /dev/null @@ -1 +0,0 @@ -Future(Future(Future(Future(Future(List(1, 2, 3, 4, 5)))))) diff --git a/test/files/continuations-run/t5538.scala b/test/files/continuations-run/t5538.scala deleted file mode 100644 index 42f8163caf..0000000000 --- a/test/files/continuations-run/t5538.scala +++ /dev/null @@ -1,50 +0,0 @@ -import scala.util.continuations._ -import scala.collection.generic.CanBuildFrom - -object Test { - - class ExecutionContext - - implicit def defaultExecutionContext = new ExecutionContext - - case class Future[+T](x:T) { - final def map[A](f: T => A): Future[A] = new Future[A](f(x)) - final def flatMap[A](f: T => Future[A]): Future[A] = f(x) - } - - class PromiseStream[A] { - override def toString = xs.toString - - var xs: List[A] = Nil - - final def +=(elem: A): this.type = { xs :+= elem; this } - - final def ++=(elem: Traversable[A]): this.type = { xs ++= elem; this } - - final def <<(elem: Future[A]): PromiseStream[A] @cps[Future[Any]] = - shift { cont: (PromiseStream[A] => Future[Any]) => elem map (a => cont(this += a)) } - - final def <<(elem1: Future[A], elem2: Future[A], elems: Future[A]*): PromiseStream[A] @cps[Future[Any]] = - shift { cont: (PromiseStream[A] => Future[Any]) => Future.flow(this << elem1 << elem2 <<< Future.sequence(elems.toSeq)) map cont } - - final def <<<(elems: Traversable[A]): PromiseStream[A] @cps[Future[Any]] = - shift { cont: (PromiseStream[A] => Future[Any]) => cont(this ++= elems) } - - final def <<<(elems: Future[Traversable[A]]): PromiseStream[A] @cps[Future[Any]] = - shift { cont: (PromiseStream[A] => Future[Any]) => elems map (as => cont(this ++= as)) } - } - - object Future { - - def sequence[A, M[_] <: Traversable[_]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]] = - new Future(in.asInstanceOf[Traversable[Future[A]]].map((f:Future[A])=>f.x)(cbf.asInstanceOf[CanBuildFrom[Traversable[Future[A]], A, M[A]]])) - - def flow[A](body: => A @cps[Future[Any]])(implicit executor: ExecutionContext): Future[A] = reset(Future(body)).asInstanceOf[Future[A]] - - } - - def main(args: Array[String]) = { - val p = new PromiseStream[Int] - println(Future.flow(p << (Future(1), Future(2), Future(3), Future(4), Future(5)))) - } -}
\ No newline at end of file diff --git a/test/files/continuations-run/trycatch0.check b/test/files/continuations-run/trycatch0.check deleted file mode 100644 index 36806909d0..0000000000 --- a/test/files/continuations-run/trycatch0.check +++ /dev/null @@ -1,2 +0,0 @@ -10 -10
\ No newline at end of file diff --git a/test/files/continuations-run/trycatch0.scala b/test/files/continuations-run/trycatch0.scala deleted file mode 100644 index ec39863f3f..0000000000 --- a/test/files/continuations-run/trycatch0.scala +++ /dev/null @@ -1,25 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - -object Test { - - def foo = try { - shift((k: Int=>Int) => k(7)) - } catch { - case ex => - 9 - } - - def bar = try { - 7 - } catch { - case ex => - shiftUnit0[Int,Int](9) - } - - def main(args: Array[String]): Unit = { - println(reset { foo + 3 }) - println(reset { bar + 3 }) - } -}
\ No newline at end of file diff --git a/test/files/continuations-run/trycatch1.check b/test/files/continuations-run/trycatch1.check deleted file mode 100644 index a028d2b1e1..0000000000 --- a/test/files/continuations-run/trycatch1.check +++ /dev/null @@ -1,4 +0,0 @@ -12 -12 -12 -12
\ No newline at end of file diff --git a/test/files/continuations-run/trycatch1.scala b/test/files/continuations-run/trycatch1.scala deleted file mode 100644 index 10dfd30bb2..0000000000 --- a/test/files/continuations-run/trycatch1.scala +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - -object Test { - - def fatal: Int = throw new Exception() - - def foo1 = try { - fatal - shift((k: Int=>Int) => k(7)) - } catch { - case ex => - 9 - } - - def foo2 = try { - shift((k: Int=>Int) => k(7)) - fatal - } catch { - case ex => - 9 - } - - def bar1 = try { - fatal - 7 - } catch { - case ex => - shiftUnit0[Int,Int](9) // regular shift causes no-symbol doesn't have owner - } - - def bar2 = try { - 7 - fatal - } catch { - case ex => - shiftUnit0[Int,Int](9) // regular shift causes no-symbol doesn't have owner - } - - def main(args: Array[String]): Unit = { - println(reset { foo1 + 3 }) - println(reset { foo2 + 3 }) - println(reset { bar1 + 3 }) - println(reset { bar2 + 3 }) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/while0.check b/test/files/continuations-run/while0.check deleted file mode 100644 index d58c55a31d..0000000000 --- a/test/files/continuations-run/while0.check +++ /dev/null @@ -1 +0,0 @@ -9000 diff --git a/test/files/continuations-run/while0.scala b/test/files/continuations-run/while0.scala deleted file mode 100644 index 46005a4a77..0000000000 --- a/test/files/continuations-run/while0.scala +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def foo(): Int @cps[Unit] = 2 - - def test(): Unit @cps[Unit] = { - var x = 0 - while (x < 9000) { // pick number large enough to require tail-call opt - x += foo() - } - println(x) - } - - def main(args: Array[String]): Any = { - reset(test()) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/while1.check b/test/files/continuations-run/while1.check deleted file mode 100644 index 3d5f0b9a46..0000000000 --- a/test/files/continuations-run/while1.check +++ /dev/null @@ -1,11 +0,0 @@ -up -up -up -up -up -10 -down -down -down -down -down diff --git a/test/files/continuations-run/while1.scala b/test/files/continuations-run/while1.scala deleted file mode 100644 index fd41ab36ee..0000000000 --- a/test/files/continuations-run/while1.scala +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def foo(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") } - - def test(): Unit @cps[Unit] = { - var x = 0 - while (x < 9) { - x += foo() - } - println(x) - } - - def main(args: Array[String]): Any = { - reset(test()) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/while2.check b/test/files/continuations-run/while2.check deleted file mode 100644 index 9fe515181b..0000000000 --- a/test/files/continuations-run/while2.check +++ /dev/null @@ -1,19 +0,0 @@ -up -up -up -up -up -up -up -up -up -9000 -down -down -down -down -down -down -down -down -down diff --git a/test/files/continuations-run/while2.scala b/test/files/continuations-run/while2.scala deleted file mode 100644 index 63f9cb99fe..0000000000 --- a/test/files/continuations-run/while2.scala +++ /dev/null @@ -1,23 +0,0 @@ -// $Id$ - -import scala.util.continuations._ - - -object Test { - - def foo1(): Int @cps[Unit] = 2 - def foo2(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") } - - def test(): Unit @cps[Unit] = { - var x = 0 - while (x < 9000) { // pick number large enough to require tail-call opt - x += (if (x % 1000 != 0) foo1() else foo2()) - } - println(x) - } - - def main(args: Array[String]): Any = { - reset(test()) - } - -}
\ No newline at end of file diff --git a/test/files/continuations-run/z1673.check b/test/files/continuations-run/z1673.check deleted file mode 100644 index e69de29bb2..0000000000 --- a/test/files/continuations-run/z1673.check +++ /dev/null diff --git a/test/files/continuations-run/z1673.scala b/test/files/continuations-run/z1673.scala deleted file mode 100644 index 716b374860..0000000000 --- a/test/files/continuations-run/z1673.scala +++ /dev/null @@ -1,31 +0,0 @@ -import scala.util.continuations._ - -class MatchRepro { - def s: String @cps[Any] = shift { k => k("foo") } - - def p = { - val k = s - s match { case lit0 => } - } - - def q = { - val k = s - k match { case lit1 => } - } - - def r = { - s match { case "FOO" => } - } - - def t = { - val k = s - k match { case "FOO" => } - } -} - -object Test { - def main(args: Array[String]): Unit = { - val m = new MatchRepro - () - } -} |