summaryrefslogtreecommitdiff
path: root/test/pending
diff options
context:
space:
mode:
Diffstat (limited to 'test/pending')
-rw-r--r--test/pending/neg/t2066.scala16
-rw-r--r--test/pending/pos/t5579.scala29
2 files changed, 45 insertions, 0 deletions
diff --git a/test/pending/neg/t2066.scala b/test/pending/neg/t2066.scala
new file mode 100644
index 0000000000..46177b19f7
--- /dev/null
+++ b/test/pending/neg/t2066.scala
@@ -0,0 +1,16 @@
+object Test extends App {
+ trait A {
+ def f[T[_]](x : T[Int]) : T[Any]
+ }
+
+ class B extends A {
+ def f[T[+_]](x : T[Int]) : T[Any] = x
+ }
+
+ class P[Y](var y : Y)
+
+ val p = new P(1)
+ val palias = (new B():A).f[P](p)
+ palias.y = "hello"
+ val z: Int = p.y
+} \ No newline at end of file
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)
+ }
+ }
+}