diff options
author | Paul Phillips <paulp@improving.org> | 2012-02-27 21:58:26 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-27 22:12:52 -0800 |
commit | 0bcc8f8f92bbee772924813d00512f3765d4beee (patch) | |
tree | 98e9d0320fb8be7ee91ffe3312631b0c867106e1 /test/files/run | |
parent | 07ffa8d66dedcf2bf2ac26d5e31f09922f5479ce (diff) | |
download | scala-0bcc8f8f92bbee772924813d00512f3765d4beee.tar.gz scala-0bcc8f8f92bbee772924813d00512f3765d4beee.tar.bz2 scala-0bcc8f8f92bbee772924813d00512f3765d4beee.zip |
Specialized NonLocalReturnControl.
From the extempore archive of already implemented things.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/spec-nlreturn.check | 2 | ||||
-rw-r--r-- | test/files/run/spec-nlreturn.scala | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/spec-nlreturn.check b/test/files/run/spec-nlreturn.check new file mode 100644 index 0000000000..26cff07360 --- /dev/null +++ b/test/files/run/spec-nlreturn.check @@ -0,0 +1,2 @@ +scala.runtime.NonLocalReturnControl$mcI$sp +16 diff --git a/test/files/run/spec-nlreturn.scala b/test/files/run/spec-nlreturn.scala new file mode 100644 index 0000000000..ec5e7229d3 --- /dev/null +++ b/test/files/run/spec-nlreturn.scala @@ -0,0 +1,16 @@ +object Test { + def f(): Int = { + try { + val g = 1 to 10 map { i => return 16 ; i } sum; + g + } + catch { case x: runtime.NonLocalReturnControl[_] => + println(x.getClass.getName) + x.value.asInstanceOf[Int] + } + } + + def main(args: Array[String]): Unit = { + println(f()) + } +} |