summaryrefslogtreecommitdiff
path: root/test/files/run/run-bug4840.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-07-27 00:52:47 +0000
committerPaul Phillips <paulp@improving.org>2011-07-27 00:52:47 +0000
commit401baad565218da34558318ebd1f65edb31b39c8 (patch)
tree6177a99518fe598e51dd3d02aa9666c4fd27bacb /test/files/run/run-bug4840.scala
parent68031b3af11a2f79b186607f44d5c327051d19bd (diff)
downloadscala-401baad565218da34558318ebd1f65edb31b39c8.tar.gz
scala-401baad565218da34558318ebd1f65edb31b39c8.tar.bz2
scala-401baad565218da34558318ebd1f65edb31b39c8.zip
Fix/workaround for inliner bug uncovered by fin...
Fix/workaround for inliner bug uncovered by finalizing Option methods. Something in the backend is leaving open but empty blocks in the worklist. Rather than freaking out at the merest mention of an empty block, I quietly remove the empty ones. A proper fix will involve not leaving empty blocks lying around but we're on a schedule here people. Review by dragos.
Diffstat (limited to 'test/files/run/run-bug4840.scala')
-rw-r--r--test/files/run/run-bug4840.scala30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/files/run/run-bug4840.scala b/test/files/run/run-bug4840.scala
new file mode 100644
index 0000000000..dda280fd17
--- /dev/null
+++ b/test/files/run/run-bug4840.scala
@@ -0,0 +1,30 @@
+object Test {
+ def g(x: Boolean): Option[String] = if (x) Some("booya") else None
+
+ def f1() = {
+ for (x <- g(true)) yield {
+ g(false) match {
+ case Some(_) => sys.error("")
+ case None => 5
+ }
+ }
+ }
+
+ def f2() = {
+ for (x <- g(true) ; y <- g(true) ; z <- g(true)) yield {
+ for (x <- g(true) ; y <- g(true) ; z <- g(true)) yield {
+ g(true) map { _ =>
+ (null: Any) match {
+ case Some(x: Int) => x
+ case _ => 5
+ }
+ }
+ }
+ }
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f1())
+ println(f2())
+ }
+}