diff options
Diffstat (limited to 'test/files/continuations-run')
-rw-r--r-- | test/files/continuations-run/t3199.check | 1 | ||||
-rw-r--r-- | test/files/continuations-run/t3199.scala | 20 | ||||
-rw-r--r-- | test/files/continuations-run/t3199b.check | 1 | ||||
-rw-r--r-- | test/files/continuations-run/t3199b.scala | 11 |
4 files changed, 33 insertions, 0 deletions
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 |