From 3db29dde051614d976bca92a1cdeb109c9c0ab01 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 22 Mar 2012 23:27:22 -0700 Subject: Test case for cause of previous commit's reversion. --- test/files/run/nonlocalreturn.check | 1 + test/files/run/nonlocalreturn.scala | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/files/run/nonlocalreturn.check create mode 100644 test/files/run/nonlocalreturn.scala (limited to 'test') diff --git a/test/files/run/nonlocalreturn.check b/test/files/run/nonlocalreturn.check new file mode 100644 index 0000000000..aeb2d5e239 --- /dev/null +++ b/test/files/run/nonlocalreturn.check @@ -0,0 +1 @@ +Some(1) diff --git a/test/files/run/nonlocalreturn.scala b/test/files/run/nonlocalreturn.scala new file mode 100644 index 0000000000..3c1e7420ed --- /dev/null +++ b/test/files/run/nonlocalreturn.scala @@ -0,0 +1,15 @@ +object Test { + def wrap[K](body: => K): K = body + + def f(): Option[Int] = { + wrap({ return Some(1) ; None }) + } + + def main(args: Array[String]) { + println(f()) + } +} +// java.lang.ClassCastException: scala.Some cannot be cast to scala.None$ +// at Test$$anonfun$f$1.apply(nonlocalreturn.scala:5) +// at Test$$anonfun$f$1.apply(nonlocalreturn.scala:5) +// at Test$.wrap(nonlocalreturn.scala:2) -- cgit v1.2.3