diff options
author | Paul Phillips <paulp@improving.org> | 2012-03-22 23:27:22 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-03-22 23:29:30 -0700 |
commit | 3db29dde051614d976bca92a1cdeb109c9c0ab01 (patch) | |
tree | c3ff93c6d9ed17bc2518fd96df9bb6c174cfa34b /test/files/run | |
parent | 5af2bf54d21ac63236cd6e68586b2c38fa0f28c3 (diff) | |
download | scala-3db29dde051614d976bca92a1cdeb109c9c0ab01.tar.gz scala-3db29dde051614d976bca92a1cdeb109c9c0ab01.tar.bz2 scala-3db29dde051614d976bca92a1cdeb109c9c0ab01.zip |
Test case for cause of previous commit's reversion.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/nonlocalreturn.check | 1 | ||||
-rw-r--r-- | test/files/run/nonlocalreturn.scala | 15 |
2 files changed, 16 insertions, 0 deletions
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) |