diff options
author | Tiark Rompf <tiark.rompf@epfl.ch> | 2010-03-16 08:19:59 +0000 |
---|---|---|
committer | Tiark Rompf <tiark.rompf@epfl.ch> | 2010-03-16 08:19:59 +0000 |
commit | 166c496d5784d0be3611b270d9eba39f1273e048 (patch) | |
tree | bb52feed6cd9221f98d36edf9da303336098ad89 /test/files/continuations-neg/trycatch2.scala | |
parent | 324eeff963585af9248885473beeabfe8770ed68 (diff) | |
download | scala-166c496d5784d0be3611b270d9eba39f1273e048.tar.gz scala-166c496d5784d0be3611b270d9eba39f1273e048.tar.bz2 scala-166c496d5784d0be3611b270d9eba39f1273e048.zip |
added support for continuations in try/catch bl...
added support for continuations in try/catch blocks. review by
community.
Diffstat (limited to 'test/files/continuations-neg/trycatch2.scala')
-rw-r--r-- | test/files/continuations-neg/trycatch2.scala | 33 |
1 files changed, 33 insertions, 0 deletions
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 |