summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/jesper.scala30
-rw-r--r--test/files/pos/t8801.scala21
-rw-r--r--test/files/pos/t9050.scala13
-rw-r--r--test/files/pos/t9086.scala8
-rw-r--r--test/files/pos/t9111-inliner-workaround.flags1
-rw-r--r--test/files/pos/t9111-inliner-workaround/A_1.java13
-rw-r--r--test/files/pos/t9111-inliner-workaround/Test_1.scala10
-rw-r--r--test/files/pos/t9116.scala7
-rw-r--r--test/files/pos/t9123.flags1
-rw-r--r--test/files/pos/t9123.scala10
-rw-r--r--test/files/pos/t9135.scala16
-rw-r--r--test/files/pos/t9157.scala13
12 files changed, 143 insertions, 0 deletions
diff --git a/test/files/pos/jesper.scala b/test/files/pos/jesper.scala
new file mode 100644
index 0000000000..82623e4a24
--- /dev/null
+++ b/test/files/pos/jesper.scala
@@ -0,0 +1,30 @@
+object Pair {
+ sealed trait Pair {
+ type First
+ type Second <: Pair
+ }
+
+ case class End() extends Pair {
+ type First = Nothing
+ type Second = End
+
+ def ::[T](v : T) : Cons[T, End] = Cons(v, this)
+ }
+
+ object End extends End()
+
+ final case class Cons[T1, T2 <: Pair](_1 : T1, _2 : T2) extends Pair {
+ type First = T1
+ type Second = T2
+
+ def ::[T](v : T) : Cons[T, Cons[T1, T2]] = Cons(v, this)
+ def find[T](implicit finder : Cons[T1, T2] => T) = finder(this)
+ }
+
+ implicit def findFirst[T1, T2 <: Pair] : Cons[T1, T2] => T1 = (p : Cons[T1, T2]) => p._1
+ implicit def findSecond[T, T1, T2 <: Pair](implicit finder : T2 => T) : Cons[T1, T2] => T = (p : Cons[T1, T2]) => finder(p._2)
+
+ val p : Cons[Int, Cons[Boolean, End]] = 10 :: false :: End
+// val x : Boolean = p.find[Boolean](findSecond(findFirst))
+ val x2 : Boolean = p.find[Boolean] // Doesn't compile
+}
diff --git a/test/files/pos/t8801.scala b/test/files/pos/t8801.scala
new file mode 100644
index 0000000000..695b456e12
--- /dev/null
+++ b/test/files/pos/t8801.scala
@@ -0,0 +1,21 @@
+sealed trait Nat {
+ type Prev <: Nat { type Succ = Nat.this.type }
+ type Succ <: Nat { type Prev = Nat.this.type }
+}
+
+object Nat {
+ object Zero extends Nat {
+ type Prev = Nothing
+ }
+
+ type _0 = Zero.type
+ type _1 = _0#Succ
+ type _2 = _1#Succ
+ type _3 = _2#Succ
+ type _4 = _3#Succ
+ type _5 = _4#Succ
+ type _6 = _5#Succ
+ type _7 = _6#Succ
+ type _8 = _7#Succ
+ type _9 = _8#Succ
+}
diff --git a/test/files/pos/t9050.scala b/test/files/pos/t9050.scala
new file mode 100644
index 0000000000..b1ab09f901
--- /dev/null
+++ b/test/files/pos/t9050.scala
@@ -0,0 +1,13 @@
+final class Mu[F](val value: Any) extends AnyVal {
+ def cata(f: F) {
+ // crash
+ ((y: Mu[F]) => y.cata(f))
+ // crash
+ def foo(x : Mu[F]) = x.cata(f)
+
+ // // okay
+ def x: Mu[F] = ???
+ (() => x.cata(f))
+ assert(true, cata(f))
+ }
+}
diff --git a/test/files/pos/t9086.scala b/test/files/pos/t9086.scala
new file mode 100644
index 0000000000..fba34ee226
--- /dev/null
+++ b/test/files/pos/t9086.scala
@@ -0,0 +1,8 @@
+class X[A](a: A)
+object Test {
+ implicit val ImplicitBoolean: Boolean = true
+ def local = {
+ implicit object X extends X({ implicitly[Boolean] ; "" })
+ implicitly[X[String]] // failed in 2.11.5
+ }
+}
diff --git a/test/files/pos/t9111-inliner-workaround.flags b/test/files/pos/t9111-inliner-workaround.flags
new file mode 100644
index 0000000000..63b5558cfd
--- /dev/null
+++ b/test/files/pos/t9111-inliner-workaround.flags
@@ -0,0 +1 @@
+-Ybackend:GenBCode -Yopt:l:classpath \ No newline at end of file
diff --git a/test/files/pos/t9111-inliner-workaround/A_1.java b/test/files/pos/t9111-inliner-workaround/A_1.java
new file mode 100644
index 0000000000..bc60b68ea6
--- /dev/null
+++ b/test/files/pos/t9111-inliner-workaround/A_1.java
@@ -0,0 +1,13 @@
+public class A_1 {
+ public static class T { }
+
+ public static class Inner {
+ public static class T { }
+
+ public void foo(T t) { }
+
+ public T t = null;
+
+ public class Deeper extends T { }
+ }
+}
diff --git a/test/files/pos/t9111-inliner-workaround/Test_1.scala b/test/files/pos/t9111-inliner-workaround/Test_1.scala
new file mode 100644
index 0000000000..1a00fff833
--- /dev/null
+++ b/test/files/pos/t9111-inliner-workaround/Test_1.scala
@@ -0,0 +1,10 @@
+object Test extends App {
+ println(new A_1.Inner())
+
+ // Accessing foo or Deeper triggers the error of SI-9111.
+ // However, when not referring to those definitions, compilation should
+ // succeed, also if the inliner is enabled.
+
+ // println(i.foo(null))
+ // new i.Deeper()
+}
diff --git a/test/files/pos/t9116.scala b/test/files/pos/t9116.scala
new file mode 100644
index 0000000000..16b04c2e6b
--- /dev/null
+++ b/test/files/pos/t9116.scala
@@ -0,0 +1,7 @@
+
+trait X {
+ List(1, 2, 3).toSet.subsets.map(_.toList) // ok now
+
+ List(1, 2, 3).toSet.subsets().map(_.toList) // now also
+ List(1, 2, 3).toSet.subsets(2).map(_.toList) // still ok
+}
diff --git a/test/files/pos/t9123.flags b/test/files/pos/t9123.flags
new file mode 100644
index 0000000000..c16e2f71dc
--- /dev/null
+++ b/test/files/pos/t9123.flags
@@ -0,0 +1 @@
+-optimize -Ydelambdafy:method
diff --git a/test/files/pos/t9123.scala b/test/files/pos/t9123.scala
new file mode 100644
index 0000000000..22d55b4351
--- /dev/null
+++ b/test/files/pos/t9123.scala
@@ -0,0 +1,10 @@
+trait Setting {
+ type T
+ def value: T
+}
+
+object Test {
+ def test(x: Some[Setting]) = x match {
+ case Some(dep) => Some(dep.value) map (_ => true)
+ }
+}
diff --git a/test/files/pos/t9135.scala b/test/files/pos/t9135.scala
new file mode 100644
index 0000000000..1e2c97baf9
--- /dev/null
+++ b/test/files/pos/t9135.scala
@@ -0,0 +1,16 @@
+
+class Free[A] {
+
+
+ this match {
+ case a @ Gosub() => gosub(a.a)(x => gosub(???)(???))
+ }
+ def gosub[A, B](a0: Free[A])(f0: A => Any): Free[B] = ???
+}
+
+
+
+ case class Gosub[B]() extends Free[B] {
+ type C
+ def a: Free[C] = ???
+ }
diff --git a/test/files/pos/t9157.scala b/test/files/pos/t9157.scala
new file mode 100644
index 0000000000..e178b5d84d
--- /dev/null
+++ b/test/files/pos/t9157.scala
@@ -0,0 +1,13 @@
+trait Flow[-In, +Out] {
+ type Repr[+O] <: Flow[In, O]
+ def map: Repr[String]
+}
+
+class Test {
+ // typechecking was exponentially slow wrt the number of projections here.
+ def slowFlow(
+ f: Flow[String,String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]#Repr[String]
+ ) = {
+ f.map
+ }
+}