From c55b106f503d5e712e69823cfeb1cab2460221eb Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 6 May 2010 16:37:13 +0000 Subject: Rolled partest back to r21328. changes necessary to plug it back in while preserving everything which has happened since then in tests and such, but we should be the lookout for overreversion. Review by phaller (but as a formality, I don't think it requires direct review.) --- test/files/continuations-neg/function0.check | 6 + test/files/continuations-neg/function0.scala | 16 +++ test/files/continuations-neg/function2.check | 6 + test/files/continuations-neg/function2.scala | 16 +++ test/files/continuations-neg/function3.check | 6 + test/files/continuations-neg/function3.scala | 15 ++ test/files/continuations-neg/infer0.check | 4 + test/files/continuations-neg/infer0.scala | 14 ++ test/files/continuations-neg/infer2.check | 4 + test/files/continuations-neg/infer2.scala | 19 +++ test/files/continuations-neg/lazy.check | 6 + test/files/continuations-neg/lazy.scala | 16 +++ test/files/continuations-neg/t1929.check | 6 + test/files/continuations-neg/t1929.scala | 17 +++ test/files/continuations-neg/t2285.check | 6 + test/files/continuations-neg/t2285.scala | 11 ++ test/files/continuations-neg/t2949.check | 6 + test/files/continuations-neg/t2949.scala | 15 ++ test/files/continuations-neg/trycatch2.check | 7 + test/files/continuations-neg/trycatch2.scala | 33 +++++ test/files/continuations-run/basics.check | 2 + test/files/continuations-run/basics.scala | 23 +++ test/files/continuations-run/function1.check | 1 + test/files/continuations-run/function1.scala | 16 +++ test/files/continuations-run/function4.check | 1 + test/files/continuations-run/function4.scala | 15 ++ test/files/continuations-run/function5.check | 1 + test/files/continuations-run/function5.scala | 15 ++ test/files/continuations-run/function6.check | 1 + test/files/continuations-run/function6.scala | 16 +++ test/files/continuations-run/ifelse0.check | 2 + test/files/continuations-run/ifelse0.scala | 18 +++ test/files/continuations-run/ifelse1.check | 4 + test/files/continuations-run/ifelse1.scala | 25 ++++ test/files/continuations-run/ifelse2.check | 4 + test/files/continuations-run/ifelse2.scala | 16 +++ test/files/continuations-run/ifelse3.check | 2 + test/files/continuations-run/ifelse3.scala | 21 +++ test/files/continuations-run/infer1.scala | 33 +++++ test/files/continuations-run/match0.check | 2 + test/files/continuations-run/match0.scala | 18 +++ test/files/continuations-run/match1.check | 2 + test/files/continuations-run/match1.scala | 18 +++ test/files/continuations-run/match2.check | 2 + test/files/continuations-run/match2.scala | 26 ++++ test/files/continuations-run/t1807.check | 1 + test/files/continuations-run/t1807.scala | 14 ++ test/files/continuations-run/t1808.scala | 10 ++ test/files/continuations-run/t1820.scala | 14 ++ test/files/continuations-run/t1821.check | 4 + test/files/continuations-run/t1821.scala | 20 +++ test/files/continuations-run/t2864.check | 1 + test/files/continuations-run/t2864.scala | 30 ++++ test/files/continuations-run/t2934.check | 1 + test/files/continuations-run/t2934.scala | 10 ++ test/files/continuations-run/t3199.check | 1 + test/files/continuations-run/t3199.scala | 20 +++ test/files/continuations-run/t3199b.check | 1 + test/files/continuations-run/t3199b.scala | 11 ++ test/files/continuations-run/t3223.check | 1 + test/files/continuations-run/t3223.scala | 19 +++ test/files/continuations-run/t3225.check | 12 ++ test/files/continuations-run/t3225.scala | 56 ++++++++ test/files/continuations-run/trycatch0.check | 2 + test/files/continuations-run/trycatch0.scala | 25 ++++ test/files/continuations-run/trycatch1.check | 4 + test/files/continuations-run/trycatch1.scala | 48 +++++++ test/files/continuations-run/while0.check | 1 + test/files/continuations-run/while0.scala | 22 +++ test/files/continuations-run/while1.check | 11 ++ test/files/continuations-run/while1.scala | 22 +++ test/files/continuations-run/while2.check | 19 +++ test/files/continuations-run/while2.scala | 23 +++ test/files/jvm/genericNest.scala | 13 ++ .../jvm/genericNest/genericNest.jar.desired.sha1 | 1 - test/files/jvm/genericNest/genericNest.scala | 13 -- test/files/jvm/lib/annotations.jar.desired.sha1 | 1 - test/files/jvm/lib/nest.jar.desired.sha1 | 1 - test/files/jvm/methvsfield.java | 11 ++ test/files/jvm/methvsfield.scala | 4 + test/files/jvm/nest.java | 38 +++++ test/files/jvm/nest.scala | 21 +++ test/files/jvm/outerEnum.scala | 9 ++ test/files/jvm/outerEnum/enums.jar.desired.sha1 | 1 - test/files/jvm/outerEnum/outerEnum.scala | 9 -- test/files/jvm/t1652.check | 2 + test/files/lib/annotations.jar.desired.sha1 | 1 + test/files/lib/enums.jar.desired.sha1 | 1 + test/files/lib/genericNest.jar.desired.sha1 | 1 + test/files/lib/methvsfield.jar.desired.sha1 | 1 + test/files/lib/nest.jar.desired.sha1 | 1 + test/files/lib/scalacheck.jar.desired.sha1 | 1 + test/files/neg/bug414.scala | 2 +- test/files/neg/migration28.check | 3 +- test/files/pos/spec-traits.scala | 83 ----------- test/files/pos/t1254/t1254.java | 28 ---- test/files/res/bug687.check | 5 +- test/files/run/numbereq.scala | 2 +- test/files/run/programmatic-main.check | 2 - test/files/run/stream_length.scala | 15 -- test/files/run/t2946/Parsers.scala | 4 - test/files/run/t2946/ResponseCommon.scala | 14 -- test/files/run/t2946/Test.scala | 7 - test/files/scalacheck/redblack.scala | 157 --------------------- 104 files changed, 1026 insertions(+), 342 deletions(-) create mode 100644 test/files/continuations-neg/function0.check create mode 100644 test/files/continuations-neg/function0.scala create mode 100644 test/files/continuations-neg/function2.check create mode 100644 test/files/continuations-neg/function2.scala create mode 100644 test/files/continuations-neg/function3.check create mode 100644 test/files/continuations-neg/function3.scala create mode 100644 test/files/continuations-neg/infer0.check create mode 100644 test/files/continuations-neg/infer0.scala create mode 100644 test/files/continuations-neg/infer2.check create mode 100644 test/files/continuations-neg/infer2.scala create mode 100644 test/files/continuations-neg/lazy.check create mode 100644 test/files/continuations-neg/lazy.scala create mode 100644 test/files/continuations-neg/t1929.check create mode 100644 test/files/continuations-neg/t1929.scala create mode 100644 test/files/continuations-neg/t2285.check create mode 100644 test/files/continuations-neg/t2285.scala create mode 100644 test/files/continuations-neg/t2949.check create mode 100644 test/files/continuations-neg/t2949.scala create mode 100644 test/files/continuations-neg/trycatch2.check create mode 100644 test/files/continuations-neg/trycatch2.scala create mode 100755 test/files/continuations-run/basics.check create mode 100755 test/files/continuations-run/basics.scala create mode 100644 test/files/continuations-run/function1.check create mode 100644 test/files/continuations-run/function1.scala create mode 100644 test/files/continuations-run/function4.check create mode 100644 test/files/continuations-run/function4.scala create mode 100644 test/files/continuations-run/function5.check create mode 100644 test/files/continuations-run/function5.scala create mode 100644 test/files/continuations-run/function6.check create mode 100644 test/files/continuations-run/function6.scala create mode 100644 test/files/continuations-run/ifelse0.check create mode 100644 test/files/continuations-run/ifelse0.scala create mode 100644 test/files/continuations-run/ifelse1.check create mode 100644 test/files/continuations-run/ifelse1.scala create mode 100644 test/files/continuations-run/ifelse2.check create mode 100644 test/files/continuations-run/ifelse2.scala create mode 100644 test/files/continuations-run/ifelse3.check create mode 100644 test/files/continuations-run/ifelse3.scala create mode 100644 test/files/continuations-run/infer1.scala create mode 100644 test/files/continuations-run/match0.check create mode 100644 test/files/continuations-run/match0.scala create mode 100644 test/files/continuations-run/match1.check create mode 100644 test/files/continuations-run/match1.scala create mode 100644 test/files/continuations-run/match2.check create mode 100644 test/files/continuations-run/match2.scala create mode 100644 test/files/continuations-run/t1807.check create mode 100644 test/files/continuations-run/t1807.scala create mode 100644 test/files/continuations-run/t1808.scala create mode 100644 test/files/continuations-run/t1820.scala create mode 100644 test/files/continuations-run/t1821.check create mode 100644 test/files/continuations-run/t1821.scala create mode 100644 test/files/continuations-run/t2864.check create mode 100644 test/files/continuations-run/t2864.scala create mode 100644 test/files/continuations-run/t2934.check create mode 100644 test/files/continuations-run/t2934.scala create mode 100644 test/files/continuations-run/t3199.check create mode 100644 test/files/continuations-run/t3199.scala create mode 100644 test/files/continuations-run/t3199b.check create mode 100644 test/files/continuations-run/t3199b.scala create mode 100644 test/files/continuations-run/t3223.check create mode 100644 test/files/continuations-run/t3223.scala create mode 100644 test/files/continuations-run/t3225.check create mode 100644 test/files/continuations-run/t3225.scala create mode 100644 test/files/continuations-run/trycatch0.check create mode 100644 test/files/continuations-run/trycatch0.scala create mode 100644 test/files/continuations-run/trycatch1.check create mode 100644 test/files/continuations-run/trycatch1.scala create mode 100644 test/files/continuations-run/while0.check create mode 100644 test/files/continuations-run/while0.scala create mode 100644 test/files/continuations-run/while1.check create mode 100644 test/files/continuations-run/while1.scala create mode 100644 test/files/continuations-run/while2.check create mode 100644 test/files/continuations-run/while2.scala create mode 100644 test/files/jvm/genericNest.scala delete mode 100644 test/files/jvm/genericNest/genericNest.jar.desired.sha1 delete mode 100644 test/files/jvm/genericNest/genericNest.scala delete mode 100644 test/files/jvm/lib/annotations.jar.desired.sha1 delete mode 100644 test/files/jvm/lib/nest.jar.desired.sha1 create mode 100644 test/files/jvm/methvsfield.java create mode 100644 test/files/jvm/methvsfield.scala create mode 100644 test/files/jvm/nest.java create mode 100644 test/files/jvm/nest.scala create mode 100644 test/files/jvm/outerEnum.scala delete mode 100644 test/files/jvm/outerEnum/enums.jar.desired.sha1 delete mode 100644 test/files/jvm/outerEnum/outerEnum.scala create mode 100644 test/files/jvm/t1652.check create mode 100644 test/files/lib/annotations.jar.desired.sha1 create mode 100644 test/files/lib/enums.jar.desired.sha1 create mode 100644 test/files/lib/genericNest.jar.desired.sha1 create mode 100644 test/files/lib/methvsfield.jar.desired.sha1 create mode 100644 test/files/lib/nest.jar.desired.sha1 create mode 100644 test/files/lib/scalacheck.jar.desired.sha1 delete mode 100644 test/files/pos/spec-traits.scala delete mode 100644 test/files/pos/t1254/t1254.java delete mode 100644 test/files/run/stream_length.scala delete mode 100644 test/files/run/t2946/Parsers.scala delete mode 100644 test/files/run/t2946/ResponseCommon.scala delete mode 100644 test/files/run/t2946/Test.scala delete mode 100644 test/files/scalacheck/redblack.scala (limited to 'test/files') diff --git a/test/files/continuations-neg/function0.check b/test/files/continuations-neg/function0.check new file mode 100644 index 0000000000..0a66763a0f --- /dev/null +++ b/test/files/continuations-neg/function0.check @@ -0,0 +1,6 @@ +function0.scala:11: error: type mismatch; + found : () => Int @scala.util.continuations.cpsParam[Int,Int] + required: () => Int + val g: () => Int = f + ^ +one error found diff --git a/test/files/continuations-neg/function0.scala b/test/files/continuations-neg/function0.scala new file mode 100644 index 0000000000..4112ee3835 --- /dev/null +++ b/test/files/continuations-neg/function0.scala @@ -0,0 +1,16 @@ +// $Id$ + +import scala.util.continuations._ + + +object Test { + + def main(args: Array[String]): Any = { + + val f = () => shift { k: (Int=>Int) => k(7) } + val g: () => Int = f + + println(reset(g())) + } + +} \ No newline at end of file diff --git a/test/files/continuations-neg/function2.check b/test/files/continuations-neg/function2.check new file mode 100644 index 0000000000..4833057652 --- /dev/null +++ b/test/files/continuations-neg/function2.check @@ -0,0 +1,6 @@ +function2.scala:11: error: type mismatch; + found : () => Int + required: () => Int @util.continuations.package.cps[Int] + val g: () => Int @cps[Int] = f + ^ +one error found diff --git a/test/files/continuations-neg/function2.scala b/test/files/continuations-neg/function2.scala new file mode 100644 index 0000000000..ae0fda509d --- /dev/null +++ b/test/files/continuations-neg/function2.scala @@ -0,0 +1,16 @@ +// $Id$ + +import scala.util.continuations._ + + +object Test { + + def main(args: Array[String]): Any = { + + val f = () => 7 + val g: () => Int @cps[Int] = f + + println(reset(g())) + } + +} \ No newline at end of file diff --git a/test/files/continuations-neg/function3.check b/test/files/continuations-neg/function3.check new file mode 100644 index 0000000000..4705ad9ed9 --- /dev/null +++ b/test/files/continuations-neg/function3.check @@ -0,0 +1,6 @@ +function3.scala:10: error: type mismatch; + found : Int @scala.util.continuations.cpsParam[Int,Int] + required: Int + val g: () => Int = () => shift { k: (Int=>Int) => k(7) } + ^ +one error found diff --git a/test/files/continuations-neg/function3.scala b/test/files/continuations-neg/function3.scala new file mode 100644 index 0000000000..0c3f1667e5 --- /dev/null +++ b/test/files/continuations-neg/function3.scala @@ -0,0 +1,15 @@ +// $Id$ + +import scala.util.continuations._ + + +object Test { + + def main(args: Array[String]): Any = { + + val g: () => Int = () => shift { k: (Int=>Int) => k(7) } + + println(reset(g())) + } + +} \ No newline at end of file diff --git a/test/files/continuations-neg/infer0.check b/test/files/continuations-neg/infer0.check new file mode 100644 index 0000000000..1dd072ef09 --- /dev/null +++ b/test/files/continuations-neg/infer0.check @@ -0,0 +1,4 @@ +infer0.scala:11: error: cannot cps-transform expression 8: type arguments [Int(8),String,Int] do not conform to method shiftUnit's type parameter bounds [A,B,C >: B] + test(8) + ^ +one error found diff --git a/test/files/continuations-neg/infer0.scala b/test/files/continuations-neg/infer0.scala new file mode 100644 index 0000000000..894d5228b1 --- /dev/null +++ b/test/files/continuations-neg/infer0.scala @@ -0,0 +1,14 @@ +// $Id$ + +import scala.util.continuations._ + + +object Test { + + def test(x: => Int @cpsParam[String,Int]) = 7 + + def main(args: Array[String]): Any = { + test(8) + } + +} \ No newline at end of file diff --git a/test/files/continuations-neg/infer2.check b/test/files/continuations-neg/infer2.check new file mode 100644 index 0000000000..59eb670bc3 --- /dev/null +++ b/test/files/continuations-neg/infer2.check @@ -0,0 +1,4 @@ +infer2.scala:14: error: illegal answer type modification: scala.util.continuations.cpsParam[String,Int] andThen scala.util.continuations.cpsParam[String,Int] + test { sym(); sym() } + ^ +one error found diff --git a/test/files/continuations-neg/infer2.scala b/test/files/continuations-neg/infer2.scala new file mode 100644 index 0000000000..a890ac1fc4 --- /dev/null +++ b/test/files/continuations-neg/infer2.scala @@ -0,0 +1,19 @@ +// $Id$ + +import scala.util.continuations._ + + +object Test { + + def test(x: => Int @cpsParam[String,Int]) = 7 + + def sym() = shift { k: (Int => String) => 9 } + + + def main(args: Array[String]): Any = { + test { sym(); sym() } + } + +} + + diff --git a/test/files/continuations-neg/lazy.check b/test/files/continuations-neg/lazy.check new file mode 100644 index 0000000000..bfa44c59a4 --- /dev/null +++ b/test/files/continuations-neg/lazy.check @@ -0,0 +1,6 @@ +lazy.scala:5: error: type mismatch; + found : Unit @scala.util.continuations.cpsParam[Unit,Unit] + required: Unit + def foo = { + ^ +one error found diff --git a/test/files/continuations-neg/lazy.scala b/test/files/continuations-neg/lazy.scala new file mode 100644 index 0000000000..dffc57ffa0 --- /dev/null +++ b/test/files/continuations-neg/lazy.scala @@ -0,0 +1,16 @@ +import scala.util.continuations._ + +object Test { + + def foo = { + lazy val x = shift((k:Unit=>Unit)=>k()) + println(x) + } + + def main(args: Array[String]) { + reset { + foo + } + } + +} \ No newline at end of file diff --git a/test/files/continuations-neg/t1929.check b/test/files/continuations-neg/t1929.check new file mode 100644 index 0000000000..f42c3a1e15 --- /dev/null +++ b/test/files/continuations-neg/t1929.check @@ -0,0 +1,6 @@ +t1929.scala:8: error: type mismatch; + found : Int @scala.util.continuations.cpsParam[String,java.lang.String] @scala.util.continuations.cpsSynth + required: Int @scala.util.continuations.cpsParam[Int,java.lang.String] + reset { + ^ +one error found diff --git a/test/files/continuations-neg/t1929.scala b/test/files/continuations-neg/t1929.scala new file mode 100644 index 0000000000..02eda9170d --- /dev/null +++ b/test/files/continuations-neg/t1929.scala @@ -0,0 +1,17 @@ +// $Id$ + +import scala.util.continuations._ + + +object Test { + def main(args : Array[String]) { + reset { + println("up") + val x = shift((k:Int=>String) => k(8) + k(2)) + println("down " + x) + val y = shift((k:Int=>String) => k(3)) + println("down2 " + y) + y + x + } + } +} \ No newline at end of file diff --git a/test/files/continuations-neg/t2285.check b/test/files/continuations-neg/t2285.check new file mode 100644 index 0000000000..d5dff6a4f2 --- /dev/null +++ b/test/files/continuations-neg/t2285.check @@ -0,0 +1,6 @@ +t2285.scala:9: error: type mismatch; + found : Int @scala.util.continuations.cpsParam[String,String] @scala.util.continuations.cpsSynth + required: Int @scala.util.continuations.cpsParam[Int,String] + def foo() = reset { bar(); 7 } + ^ +one error found diff --git a/test/files/continuations-neg/t2285.scala b/test/files/continuations-neg/t2285.scala new file mode 100644 index 0000000000..f3c7f4c89c --- /dev/null +++ b/test/files/continuations-neg/t2285.scala @@ -0,0 +1,11 @@ +// $Id$ + +import scala.util.continuations._ + +object Test { + + def bar() = shift { k: (String => String) => k("1") } + + def foo() = reset { bar(); 7 } + +} diff --git a/test/files/continuations-neg/t2949.check b/test/files/continuations-neg/t2949.check new file mode 100644 index 0000000000..dd9768807c --- /dev/null +++ b/test/files/continuations-neg/t2949.check @@ -0,0 +1,6 @@ +t2949.scala:13: error: type mismatch; + found : Int + required: ? @scala.util.continuations.cpsParam[List[?],Any] + x * y + ^ +one error found diff --git a/test/files/continuations-neg/t2949.scala b/test/files/continuations-neg/t2949.scala new file mode 100644 index 0000000000..ce27c7c0e8 --- /dev/null +++ b/test/files/continuations-neg/t2949.scala @@ -0,0 +1,15 @@ +// $Id$ + +import scala.util.continuations._ + +object Test { + + def reflect[A,B](xs : List[A]) = shift{ xs.flatMap[B, List[B]] } + def reify[A, B](x : A @cpsParam[List[A], B]) = reset{ List(x) } + + def main(args: Array[String]): Unit = println(reify { + val x = reflect[Int, Int](List(1,2,3)) + val y = reflect[Int, Int](List(2,4,8)) + x * y + }) +} diff --git a/test/files/continuations-neg/trycatch2.check b/test/files/continuations-neg/trycatch2.check new file mode 100644 index 0000000000..5ff2838bad --- /dev/null +++ b/test/files/continuations-neg/trycatch2.check @@ -0,0 +1,7 @@ +trycatch2.scala:11: error: only simple cps types allowed in try/catch blocks (found: Int @scala.util.continuations.cpsParam[String,Int]) + def foo1 = try { + ^ +trycatch2.scala:19: error: only simple cps types allowed in try/catch blocks (found: Int @scala.util.continuations.cpsParam[String,Int]) + def foo2 = try { + ^ +two errors found diff --git a/test/files/continuations-neg/trycatch2.scala b/test/files/continuations-neg/trycatch2.scala new file mode 100644 index 0000000000..761cee52ac --- /dev/null +++ b/test/files/continuations-neg/trycatch2.scala @@ -0,0 +1,33 @@ +// $Id$ + +import scala.util.continuations._ + +object Test { + + def fatal[T]: T = throw new Exception + def cpsIntStringInt = shift { k:(Int=>String) => k(3); 7 } + def cpsIntIntString = shift { k:(Int=>Int) => k(3); "7" } + + def foo1 = try { + fatal[Int] + cpsIntStringInt + } catch { + case ex => + cpsIntStringInt + } + + def foo2 = try { + fatal[Int] + cpsIntStringInt + } catch { + case ex => + cpsIntStringInt + } + + + def main(args: Array[String]): Unit = { + println(reset { foo1; "3" }) + println(reset { foo2; "3" }) + } + +} \ No newline at end of file diff --git a/test/files/continuations-run/basics.check b/test/files/continuations-run/basics.check new file mode 100755 index 0000000000..54c059fdcb --- /dev/null +++ b/test/files/continuations-run/basics.check @@ -0,0 +1,2 @@ +28 +28 \ No newline at end of file diff --git a/test/files/continuations-run/basics.scala b/test/files/continuations-run/basics.scala new file mode 100755 index 0000000000..9df209b11c --- /dev/null +++ b/test/files/continuations-run/basics.scala @@ -0,0 +1,23 @@ +// $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 new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/files/continuations-run/function1.check @@ -0,0 +1 @@ +7 diff --git a/test/files/continuations-run/function1.scala b/test/files/continuations-run/function1.scala new file mode 100644 index 0000000000..3b39722e3a --- /dev/null +++ b/test/files/continuations-run/function1.scala @@ -0,0 +1,16 @@ +// $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 new file mode 100644 index 0000000000..c7930257df --- /dev/null +++ b/test/files/continuations-run/function4.check @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/test/files/continuations-run/function4.scala b/test/files/continuations-run/function4.scala new file mode 100644 index 0000000000..b73eedb02c --- /dev/null +++ b/test/files/continuations-run/function4.scala @@ -0,0 +1,15 @@ +// $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 new file mode 100644 index 0000000000..c7930257df --- /dev/null +++ b/test/files/continuations-run/function5.check @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/test/files/continuations-run/function5.scala b/test/files/continuations-run/function5.scala new file mode 100644 index 0000000000..a689ccf243 --- /dev/null +++ b/test/files/continuations-run/function5.scala @@ -0,0 +1,15 @@ +// $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 new file mode 100644 index 0000000000..c7930257df --- /dev/null +++ b/test/files/continuations-run/function6.check @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/test/files/continuations-run/function6.scala b/test/files/continuations-run/function6.scala new file mode 100644 index 0000000000..1a2792370a --- /dev/null +++ b/test/files/continuations-run/function6.scala @@ -0,0 +1,16 @@ +// $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 new file mode 100644 index 0000000000..f8bc79860d --- /dev/null +++ b/test/files/continuations-run/ifelse0.check @@ -0,0 +1,2 @@ +10 +9 \ No newline at end of file diff --git a/test/files/continuations-run/ifelse0.scala b/test/files/continuations-run/ifelse0.scala new file mode 100644 index 0000000000..e34b86ee84 --- /dev/null +++ b/test/files/continuations-run/ifelse0.scala @@ -0,0 +1,18 @@ +// $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 new file mode 100644 index 0000000000..86a3fbc0c1 --- /dev/null +++ b/test/files/continuations-run/ifelse1.check @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000000..2ccc1ed730 --- /dev/null +++ b/test/files/continuations-run/ifelse1.scala @@ -0,0 +1,25 @@ +// $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 new file mode 100644 index 0000000000..f97a95b08d --- /dev/null +++ b/test/files/continuations-run/ifelse2.check @@ -0,0 +1,4 @@ +abort +() +alive +() diff --git a/test/files/continuations-run/ifelse2.scala b/test/files/continuations-run/ifelse2.scala new file mode 100644 index 0000000000..536e350190 --- /dev/null +++ b/test/files/continuations-run/ifelse2.scala @@ -0,0 +1,16 @@ +// $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 new file mode 100644 index 0000000000..95b562c8e6 --- /dev/null +++ b/test/files/continuations-run/ifelse3.check @@ -0,0 +1,2 @@ +6 +9 diff --git a/test/files/continuations-run/ifelse3.scala b/test/files/continuations-run/ifelse3.scala new file mode 100644 index 0000000000..5dbd079d1c --- /dev/null +++ b/test/files/continuations-run/ifelse3.scala @@ -0,0 +1,21 @@ +// $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/infer1.scala b/test/files/continuations-run/infer1.scala new file mode 100644 index 0000000000..a6c6c07215 --- /dev/null +++ b/test/files/continuations-run/infer1.scala @@ -0,0 +1,33 @@ +// $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 new file mode 100644 index 0000000000..f8bc79860d --- /dev/null +++ b/test/files/continuations-run/match0.check @@ -0,0 +1,2 @@ +10 +9 \ No newline at end of file diff --git a/test/files/continuations-run/match0.scala b/test/files/continuations-run/match0.scala new file mode 100644 index 0000000000..bd36238d7f --- /dev/null +++ b/test/files/continuations-run/match0.scala @@ -0,0 +1,18 @@ +// $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 new file mode 100644 index 0000000000..73053d3f4f --- /dev/null +++ b/test/files/continuations-run/match1.check @@ -0,0 +1,2 @@ +10 +9 diff --git a/test/files/continuations-run/match1.scala b/test/files/continuations-run/match1.scala new file mode 100644 index 0000000000..ea4e219666 --- /dev/null +++ b/test/files/continuations-run/match1.scala @@ -0,0 +1,18 @@ +// $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 new file mode 100644 index 0000000000..cbf91349cc --- /dev/null +++ b/test/files/continuations-run/match2.check @@ -0,0 +1,2 @@ +B +B diff --git a/test/files/continuations-run/match2.scala b/test/files/continuations-run/match2.scala new file mode 100644 index 0000000000..8d4f04870f --- /dev/null +++ b/test/files/continuations-run/match2.scala @@ -0,0 +1,26 @@ +// $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]): Any = { + println(reset(test1())) + println(reset(test2())) + } + +} \ No newline at end of file diff --git a/test/files/continuations-run/t1807.check b/test/files/continuations-run/t1807.check new file mode 100644 index 0000000000..56a6051ca2 --- /dev/null +++ b/test/files/continuations-run/t1807.check @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/test/files/continuations-run/t1807.scala b/test/files/continuations-run/t1807.scala new file mode 100644 index 0000000000..278b3a9936 --- /dev/null +++ b/test/files/continuations-run/t1807.scala @@ -0,0 +1,14 @@ +// $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 new file mode 100644 index 0000000000..125c7c1cdf --- /dev/null +++ b/test/files/continuations-run/t1808.scala @@ -0,0 +1,10 @@ +// $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 new file mode 100644 index 0000000000..893ddab6d1 --- /dev/null +++ b/test/files/continuations-run/t1820.scala @@ -0,0 +1,14 @@ +// $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 new file mode 100644 index 0000000000..f7b76115db --- /dev/null +++ b/test/files/continuations-run/t1821.check @@ -0,0 +1,4 @@ +() +() +() +() \ No newline at end of file diff --git a/test/files/continuations-run/t1821.scala b/test/files/continuations-run/t1821.scala new file mode 100644 index 0000000000..0d5fb553be --- /dev/null +++ b/test/files/continuations-run/t1821.scala @@ -0,0 +1,20 @@ +// $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 new file mode 100644 index 0000000000..d411bb7c1a --- /dev/null +++ b/test/files/continuations-run/t2864.check @@ -0,0 +1 @@ +400 diff --git a/test/files/continuations-run/t2864.scala b/test/files/continuations-run/t2864.scala new file mode 100644 index 0000000000..7a2579e45c --- /dev/null +++ b/test/files/continuations-run/t2864.scala @@ -0,0 +1,30 @@ +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 new file mode 100644 index 0000000000..a92586538e --- /dev/null +++ b/test/files/continuations-run/t2934.check @@ -0,0 +1 @@ +List(3, 4, 5) diff --git a/test/files/continuations-run/t2934.scala b/test/files/continuations-run/t2934.scala new file mode 100644 index 0000000000..a1b8ca9e04 --- /dev/null +++ b/test/files/continuations-run/t2934.scala @@ -0,0 +1,10 @@ +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 new file mode 100644 index 0000000000..a065247b8c --- /dev/null +++ b/test/files/continuations-run/t3199.check @@ -0,0 +1 @@ +Right(7) diff --git a/test/files/continuations-run/t3199.scala b/test/files/continuations-run/t3199.scala new file mode 100644 index 0000000000..3fd2f1959a --- /dev/null +++ b/test/files/continuations-run/t3199.scala @@ -0,0 +1,20 @@ +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 new file mode 100644 index 0000000000..b5d8bb58d9 --- /dev/null +++ b/test/files/continuations-run/t3199b.check @@ -0,0 +1 @@ +[1, 2, 3] diff --git a/test/files/continuations-run/t3199b.scala b/test/files/continuations-run/t3199b.scala new file mode 100644 index 0000000000..950c584153 --- /dev/null +++ b/test/files/continuations-run/t3199b.scala @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/test/files/continuations-run/t3223.check @@ -0,0 +1 @@ +9 diff --git a/test/files/continuations-run/t3223.scala b/test/files/continuations-run/t3223.scala new file mode 100644 index 0000000000..4e510178e6 --- /dev/null +++ b/test/files/continuations-run/t3223.scala @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000000..df1a8a9ce4 --- /dev/null +++ b/test/files/continuations-run/t3225.check @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000000..ecfde279cf --- /dev/null +++ b/test/files/continuations-run/t3225.scala @@ -0,0 +1,56 @@ +// $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/trycatch0.check b/test/files/continuations-run/trycatch0.check new file mode 100644 index 0000000000..36806909d0 --- /dev/null +++ b/test/files/continuations-run/trycatch0.check @@ -0,0 +1,2 @@ +10 +10 \ No newline at end of file diff --git a/test/files/continuations-run/trycatch0.scala b/test/files/continuations-run/trycatch0.scala new file mode 100644 index 0000000000..74a078b5ef --- /dev/null +++ b/test/files/continuations-run/trycatch0.scala @@ -0,0 +1,25 @@ +// $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 new file mode 100644 index 0000000000..a028d2b1e1 --- /dev/null +++ b/test/files/continuations-run/trycatch1.check @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000000..ade13794e3 --- /dev/null +++ b/test/files/continuations-run/trycatch1.scala @@ -0,0 +1,48 @@ +// $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 new file mode 100644 index 0000000000..d58c55a31d --- /dev/null +++ b/test/files/continuations-run/while0.check @@ -0,0 +1 @@ +9000 diff --git a/test/files/continuations-run/while0.scala b/test/files/continuations-run/while0.scala new file mode 100644 index 0000000000..9735f9d2c3 --- /dev/null +++ b/test/files/continuations-run/while0.scala @@ -0,0 +1,22 @@ +// $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 new file mode 100644 index 0000000000..3d5f0b9a46 --- /dev/null +++ b/test/files/continuations-run/while1.check @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000000..fb5dc0079a --- /dev/null +++ b/test/files/continuations-run/while1.scala @@ -0,0 +1,22 @@ +// $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 new file mode 100644 index 0000000000..9fe515181b --- /dev/null +++ b/test/files/continuations-run/while2.check @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000000..f36288929e --- /dev/null +++ b/test/files/continuations-run/while2.scala @@ -0,0 +1,23 @@ +// $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/jvm/genericNest.scala b/test/files/jvm/genericNest.scala new file mode 100644 index 0000000000..c1b0210117 --- /dev/null +++ b/test/files/jvm/genericNest.scala @@ -0,0 +1,13 @@ +/** found in genericNest.jar, compiled from OuterTParams.java */ +import nestpkg._; + +// bug #695 +object ForceParse extends OuterTParams[AnyRef] { + // Force import of HarderToParse.InnerClass, + // which has confusing method signature. + var field: InnerClass = null +} + +object Test extends Application { + ForceParse +} diff --git a/test/files/jvm/genericNest/genericNest.jar.desired.sha1 b/test/files/jvm/genericNest/genericNest.jar.desired.sha1 deleted file mode 100644 index e9321262f2..0000000000 --- a/test/files/jvm/genericNest/genericNest.jar.desired.sha1 +++ /dev/null @@ -1 +0,0 @@ -b1ec8a095cec4902b3609d74d274c04365c59c04 ?genericNest.jar diff --git a/test/files/jvm/genericNest/genericNest.scala b/test/files/jvm/genericNest/genericNest.scala deleted file mode 100644 index c1b0210117..0000000000 --- a/test/files/jvm/genericNest/genericNest.scala +++ /dev/null @@ -1,13 +0,0 @@ -/** found in genericNest.jar, compiled from OuterTParams.java */ -import nestpkg._; - -// bug #695 -object ForceParse extends OuterTParams[AnyRef] { - // Force import of HarderToParse.InnerClass, - // which has confusing method signature. - var field: InnerClass = null -} - -object Test extends Application { - ForceParse -} diff --git a/test/files/jvm/lib/annotations.jar.desired.sha1 b/test/files/jvm/lib/annotations.jar.desired.sha1 deleted file mode 100644 index 2b4292d796..0000000000 --- a/test/files/jvm/lib/annotations.jar.desired.sha1 +++ /dev/null @@ -1 +0,0 @@ -02fe2ed93766323a13f22c7a7e2ecdcd84259b6c ?annotations.jar diff --git a/test/files/jvm/lib/nest.jar.desired.sha1 b/test/files/jvm/lib/nest.jar.desired.sha1 deleted file mode 100644 index 674ca79a5b..0000000000 --- a/test/files/jvm/lib/nest.jar.desired.sha1 +++ /dev/null @@ -1 +0,0 @@ -cd33e0a0ea249eb42363a2f8ba531186345ff68c ?nest.jar diff --git a/test/files/jvm/methvsfield.java b/test/files/jvm/methvsfield.java new file mode 100644 index 0000000000..dadc98669a --- /dev/null +++ b/test/files/jvm/methvsfield.java @@ -0,0 +1,11 @@ +// This should be compiled with javac and saved +// in ../lib/methvsfield.jar . +class MethVsField +{ + int three = 3; + + int three() + { + return 3; + } +} diff --git a/test/files/jvm/methvsfield.scala b/test/files/jvm/methvsfield.scala new file mode 100644 index 0000000000..e9795ec6a8 --- /dev/null +++ b/test/files/jvm/methvsfield.scala @@ -0,0 +1,4 @@ +// bug #1062 +object Test extends Application { + println((new MethVsField).three) +} diff --git a/test/files/jvm/nest.java b/test/files/jvm/nest.java new file mode 100644 index 0000000000..3f6f0bebbd --- /dev/null +++ b/test/files/jvm/nest.java @@ -0,0 +1,38 @@ +package nestpkg; + + +/** This file is needed for test 'nest.scala'. It should + * be compiled with javac and packaged into lib/nest.jar + */ +public class nest { + public static class best { + public static class rest { + public static rest test = new rest(); + public static int x = 10; + public int inc(int i) { + return i + 1; + } + } + } + + + String name = "Outer name"; + + public class Inn { + int x; + + public Inn(int x) { + this.x = x; + } + + public void doSomething() { + System.out.println("Inn " + name + " x: " + x); + } + } + + protected class ProtInn { + public void doSomething() { + System.out.println("ProtInn " + name); + } + } +} diff --git a/test/files/jvm/nest.scala b/test/files/jvm/nest.scala new file mode 100644 index 0000000000..3ab62484fa --- /dev/null +++ b/test/files/jvm/nest.scala @@ -0,0 +1,21 @@ +//############################################################################ +// Test Scala interaction with Java nested classes and static members. +//############################################################################ + +/** found in nest.jar, compiled from nest.java */ +import nestpkg._; + +object Test extends Application { + val x = nest.best.rest.test + Console.println(x.inc(1)) + + val o = new nest.best; + val r = new nest.best.rest; + Console.println(nest.best.rest.test.inc(2)) + Console.println(nest.best.rest.x) + + print("Instantiating public inner class: ") + val outer = new nest + val inn = new outer.Inn(42) + inn.doSomething +} diff --git a/test/files/jvm/outerEnum.scala b/test/files/jvm/outerEnum.scala new file mode 100644 index 0000000000..18794b7dbe --- /dev/null +++ b/test/files/jvm/outerEnum.scala @@ -0,0 +1,9 @@ +import enums._ + +object Test extends Application { + def foo { + val res: OuterEnum.Foo = OuterEnum.Foo.Bar + println(res) + } + foo +} diff --git a/test/files/jvm/outerEnum/enums.jar.desired.sha1 b/test/files/jvm/outerEnum/enums.jar.desired.sha1 deleted file mode 100644 index 46cd8e92cf..0000000000 --- a/test/files/jvm/outerEnum/enums.jar.desired.sha1 +++ /dev/null @@ -1 +0,0 @@ -981392dbd1f727b152cd1c908c5fce60ad9d07f7 ?enums.jar diff --git a/test/files/jvm/outerEnum/outerEnum.scala b/test/files/jvm/outerEnum/outerEnum.scala deleted file mode 100644 index 18794b7dbe..0000000000 --- a/test/files/jvm/outerEnum/outerEnum.scala +++ /dev/null @@ -1,9 +0,0 @@ -import enums._ - -object Test extends Application { - def foo { - val res: OuterEnum.Foo = OuterEnum.Foo.Bar - println(res) - } - foo -} diff --git a/test/files/jvm/t1652.check b/test/files/jvm/t1652.check new file mode 100644 index 0000000000..dfa480ce6e --- /dev/null +++ b/test/files/jvm/t1652.check @@ -0,0 +1,2 @@ +OK1 +OK2 diff --git a/test/files/lib/annotations.jar.desired.sha1 b/test/files/lib/annotations.jar.desired.sha1 new file mode 100644 index 0000000000..2b4292d796 --- /dev/null +++ b/test/files/lib/annotations.jar.desired.sha1 @@ -0,0 +1 @@ +02fe2ed93766323a13f22c7a7e2ecdcd84259b6c ?annotations.jar diff --git a/test/files/lib/enums.jar.desired.sha1 b/test/files/lib/enums.jar.desired.sha1 new file mode 100644 index 0000000000..46cd8e92cf --- /dev/null +++ b/test/files/lib/enums.jar.desired.sha1 @@ -0,0 +1 @@ +981392dbd1f727b152cd1c908c5fce60ad9d07f7 ?enums.jar diff --git a/test/files/lib/genericNest.jar.desired.sha1 b/test/files/lib/genericNest.jar.desired.sha1 new file mode 100644 index 0000000000..e9321262f2 --- /dev/null +++ b/test/files/lib/genericNest.jar.desired.sha1 @@ -0,0 +1 @@ +b1ec8a095cec4902b3609d74d274c04365c59c04 ?genericNest.jar diff --git a/test/files/lib/methvsfield.jar.desired.sha1 b/test/files/lib/methvsfield.jar.desired.sha1 new file mode 100644 index 0000000000..8c01532b88 --- /dev/null +++ b/test/files/lib/methvsfield.jar.desired.sha1 @@ -0,0 +1 @@ +be8454d5e7751b063ade201c225dcedefd252775 ?methvsfield.jar diff --git a/test/files/lib/nest.jar.desired.sha1 b/test/files/lib/nest.jar.desired.sha1 new file mode 100644 index 0000000000..674ca79a5b --- /dev/null +++ b/test/files/lib/nest.jar.desired.sha1 @@ -0,0 +1 @@ +cd33e0a0ea249eb42363a2f8ba531186345ff68c ?nest.jar diff --git a/test/files/lib/scalacheck.jar.desired.sha1 b/test/files/lib/scalacheck.jar.desired.sha1 new file mode 100644 index 0000000000..ed9c46c3db --- /dev/null +++ b/test/files/lib/scalacheck.jar.desired.sha1 @@ -0,0 +1 @@ +4c76385b1a9cb7cd619739776b940d98c4aadc6d ?scalacheck.jar diff --git a/test/files/neg/bug414.scala b/test/files/neg/bug414.scala index 7983fe88b9..2bc83eedcb 100644 --- a/test/files/neg/bug414.scala +++ b/test/files/neg/bug414.scala @@ -1,4 +1,4 @@ -case class Empty[a] extends IntMap[a]; +case class Empty[a]() extends IntMap[a]; case class Node[a](left: IntMap[a], keyVal: Pair[Int, a], right: IntMap[a]) extends IntMap[a]; abstract class IntMap[a] { def lookup(key: Int): a = this match { diff --git a/test/files/neg/migration28.check b/test/files/neg/migration28.check index 9e042a0f0b..4c8c58e0fd 100644 --- a/test/files/neg/migration28.check +++ b/test/files/neg/migration28.check @@ -1,5 +1,4 @@ -migration28.scala:5: error: method ++= in class Stack has changed semantics: -Stack ++= now pushes arguments on the stack from left to right. +migration28.scala:5: error: method ++= in class Stack is deprecated: use pushAll s ++= List(1,2,3) ^ migration28.scala:7: error: method foreach in class Stack has changed semantics: diff --git a/test/files/pos/spec-traits.scala b/test/files/pos/spec-traits.scala deleted file mode 100644 index 9e339a14ad..0000000000 --- a/test/files/pos/spec-traits.scala +++ /dev/null @@ -1,83 +0,0 @@ -trait A[@specialized(Int) T] { def foo: T } -class B extends A[Int] { val foo = 10 } -class C extends B - -// issue 3309 -class Lazy { - def test[U](block: => U): Unit = { block } - - test { lazy val x = 1 } -} - -// issue 3307 -class Bug3307 { - def f[Z](block: String => Z) { - block("abc") - } - - ({ () => - f { implicit x => println(x) } })() -} - -// issue 3301 - trait T[X] - -class Bug3301 { - def t[A]: T[A] = error("stub") - - () => { - type X = Int - - def foo[X] = t[X] - () - } -} -// issue 3299 -object Failure { - def thunk() { - for (i <- 1 to 2) { - val Array(a, b) = Array(1,2) - () - } - } -} - -// issue 3296 - -object AA -{ - def f(block: => Unit) {} - - object BB - { - f { - object CC - - () - } - } - - def foo[T](x: T) = { object A; false } -} - -// issue 3292 -import scala.swing._ -import scala.swing.GridBagPanel._ - -object Grid { - - def later(code : => Unit) = - javax.swing.SwingUtilities.invokeLater(new Runnable { def run { code }}) - - def test = later { - val frame = new Dialog { - contents = new GridBagPanel { - val c = new Constraints - } - } - } - -} - -// issue 3325 -object O { def f[@specialized T] { for(k <- Nil: List[T]) { } } } diff --git a/test/files/pos/t1254/t1254.java b/test/files/pos/t1254/t1254.java deleted file mode 100644 index 25b733cf28..0000000000 --- a/test/files/pos/t1254/t1254.java +++ /dev/null @@ -1,28 +0,0 @@ -/* Taken from ticket #1254. Tests Java signatures in mirror classes and that - Nothing is translated to Nothing$. -*/ - -import scala.None; - -// This compiles with javac but fails with Eclipse java compiler: -// 'The type scala.Nothing cannot be resolved. It is indirectly referenced from required .class files' -class NothingBug3 { - public NothingBug3() { - scala.Option o = scala.None$.MODULE$; - - test(o); - None.toLeft(new scala.Function0() { - public Integer apply() { return 0; } - }); - } - - public void test(scala.Option f) {} -} - -// This compiles with javac but fails with Eclipse java compiler: -// 'The type scala.Nothing cannot be resolved. It is indirectly referenced from required .class files' -class NothingBug4 { - public NothingBug4() { - scala.Option o = scala.None$.MODULE$; - } -} diff --git a/test/files/res/bug687.check b/test/files/res/bug687.check index 353101c38b..ee9520d1ea 100644 --- a/test/files/res/bug687.check +++ b/test/files/res/bug687.check @@ -1,10 +1,11 @@ + nsc> -nsc> -bug687/QueryB.scala:3: error: name clash between defined and inherited member: +nsc> bug687/QueryB.scala:3: error: name clash between defined and inherited member: method equals:(o: java.lang.Object)Boolean and method equals:(x$1: Any)Boolean in class Any have same type after erasure: (o: java.lang.Object)Boolean override def equals(o : Object) = false; ^ + nsc> nsc> diff --git a/test/files/run/numbereq.scala b/test/files/run/numbereq.scala index 52f32cc52a..b07c83dc3e 100644 --- a/test/files/run/numbereq.scala +++ b/test/files/run/numbereq.scala @@ -33,7 +33,7 @@ object Test { val sets = setneg1 ++ setneg2 ++ List(zero) ++ setpos1 ++ setpos2 for (set <- sets ; x <- set ; y <- set) { - println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##)) + // println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##)) assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass)) assert(x.## == y.##, "%s != %s".format(x.getClass, y.getClass)) } diff --git a/test/files/run/programmatic-main.check b/test/files/run/programmatic-main.check index 3429195265..e6c83a6f48 100644 --- a/test/files/run/programmatic-main.check +++ b/test/files/run/programmatic-main.check @@ -5,9 +5,7 @@ typer superaccessors pickler refchecks -selectiveanf liftcode -selectivecps uncurry tailcalls specialize diff --git a/test/files/run/stream_length.scala b/test/files/run/stream_length.scala deleted file mode 100644 index 68e9cad5ac..0000000000 --- a/test/files/run/stream_length.scala +++ /dev/null @@ -1,15 +0,0 @@ - - -object Test { - def walk(depth: Int, bias: String): Stream[String] = { - if (depth == 0) - Stream(bias) - else { - Stream.concat(Stream.range(1, 100).map((x: Int) => walk(depth-1, bias + x))) - } - } - - def main(args: Array[String]) { - println("Length: " + walk(3, "---").length) - } -} diff --git a/test/files/run/t2946/Parsers.scala b/test/files/run/t2946/Parsers.scala deleted file mode 100644 index c0961034c4..0000000000 --- a/test/files/run/t2946/Parsers.scala +++ /dev/null @@ -1,4 +0,0 @@ -class Parser { - def parse(t: Any): Unit = { - } -} diff --git a/test/files/run/t2946/ResponseCommon.scala b/test/files/run/t2946/ResponseCommon.scala deleted file mode 100644 index fa9d8acccb..0000000000 --- a/test/files/run/t2946/ResponseCommon.scala +++ /dev/null @@ -1,14 +0,0 @@ -trait ResponseCommon extends Parser { - private[this] var paramsParser: Parser = null - def withParamsParser(parser: Parser) = {paramsParser = parser; this} - - class Foo { - println(paramsParser) - } - - override abstract def parse(t: Any): Unit = t match { - case ("params", value: List[_]) => value.foreach {paramsParser.parse(_)} - case _ => super.parse(t) - } -} - diff --git a/test/files/run/t2946/Test.scala b/test/files/run/t2946/Test.scala deleted file mode 100644 index e9d9896a0e..0000000000 --- a/test/files/run/t2946/Test.scala +++ /dev/null @@ -1,7 +0,0 @@ -class Test extends Parser with ResponseCommon - -object Test { - def main(args: Array[String]) { - new Test - } -} diff --git a/test/files/scalacheck/redblack.scala b/test/files/scalacheck/redblack.scala deleted file mode 100644 index 0334c1218d..0000000000 --- a/test/files/scalacheck/redblack.scala +++ /dev/null @@ -1,157 +0,0 @@ -import org.scalacheck._ -import Prop._ -import Gen._ - -/* -Properties of a Red & Black Tree: - -A node is either red or black. -The root is black. (This rule is used in some definitions and not others. Since the -root can always be changed from red to black but not necessarily vice-versa this -rule has little effect on analysis.) -All leaves are black. -Both children of every red node are black. -Every simple path from a given node to any of its descendant leaves contains the same number of black nodes. -*/ - -abstract class RedBlackTest extends Properties("RedBlack") { - object RedBlackTest extends scala.collection.immutable.RedBlack[Int] { - def isSmaller(x: Int, y: Int) = x < y - } - - import RedBlackTest._ - - def rootIsBlack[A](t: Tree[A]) = t.isBlack - - def areAllLeavesBlack[A](t: Tree[A]): Boolean = t match { - case Empty => t.isBlack - case ne: NonEmpty[_] => List(ne.left, ne.right) forall areAllLeavesBlack - } - - def areRedNodeChildrenBlack[A](t: Tree[A]): Boolean = t match { - case RedTree(_, _, left, right) => List(left, right) forall (t => t.isBlack && areRedNodeChildrenBlack(t)) - case BlackTree(_, _, left, right) => List(left, right) forall areRedNodeChildrenBlack - case Empty => true - } - - def blackNodesToLeaves[A](t: Tree[A]): List[Int] = t match { - case Empty => List(1) - case BlackTree(_, _, left, right) => List(left, right) flatMap blackNodesToLeaves map (_ + 1) - case RedTree(_, _, left, right) => List(left, right) flatMap blackNodesToLeaves - } - - def areBlackNodesToLeavesEqual[A](t: Tree[A]): Boolean = t match { - case Empty => true - case ne: NonEmpty[_] => - ( - blackNodesToLeaves(ne).removeDuplicates.size == 1 - && areBlackNodesToLeavesEqual(ne.left) - && areBlackNodesToLeavesEqual(ne.right) - ) - } - - def orderIsPreserved[A](t: Tree[A]): Boolean = t match { - case Empty => true - case ne: NonEmpty[_] => - ( - (ne.left.iterator map (_._1) forall (isSmaller(_, ne.key))) - && (ne.right.iterator map (_._1) forall (isSmaller(ne.key, _))) - && (List(ne.left, ne.right) forall orderIsPreserved) - ) - } - - def setup(l: List[Int], invariant: Tree[Unit] => Boolean): (Boolean, Tree[Unit]) - - def listNoRepetitions(size: Int) = for { - s <- Gen.choose(1, size) - l <- Gen.listOfN(size, Gen.choose(0, Int.MaxValue)) suchThat (l => l.size == l.removeDuplicates.size) - } yield l - def listFewRepetitions(size: Int) = for { - s <- Gen.choose(1, size) - l <- Gen.listOfN(s, Gen.choose(0, size * 4)) suchThat (l => l.size != l.removeDuplicates.size) - } yield l - def listManyRepetitions(size: Int) = for { - s <- Gen.choose(1, size) - l <- Gen.listOfN(s, Gen.choose(0, size)) suchThat (l => l.size != l.removeDuplicates.size) - } yield l - def listEvenRepetitions(size: Int) = listFewRepetitions(size) map (x => - scala.util.Random.shuffle(x zip x flatMap { case (a, b) => List(a, b) }) - ) - - // Arbitrarily weighted list distribution types - val seqType: Gen[Int => Gen[List[Int]]] - - def myGen(sized: Int) = for { - size <- Gen.choose(0, sized) - seq <- seqType - list <- seq(size) - } yield list - - property("root is black") = forAll(myGen(10)) { l => - setup(l, rootIsBlack)._1 :| setup(l, rootIsBlack)._2.toString - } - property("all leaves are black") = forAll(myGen(50)) { l => - setup(l, areAllLeavesBlack)._1 :| setup(l, areAllLeavesBlack)._2.toString - } - property("children of red nodes are black") = forAll(myGen(50)) { l => - setup(l, areRedNodeChildrenBlack)._1 :| setup(l, areRedNodeChildrenBlack)._2.toString - } - property("Every path from a node to its descendant leaves contains the same number of black nodes") = forAll(myGen(50)) { l => - setup(l, areBlackNodesToLeavesEqual)._1 :| setup(l, areBlackNodesToLeavesEqual)._2.toString - } - property("Ordering of keys is preserved") = forAll(myGen(50)) { l => - setup(l, orderIsPreserved)._1 :| setup(l, orderIsPreserved)._2.toString - } -} - -object TestInsertion extends RedBlackTest { - import RedBlackTest._ - override val seqType = Gen.frequency( - (1, listNoRepetitions _), - (1, listManyRepetitions _) - ) - - property("update adds elements") = forAll(myGen(50)) { l => - val tree = l.foldLeft(Empty: Tree[Unit])((acc, n) => acc update (n, ())) - forAll(Gen.pick(1, l)) ( n => !(tree lookup n.head isEmpty) :| "Tree: "+tree+" N: "+n.head ) - } - - override def setup(l: List[Int], invariant: Tree[Unit] => Boolean) = l.foldLeft((true, Empty: Tree[Unit])) { - case ((true, acc), n) => - val newRoot = acc update (n, ()) - (invariant(newRoot), newRoot) - case (failed, _) => failed - } -} - -object TestDeletion extends RedBlackTest { - import RedBlackTest._ - override val seqType = Gen.frequency( - (2, listFewRepetitions _), - (3, listManyRepetitions _), - (1, listEvenRepetitions _) - ) - - property("delete removes elements") = forAll(myGen(50)) { l => - val tree = l.foldLeft(Empty: Tree[Unit])((acc, n) => acc update (n, ())) - forAll(Gen.choose(1, l.size)) { numberOfElementsToRemove => - forAll(Gen.pick(numberOfElementsToRemove, l)) { elementsToRemove => - val newTree = elementsToRemove.foldLeft(tree)((acc, n) => acc delete n) - (elementsToRemove forall (n => newTree lookup n isEmpty)) :| "Tree: "+tree+"New Tree: "+newTree+" Elements to Remove: "+elementsToRemove - } - } - } - - override def setup(l: List[Int], invariant: Tree[Unit] => Boolean) = l.foldLeft((true, Empty: Tree[Unit])) { - case ((true, acc), n) => - val newRoot = if (acc lookup n isEmpty) acc update (n, ()) else acc delete n - (invariant(newRoot), newRoot) - case (failed, _) => failed - } -} - -object Test extends Properties("RedBlack") { - include(TestInsertion) - include(TestDeletion) -} - -- cgit v1.2.3