Details
-
Type:
Bug
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: Scala 2.9.1, Scala 2.10.0
-
Fix Version/s: Backlog
-
Component/s: Type Inference
Description
class Result[+A]
|
|
case class Success[A](x: A) extends Result[A]
|
|
class Apply[A]
|
|
object Apply {
|
def apply[A](f: Int => Result[A]): Apply[A] = new Apply[A]
|
}
|
|
object TestUnit {
|
def goo : Apply[Option[Int]] = Apply { i =>
|
/* val p = */i match {
|
case 1 => Success(Some(1))
|
case _ => Success(None)
|
}
|
//p
|
}
|
}
|
This code compiles wуll. However with uncommented it fails. I checked all generics under the clojure are inferred in the same way. So I can't explain this different behavior.
It's very similar to https://issues.scala-lang.org/browse/SI-5579