diff options
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/jesper.scala | 30 | ||||
-rw-r--r-- | test/files/pos/t8801.scala | 21 | ||||
-rw-r--r-- | test/files/pos/t8861.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t8861.scala | 11 | ||||
-rw-r--r-- | test/files/pos/t9020.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t9020.scala | 10 | ||||
-rw-r--r-- | test/files/pos/t9050.scala | 13 | ||||
-rw-r--r-- | test/files/pos/t9086.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t9111-inliner-workaround.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t9111-inliner-workaround/A_1.java | 13 | ||||
-rw-r--r-- | test/files/pos/t9111-inliner-workaround/Test_1.scala | 10 | ||||
-rw-r--r-- | test/files/pos/t9116.scala | 7 | ||||
-rw-r--r-- | test/files/pos/t9123.flags | 1 | ||||
-rw-r--r-- | test/files/pos/t9123.scala | 10 | ||||
-rw-r--r-- | test/files/pos/t9135.scala | 16 | ||||
-rw-r--r-- | test/files/pos/t9157.scala | 13 |
16 files changed, 166 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/t8861.flags b/test/files/pos/t8861.flags new file mode 100644 index 0000000000..99a6391058 --- /dev/null +++ b/test/files/pos/t8861.flags @@ -0,0 +1 @@ +-Xlint:infer-any -Xfatal-warnings diff --git a/test/files/pos/t8861.scala b/test/files/pos/t8861.scala new file mode 100644 index 0000000000..816d15700e --- /dev/null +++ b/test/files/pos/t8861.scala @@ -0,0 +1,11 @@ + +trait Test { + type R = PartialFunction[Any, Unit] + + val x: R = { case "" => } + val y: R = { case "" => } + + val z: R = x orElse y + val zz = x orElse y +} + diff --git a/test/files/pos/t9020.flags b/test/files/pos/t9020.flags new file mode 100644 index 0000000000..efb2dd3e6f --- /dev/null +++ b/test/files/pos/t9020.flags @@ -0,0 +1 @@ +-Ywarn-value-discard -Xfatal-warnings diff --git a/test/files/pos/t9020.scala b/test/files/pos/t9020.scala new file mode 100644 index 0000000000..16e31e2572 --- /dev/null +++ b/test/files/pos/t9020.scala @@ -0,0 +1,10 @@ +trait ValueDiscard[@specialized U] { + def u: U +} +/* Was: +scalac-hash v2.11.5 -Ywarn-value-discard test/files/pos/t9020.scala +test/files/pos/t9020.scala:2: warning: discarded non-Unit value + def u: U + ^ +one warning found +*/ 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 + } +} |