|
Scala example source code file (run-bug4840.scala)
The Scala run-bug4840.scala source codeobject 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()) } } Other Scala examples (source code examples)Here is a short list of links related to this Scala run-bug4840.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.