summaryrefslogtreecommitdiff
path: root/test/continuations/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/continuations/neg')
-rw-r--r--test/continuations/neg/function0.check6
-rw-r--r--test/continuations/neg/function0.scala16
-rw-r--r--test/continuations/neg/function2.check6
-rw-r--r--test/continuations/neg/function2.scala16
-rw-r--r--test/continuations/neg/function3.check6
-rw-r--r--test/continuations/neg/function3.scala15
-rw-r--r--test/continuations/neg/infer0.check4
-rw-r--r--test/continuations/neg/infer0.scala14
-rw-r--r--test/continuations/neg/infer2.check4
-rw-r--r--test/continuations/neg/infer2.scala19
-rw-r--r--test/continuations/neg/lazy.check6
-rw-r--r--test/continuations/neg/lazy.scala16
-rw-r--r--test/continuations/neg/t1929.check6
-rw-r--r--test/continuations/neg/t1929.scala17
-rw-r--r--test/continuations/neg/t2285.check6
-rw-r--r--test/continuations/neg/t2285.scala11
-rw-r--r--test/continuations/neg/t2949.check6
-rw-r--r--test/continuations/neg/t2949.scala15
-rw-r--r--test/continuations/neg/trycatch2.check7
-rw-r--r--test/continuations/neg/trycatch2.scala33
20 files changed, 229 insertions, 0 deletions
diff --git a/test/continuations/neg/function0.check b/test/continuations/neg/function0.check
new file mode 100644
index 0000000000..0a66763a0f
--- /dev/null
+++ b/test/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/continuations/neg/function0.scala b/test/continuations/neg/function0.scala
new file mode 100644
index 0000000000..4112ee3835
--- /dev/null
+++ b/test/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/continuations/neg/function2.check b/test/continuations/neg/function2.check
new file mode 100644
index 0000000000..4833057652
--- /dev/null
+++ b/test/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/continuations/neg/function2.scala b/test/continuations/neg/function2.scala
new file mode 100644
index 0000000000..ae0fda509d
--- /dev/null
+++ b/test/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/continuations/neg/function3.check b/test/continuations/neg/function3.check
new file mode 100644
index 0000000000..4705ad9ed9
--- /dev/null
+++ b/test/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/continuations/neg/function3.scala b/test/continuations/neg/function3.scala
new file mode 100644
index 0000000000..0c3f1667e5
--- /dev/null
+++ b/test/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/continuations/neg/infer0.check b/test/continuations/neg/infer0.check
new file mode 100644
index 0000000000..1dd072ef09
--- /dev/null
+++ b/test/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/continuations/neg/infer0.scala b/test/continuations/neg/infer0.scala
new file mode 100644
index 0000000000..894d5228b1
--- /dev/null
+++ b/test/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/continuations/neg/infer2.check b/test/continuations/neg/infer2.check
new file mode 100644
index 0000000000..59eb670bc3
--- /dev/null
+++ b/test/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/continuations/neg/infer2.scala b/test/continuations/neg/infer2.scala
new file mode 100644
index 0000000000..a890ac1fc4
--- /dev/null
+++ b/test/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/continuations/neg/lazy.check b/test/continuations/neg/lazy.check
new file mode 100644
index 0000000000..bfa44c59a4
--- /dev/null
+++ b/test/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/continuations/neg/lazy.scala b/test/continuations/neg/lazy.scala
new file mode 100644
index 0000000000..dffc57ffa0
--- /dev/null
+++ b/test/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/continuations/neg/t1929.check b/test/continuations/neg/t1929.check
new file mode 100644
index 0000000000..f42c3a1e15
--- /dev/null
+++ b/test/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/continuations/neg/t1929.scala b/test/continuations/neg/t1929.scala
new file mode 100644
index 0000000000..02eda9170d
--- /dev/null
+++ b/test/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/continuations/neg/t2285.check b/test/continuations/neg/t2285.check
new file mode 100644
index 0000000000..d5dff6a4f2
--- /dev/null
+++ b/test/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/continuations/neg/t2285.scala b/test/continuations/neg/t2285.scala
new file mode 100644
index 0000000000..f3c7f4c89c
--- /dev/null
+++ b/test/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/continuations/neg/t2949.check b/test/continuations/neg/t2949.check
new file mode 100644
index 0000000000..dd9768807c
--- /dev/null
+++ b/test/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/continuations/neg/t2949.scala b/test/continuations/neg/t2949.scala
new file mode 100644
index 0000000000..ce27c7c0e8
--- /dev/null
+++ b/test/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/continuations/neg/trycatch2.check b/test/continuations/neg/trycatch2.check
new file mode 100644
index 0000000000..5ff2838bad
--- /dev/null
+++ b/test/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/continuations/neg/trycatch2.scala b/test/continuations/neg/trycatch2.scala
new file mode 100644
index 0000000000..761cee52ac
--- /dev/null
+++ b/test/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