From 166c496d5784d0be3611b270d9eba39f1273e048 Mon Sep 17 00:00:00 2001 From: Tiark Rompf Date: Tue, 16 Mar 2010 08:19:59 +0000 Subject: added support for continuations in try/catch bl... added support for continuations in try/catch blocks. review by community. --- test/files/continuations-neg/trycatch2.check | 7 ++++++ test/files/continuations-neg/trycatch2.scala | 33 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 test/files/continuations-neg/trycatch2.check create mode 100644 test/files/continuations-neg/trycatch2.scala (limited to 'test/files/continuations-neg') 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 -- cgit v1.2.3