diff options
author | Tiark Rompf <tiark.rompf@epfl.ch> | 2010-03-22 16:52:10 +0000 |
---|---|---|
committer | Tiark Rompf <tiark.rompf@epfl.ch> | 2010-03-22 16:52:10 +0000 |
commit | a263215e095d8168ed78b16c829a56ff48b2f9b6 (patch) | |
tree | 3ae5da4071776d431c75bdf2eef64c4911ea24e8 /test | |
parent | 1935b66102808cc72262cffca3546f4bb5b7baac (diff) | |
download | scala-a263215e095d8168ed78b16c829a56ff48b2f9b6.tar.gz scala-a263215e095d8168ed78b16c829a56ff48b2f9b6.tar.bz2 scala-a263215e095d8168ed78b16c829a56ff48b2f9b6.zip |
closes #3199. review by community.
Diffstat (limited to 'test')
-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 |