diff options
author | phaller <hallerp@gmail.com> | 2012-05-07 10:32:09 +0200 |
---|---|---|
committer | phaller <hallerp@gmail.com> | 2012-05-07 10:32:09 +0200 |
commit | 5d5c7801d6d3e1214fed571dde79eae8cb6f1d0e (patch) | |
tree | 321e915981f5223e98d6ee8336cc650aea565e93 | |
parent | ea25648d2737e6110b6a643b0ac4e852688a3cab (diff) | |
download | scala-5d5c7801d6d3e1214fed571dde79eae8cb6f1d0e.tar.gz scala-5d5c7801d6d3e1214fed571dde79eae8cb6f1d0e.tar.bz2 scala-5d5c7801d6d3e1214fed571dde79eae8cb6f1d0e.zip |
Add test for t5579 in pending/pos
-rw-r--r-- | test/pending/pos/t5579.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/pending/pos/t5579.scala b/test/pending/pos/t5579.scala new file mode 100644 index 0000000000..a1ee077fe7 --- /dev/null +++ b/test/pending/pos/t5579.scala @@ -0,0 +1,29 @@ +import language.existentials + +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 { + //Error is here: + def goo = Apply { i => + i match { + case 1 => Success(Some(1)) + case _ => Success(None) + } + } + + //If type is defined explicitly (which I wanted from compiler to infer), then all is ok + def foo = Apply[t forSome { type t >: Some[Int] with None.type <: Option[Int] }] { i => + i match { + case 1 => Success(Some(1)) + case _ => Success(None) + } + } +} |