From 72a17e940fa9e8c69f29fc4d9386bcc57389f954 Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Mon, 3 Sep 2018 15:00:01 +0200 Subject: [PATCH] Move all pickling tests to pos Move pickling/annot.scala to pending as it doesn't pass Ycheck, see #5073. --- .../dotty/tools/dotc/CompilationTests.scala | 1 - .../annot.scala => pending/annot-2.scala} | 1 + tests/pickling/Coder.scala | 59 ------- tests/pickling/alias.scala | 3 - tests/pickling/arrays2.scala | 32 ---- tests/pickling/desugar.scala | 88 ---------- tests/pickling/hk.scala | 56 ------- tests/pickling/i3608.scala | 10 -- tests/pickling/i94-nada.scala | 45 ------ tests/pickling/nameddefaults.scala | 63 -------- tests/pickling/new-array.scala | 17 -- tests/pickling/partialApplications.scala | 29 ---- tests/pickling/selftypes.scala | 20 --- tests/pickling/t1957.scala | 65 -------- tests/pickling/templateParents.scala | 25 --- tests/pickling/traits.scala | 27 ---- tests/pickling/tryTyping.scala | 20 --- tests/pickling/typers.scala | 153 ------------------ tests/pickling/unapply.scala | 11 -- tests/pickling/varargs.scala | 13 -- tests/pickling/zoo.scala | 43 ----- tests/{pickling => pos}/Labels.scala | 0 .../default-param-interface.scala | 0 .../extmethods-2.scala} | 0 .../i0290-type-bind-2.scala} | 0 tests/{pickling => pos}/i1202a.scala | 0 tests/{pickling => pos}/i1202b.scala | 0 tests/{pickling => pos}/i1202c.scala | 0 tests/{pickling => pos}/i1202d.scala | 0 tests/{pickling => pos}/i1932/Filter.scala | 0 tests/{pickling => pos}/i1932/Info.scala | 0 tests/{pickling => pos}/i2166.scala | 0 tests/{pickling => pos}/i2437a.scala | 0 tests/{pickling => pos}/i2437b.scala | 0 tests/{pickling => pos}/i2840.scala | 0 tests/{pickling => pos}/i3479.scala | 0 tests/{pickling => pos}/i3816.scala | 0 tests/{pickling => pos}/i4006.scala | 0 tests/{pickling => pos}/i4006b.scala | 0 tests/{pickling => pos}/i4006c.scala | 0 tests/{pickling => pos}/i4430.scala | 0 tests/{pickling => pos}/i982.scala | 0 tests/{pickling => pos}/innerclass.scala | 0 tests/{pickling => pos}/literals.scala | 0 tests/{pickling => pos}/ops.scala | 0 tests/{pickling => pos}/pickleTypes.scala | 0 tests/{pickling => pos}/private-leak.scala | 0 tests/{pickling => pos}/selfSym.scala | 0 tests/{pickling => pos}/simple.scala | 0 tests/{pickling => pos}/transparent.scala | 0 50 files changed, 1 insertion(+), 780 deletions(-) rename tests/{pickling/annot.scala => pending/annot-2.scala} (87%) delete mode 100644 tests/pickling/Coder.scala delete mode 100644 tests/pickling/alias.scala delete mode 100644 tests/pickling/arrays2.scala delete mode 100644 tests/pickling/desugar.scala delete mode 100644 tests/pickling/hk.scala delete mode 100644 tests/pickling/i3608.scala delete mode 100644 tests/pickling/i94-nada.scala delete mode 100644 tests/pickling/nameddefaults.scala delete mode 100644 tests/pickling/new-array.scala delete mode 100644 tests/pickling/partialApplications.scala delete mode 100644 tests/pickling/selftypes.scala delete mode 100644 tests/pickling/t1957.scala delete mode 100644 tests/pickling/templateParents.scala delete mode 100644 tests/pickling/traits.scala delete mode 100644 tests/pickling/tryTyping.scala delete mode 100644 tests/pickling/typers.scala delete mode 100644 tests/pickling/unapply.scala delete mode 100644 tests/pickling/varargs.scala delete mode 100644 tests/pickling/zoo.scala rename tests/{pickling => pos}/Labels.scala (100%) rename tests/{pickling => pos}/default-param-interface.scala (100%) rename tests/{pickling/extmethods.scala => pos/extmethods-2.scala} (100%) rename tests/{pickling/i0290-type-bind.scala => pos/i0290-type-bind-2.scala} (100%) rename tests/{pickling => pos}/i1202a.scala (100%) rename tests/{pickling => pos}/i1202b.scala (100%) rename tests/{pickling => pos}/i1202c.scala (100%) rename tests/{pickling => pos}/i1202d.scala (100%) rename tests/{pickling => pos}/i1932/Filter.scala (100%) rename tests/{pickling => pos}/i1932/Info.scala (100%) rename tests/{pickling => pos}/i2166.scala (100%) rename tests/{pickling => pos}/i2437a.scala (100%) rename tests/{pickling => pos}/i2437b.scala (100%) rename tests/{pickling => pos}/i2840.scala (100%) rename tests/{pickling => pos}/i3479.scala (100%) rename tests/{pickling => pos}/i3816.scala (100%) rename tests/{pickling => pos}/i4006.scala (100%) rename tests/{pickling => pos}/i4006b.scala (100%) rename tests/{pickling => pos}/i4006c.scala (100%) rename tests/{pickling => pos}/i4430.scala (100%) rename tests/{pickling => pos}/i982.scala (100%) rename tests/{pickling => pos}/innerclass.scala (100%) rename tests/{pickling => pos}/literals.scala (100%) rename tests/{pickling => pos}/ops.scala (100%) rename tests/{pickling => pos}/pickleTypes.scala (100%) rename tests/{pickling => pos}/private-leak.scala (100%) rename tests/{pickling => pos}/selfSym.scala (100%) rename tests/{pickling => pos}/simple.scala (100%) rename tests/{pickling => pos}/transparent.scala (100%) diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index 29ca73798776..5fcca127e27f 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -183,7 +183,6 @@ class CompilationTests extends ParallelTesting { @Test def pickling: Unit = { implicit val testGroup: TestGroup = TestGroup("testPickling") compileFilesInDir("tests/new", picklingOptions) + - compileFilesInDir("tests/pickling", picklingOptions) + compileFilesInDir("tests/pos", picklingOptions, FileFilter.exclude(TestSources.posTestPicklingBlacklisted)) + compileFilesInDir("tests/run", picklingOptions, FileFilter.exclude(TestSources.runTestPicklingBlacklisted)) }.checkCompile() diff --git a/tests/pickling/annot.scala b/tests/pending/annot-2.scala similarity index 87% rename from tests/pickling/annot.scala rename to tests/pending/annot-2.scala index d20a6cbf4532..55696ff71c9b 100644 --- a/tests/pickling/annot.scala +++ b/tests/pending/annot-2.scala @@ -5,6 +5,7 @@ class RefinedType extends Type object TestAnnot { def toText(tp: Type) = tp match { case tp: RefinedType => + // Doesn't Ycheck, see #5073 val parent :: (refined: List[RefinedType @unchecked]) = ??? ??? } diff --git a/tests/pickling/Coder.scala b/tests/pickling/Coder.scala deleted file mode 100644 index 6eb1ad55ab95..000000000000 --- a/tests/pickling/Coder.scala +++ /dev/null @@ -1,59 +0,0 @@ -import collection.mutable.HashMap - -class Coder(words: List[String]) { - - (2 -> "ABC", new ArrowAssoc('3') -> "DEF") - - private val mnemonics = Map( - '2' -> "ABC", '3' -> "DEF", '4' -> "GHI", '5' -> "JKL", - '6' -> "MNO", '7' -> "PQRS", '8' -> "TUV", '9' -> "WXYZ") - - - ('1', "1") match { - case (digit, str) => true - case _ => false - } - - /** Invert the mnemonics map to give a map from chars 'A' ... 'Z' to '2' ... '9' */ - private val charCode0: Map[Char, Char] = mnemonics withFilter { - case (digit, str) => true - case _ => false - } flatMap { x$1 => - x$1 match { - case (digit, str) => str map (ltr => ltr -> digit) - } - } - - private val charCode: Map[Char, Char] = - for ((digit, str) <- mnemonics; ltr <- str) yield ltr -> digit - - /** Maps a word to the digit string it can represent */ - private def wordCode(word: String): String = word map charCode - - /** A map from digit strings to the words that represent them */ - private val wordsForNum: Map[String, List[String]] = - words groupBy wordCode withDefaultValue Nil - - /** All ways to encode a number as a list of words */ - def encode(number: String): Set[List[String]] = - if (number.isEmpty) Set(Nil) - else { - for { - splitPoint <- 1 to number.length - word <- wordsForNum(number take splitPoint) - rest <- encode(number drop splitPoint) - } yield word :: rest - }.toSet - - /** Maps a number to a list of all word phrases that can represent it */ - def translate(number: String): Set[String] = encode(number) map (_ mkString " ") - -} - -object Coder { - def main(args : Array[String]) : Unit = { - val coder = new Coder(List("Scala", "sobls", "Python", "Ruby", "C", "A", "rocks", "sucks", "works", "Racka")) -// println(coder.wordsForNum) - println(coder.translate("7225276257")) - } -} diff --git a/tests/pickling/alias.scala b/tests/pickling/alias.scala deleted file mode 100644 index a66edc73a121..000000000000 --- a/tests/pickling/alias.scala +++ /dev/null @@ -1,3 +0,0 @@ -class A(val x: Int) - -class B(x: Int) extends A(x) diff --git a/tests/pickling/arrays2.scala b/tests/pickling/arrays2.scala deleted file mode 100644 index 1a0d3e660c95..000000000000 --- a/tests/pickling/arrays2.scala +++ /dev/null @@ -1,32 +0,0 @@ -package arrays - -case class C(); - -object arrays2 { - - def main(args: Array[String]): Unit = { - val a: Array[Array[C]] = new Array[Array[C]](2); - a(0) = new Array[C](2); - a(0)(0) = new C(); - } -} - -// #2422 -object arrays4 { - val args = Array[String]("World") - "Hello %1$s".format(args: _*) -} - -// #2461 -object arrays3 { - import scala.collection.JavaConversions._ - def apply[X](xs : X*) : java.util.List[X] = java.util.Arrays.asList(xs: _*) - - def apply1[X <: String](xs : X*) : java.util.List[X] = java.util.Arrays.asList(xs: _*) - def apply2[X <: AnyVal](xs : X*) : java.util.List[X] = java.util.Arrays.asList(xs: _*) - def apply3(xs : Int*) : java.util.List[Int] = java.util.Arrays.asList(xs: _*) - def apply4(xs : Unit*) : java.util.List[Unit] = java.util.Arrays.asList(xs: _*) - def apply5(xs : Null*) : java.util.List[Null] = java.util.Arrays.asList(xs: _*) - def apply6(xs : Nothing*) : java.util.List[Nothing] = java.util.Arrays.asList(xs: _*) -} - diff --git a/tests/pickling/desugar.scala b/tests/pickling/desugar.scala deleted file mode 100644 index 0d3b6d8ca624..000000000000 --- a/tests/pickling/desugar.scala +++ /dev/null @@ -1,88 +0,0 @@ -object desugar { - - // variables - var x: Int = 2 - var y = x * x - val list = List(1, 2, 3) - - { var z: Int = y } - - def foo0(first: Int, second: Int = 2, third: Int = 3) = first + second - def foo1(first: Int, second: Int = 2)(third: Int = 3) = first + second - def foo2(first: Int)(second: Int = 2)(third: Int = 3) = first + second - - object caseClasses { self => - trait List[+T] { - def head: T - def tail: List[T] - } - - case class Cons[+T](val head: T, val tail: List[T]) extends List[T] - - object Cons { - def apply[T](head: T): Cons[T] = apply(head, Nil) - } - - case object Nil extends List[Nothing] { - def head = throw new Error() - def tail = throw new Error() - } - } - - object patDefs { - - import caseClasses._ - - val xs: List[Int] = Cons(1, Cons(2, Nil)) - - val Cons(y, ys) = xs - val Cons(z, _) = xs - val Cons(_, _) = xs - - val (cons: Cons[Int]) = xs - - val x1, y1, z1: Int = 1 - } - - object Binops { - - x :: y :: Nil - - val x :: y :: Nil = list - - } - - object fors { - - for (x <- List(1, 2, 3)) yield 2 - for (x <- List(1, 2, 3) if x % 2 == 0) yield x * x - for (x <- List(1, 2, 3); y <- 0 to x) yield x * y - for (x <- List(1, 2, 3); y <- 0 to x; if x + y % 2 == 0) yield x * y - for (x <- List(1, 2, 3); y = x * x; if x + y % 2 == 0) yield x * y - for (x <- List(1, 2, 3); y = x * x; z = x * y; u <- 0 to y) yield x * y * z * u - - for (x <- List(1, 2, 3)) println(x) - for (x <- List(1, 2, 3) if x % 2 == 0) println(x * x) - for (x <- List(1, 2, 3); y <- 0 to x) println(x * y) - for (x <- List(1, 2, 3); y <- 0 to x; if x + y % 2 == 0) println(x * y) - for (x <- List(1, 2, 3); y = x * x; if x + y % 2 == 0) println(x * y) - for (x <- List(1, 2, 3); y = x * x; z = x * y; u <- 0 to y) println(x * y * z * u) - } - - object misc { - 'hello - s"this is a $x + ${x + y} string" - type ~ = Tuple2 - val pair: Int ~ String = 1 -> "abc" - def foo(xs: Int*) = xs.length - foo(list: _*) - println(list: _*) - (list length) - - desugar.x - def bar(x: => Int) = x - (x + y) + 1 - while (x < 10) x += 1 - do x -= 1 while (x > 0) - } - -} diff --git a/tests/pickling/hk.scala b/tests/pickling/hk.scala deleted file mode 100644 index a8f2aa5971cc..000000000000 --- a/tests/pickling/hk.scala +++ /dev/null @@ -1,56 +0,0 @@ -import language.higherKinds - -object hk0 { - - abstract class Base { - type Rep[T] - val strRep: Rep[String] - } - - class Sub extends Base { - type Rep[T] = T - val strRep = "abc" - val sr: Rep[String] = "" - } - - abstract class Functor[F[_]] { - def map[A, B](f: A => B): F[A] => F[B] - } - val ml: Functor[List] = ??? - val mx = ml - val mm: (Int => Boolean) => List[Int] => List[Boolean] = mx.map -} - -object higherKinded { - - type Untyped = Null - - class Tree[-T >: Untyped] { - type ThisType[-U >: Untyped] <: Tree[U] - def withString(s: String): ThisType[String] = withString(s) - } - - class Ident[-T >: Untyped] extends Tree[T] { - type ThisType[-U >: Untyped] = Ident[U] - } - - val id = new Ident[Integer] - - val y = id.withString("abc") - - val z: Ident[String] = y - - val zz: tpd.Tree = y - - abstract class Instance[T >: Untyped] { - type Tree = higherKinded.Tree[T] - } - - object tpd extends Instance[String] - - def transform(tree: Tree[String]) = { - val tree1 = tree.withString("") - tree1: Tree[String] - } - -} diff --git a/tests/pickling/i3608.scala b/tests/pickling/i3608.scala deleted file mode 100644 index fb246c63ef38..000000000000 --- a/tests/pickling/i3608.scala +++ /dev/null @@ -1,10 +0,0 @@ -class A { - class Foo { - rewrite def inlineMeth: Unit = new Bar - } - class Bar -} - -class B extends A { - (new Foo).inlineMeth -} diff --git a/tests/pickling/i94-nada.scala b/tests/pickling/i94-nada.scala deleted file mode 100644 index cf39ee2ae347..000000000000 --- a/tests/pickling/i94-nada.scala +++ /dev/null @@ -1,45 +0,0 @@ -package i94 - -import scala.language.higherKinds - -trait Base { - type Rep[T] -} - -trait BaseExp extends Base { - type Rep[T] = Exp[T] - case class Exp[T](v: T) -} - -trait BaseStr extends Base { - type Rep[T] = String -} - -trait BaseDirect extends Base { - type Rep[T] = T -} - -trait Test1 { - trait Monad[X] { - def x: X - } - sealed abstract class Either[A,B] - case class Left[A,B](x: A) extends Either[A,B] with Monad[A] - case class Right[A,B](x: B) extends Either[A,B] with Monad[B] - def flatMap[X,Y,M[X]<:Monad[X]](m: M[X], f: X => M[Y]): M[Y] = f(m.x) - println(flatMap(Right(1), {x: Int => Right(x)})) -} -trait Test2 { - trait Monad[X] { - def x: X - } - sealed abstract class Either[A,B] - case class Left[A,B](x: A) extends Either[A,B] with Monad[A] - case class Right[A,B](x: B) extends Either[A,B] with Monad[B] - def flatMap[X,Y,M[X]](m: M[X], f: X => M[Y]): M[Y] - println(flatMap(Right(1), {x: Int => Right(x)})) -} -trait Test3 { - def flatMap[X,Y,M[X]](m: M[X], f: X => M[Y]): M[Y] - println(flatMap(Some(1), {x: Int => Some(x)})) -} diff --git a/tests/pickling/nameddefaults.scala b/tests/pickling/nameddefaults.scala deleted file mode 100644 index 20a0eae47f7c..000000000000 --- a/tests/pickling/nameddefaults.scala +++ /dev/null @@ -1,63 +0,0 @@ -object nameddefaults { - - def foo(first: Int, second: Int = 2, third: Int = 3) = first + second - - var x = 1 - var y = 2 - - foo(1, 2, 3) - - foo(1, 2) - - foo(1) - - // named and missing arguments - - foo(first = 1, second = 3) - - foo(second = 3, first = 1) - - foo(first = 2, third = 3) - - foo(2, third = 3) - - // same but with non-idempotent expressions - - foo(first = x, second = y) - - foo(second = x, first = y) - - foo(first = x, third = y) - - foo(x, third = y) - -// The same thing, but for classes - - class C(first: Int, second: Int = 2, third: Int = 3) {} - - new C(1, 2, 3) - - new C(1, 2) - - new C(1) - - // named and missing arguments - - new C(first = 1, second = 3) - - new C(second = 3, first = 1) - - new C(first = 2, third = 3) - - new C(2, third = 3) - - // same but with non-idempotent expressions - - new C(first = x, second = y) - - new C(second = x, first = y) - - new C(first = x, third = y) - - -} diff --git a/tests/pickling/new-array.scala b/tests/pickling/new-array.scala deleted file mode 100644 index a323783de945..000000000000 --- a/tests/pickling/new-array.scala +++ /dev/null @@ -1,17 +0,0 @@ -package newArray - -object Test { - val w = new Array[String](10) - val x = new Array[Int](10) - def f[T: reflect.ClassTag] = new Array[T](10) - val y = new Array[Any](10) - val z = new Array[Unit](10) -} -object Test2 { - val w: Array[Any] = new Array(10) - val x: Array[Int] = new Array(10) - def f[T: reflect.ClassTag]: Array[T] = new Array(10) - val y: Array[Any] = new Array(10) - val z: Array[Unit] = new Array(10) -} - diff --git a/tests/pickling/partialApplications.scala b/tests/pickling/partialApplications.scala deleted file mode 100644 index c4c4328f6509..000000000000 --- a/tests/pickling/partialApplications.scala +++ /dev/null @@ -1,29 +0,0 @@ -object partialApplications { - - type Histogram[X] = Map[X, Int] - - type StringlyHistogram[X >: String] = Histogram[X] - - val xs: Histogram[String] = Map[String, Int]() - - val ys: StringlyHistogram[String] = xs - - def e = xs - - val zs: StringlyHistogram[_] = e - - type IntMap[Y] = Map[Int, Y] - - val is = Map[Int, Boolean]() - - val js: IntMap[Boolean] = is - - val ks: IntMap[_] = is - - type RMap[X, Y] = Map[Y, X] - - val rs = Map[Int, Float]() - - val ss: RMap[Float, Int] = rs - -} diff --git a/tests/pickling/selftypes.scala b/tests/pickling/selftypes.scala deleted file mode 100644 index 5180419d11b4..000000000000 --- a/tests/pickling/selftypes.scala +++ /dev/null @@ -1,20 +0,0 @@ -object selftypes { - - trait A { self: AB => - - type AA = List[this.BX] - - class AX - - } - - trait B { self: AB => - - type BB = AA - - class BX - } - - class AB extends A with B - -} diff --git a/tests/pickling/t1957.scala b/tests/pickling/t1957.scala deleted file mode 100644 index 5fcc1723bff5..000000000000 --- a/tests/pickling/t1957.scala +++ /dev/null @@ -1,65 +0,0 @@ -package t1957 - -// See comment at end of file. -object Test { - abstract class Settings {} - - abstract class Grist - { self => - type settingsType <: Settings - type moduleType <: Module {type settingsType = self.settingsType} - val module: moduleType - } - - abstract class Tool - { self => - type settingsType <: Settings - type moduleType = Module { type settingsType = self.settingsType } - type gristType = Grist { type moduleType <: self.moduleType; type settingsType <: self.settingsType } - - def inputGrist: List[gristType] - } - - abstract class Module - { self => - type settingsType <: Settings - final type commonModuleType = Module {type settingsType = self.settingsType} - type selfType >: self.type <: commonModuleType - - // BTW: if we use the commented out type decls, the code compiles successfully - // type gristType = Grist {type settingsType <: self.settingsType; type moduleType <: commonModuleType } - - val tools: List[Tool {type settingsType = self.settingsType}] - - protected def f: List[commonModuleType] = - { - val inputGrists = tools.flatMap(_.inputGrist) - // This produces an unhygienic closure for _.inputGrist. - // Pickling will log: - // - // [...] pickling reference to as yet undefined value _$1 in method $anonfun - // - // More info can be produced by uncommenting these two lines in - // Namer#valOrDefDefSig: - // - //println(i"lifting $rhsType over $paramss -> $hygienicType = ${tpt.tpe}") - //println(TypeComparer.explained { implicit ctx => hygienicType <:< tpt.tpe }) - // - // Tracing the subtype statement (over 1600+ lines!) shows that the TypeComparer thinks that the - // following subtype judgement is true: - // - // Test.Grist{ - // moduleType <: Test.Module{settingsType = Module.this.settingsType}; - // settingsType <: Module.this.settingsType - // } <:< Test.Grist{moduleType <: _$1.moduleType; settingsType <: _$1.settingsType} - // - // Therefore, a type variable which has the second type as lower bound does not get - // the (hygienic) first type as new lower bound. Clearly something is wrong in the subtype - // derivation here. It would be important to figure out what. - - ??? -// inputGrists.map(_.module) - } - - } -} diff --git a/tests/pickling/templateParents.scala b/tests/pickling/templateParents.scala deleted file mode 100644 index 153c4b4da728..000000000000 --- a/tests/pickling/templateParents.scala +++ /dev/null @@ -1,25 +0,0 @@ -object templateParents { - - // traits do not call a constructor - class C[+T](val x: T) - trait D extends C[String] - trait E extends C[Int] - class F extends C[Boolean](true) { - def foo = x - } - val cd = new C("abc") with D - cd.x - -} - -object templateParents1 { - // tests inference of synthesized class type - class C[+T] - trait D extends C[String] - trait E extends C[Int] - - val x = new D with E - - val y: C[Int & String] = x -} - diff --git a/tests/pickling/traits.scala b/tests/pickling/traits.scala deleted file mode 100644 index e93ebc46b34e..000000000000 --- a/tests/pickling/traits.scala +++ /dev/null @@ -1,27 +0,0 @@ -package traits - -trait B extends Object { - - val z: Int - -} - -trait T extends B { - - var x = 2 - - private var xp = 2 - - val y = 3 - - private val yp = 3 - - val z = 4 - - x = 4 - - xp = 4 - -} - -class C extends T diff --git a/tests/pickling/tryTyping.scala b/tests/pickling/tryTyping.scala deleted file mode 100644 index cfa2c7a77325..000000000000 --- a/tests/pickling/tryTyping.scala +++ /dev/null @@ -1,20 +0,0 @@ -object tryTyping{ - def foo: Int = { - try{???; 1} - catch { - case e: Exception => 2 - } - } - - def foo2: Int = { - val a2: (Throwable => Int) = _ match {case _ => 2} - try{???; 1} - catch a2 - } - - def foo3: Int = { - val a3: (Int => Throwable => Int) = (b: Int) => _ match {case _ => b} - try{???; 1} - catch a3(3) - } -} diff --git a/tests/pickling/typers.scala b/tests/pickling/typers.scala deleted file mode 100644 index 56007729e8b7..000000000000 --- a/tests/pickling/typers.scala +++ /dev/null @@ -1,153 +0,0 @@ -package typers - -import annotation.{tailrec, switch} -import collection.mutable._ - -object typers { - - val names = List("a", "b", "c") - val ints = List(1, 2, 3) - - object Inference { - - for ((name, n) <- (names, ints).zipped) - println(name.length + n) - - def double(x: Char): String = s"$x$x" - - "abc" flatMap double - - } - object Eta { - - def fun(x: Int): Int = x + 1 - val foo = fun(_) - } - - case class DefaultParams(init: String => String = identity) - object DefaultParams { - def foo(x: String => String = identity) = x("abc") - - foo() - } - - class List[+T] { - def :: [U >: T](x: U): List[U] = new :: (x, this) - - def len: Int = this match { - case x :: xs1 => 1 + xs1.len - case Nil => 0 - } - } - - object Nil extends List[Nothing] - - case class :: [+T] (hd: T, tl: List[T]) extends List[T] - - def len[U](xs: List[U]): Int = xs match { - case x :: xs1 => 1 + len(xs1) - case Nil => 0 - } - - object returns { - - def foo(x: Int): Int = { - return 3 - } - } - - object tries { - - val x = try { - "abc" - } catch { - case ex: java.io.IOException => - 123 - } finally { - println("done") - } - - val y = try 2 catch Predef.identity - - val z = try 3 finally "abc" - - println("abc".toString) - - } - - class C { - - @tailrec final def factorial(acc: Int, n: Int): Int = (n: @switch) match { - case 0 => acc - case _ => factorial(acc * n, n - 1) - } - - println(factorial(1, 10)) - - - } - - class Refinements { - trait C { type T; def process(x: T): Int } - val y: C { type T; val key: T; def process(x: T): Int } = ??? - } - - object Accessibility { - - class A { - val x: String = "abc" - } - - class B extends A { - private def x: Int = 1 - } - - val b: B = new B - val y = b.x - val z: String = y - - } - - object Self { - - class A(self1: Int) { self => - - def self1(x: Int) = x - - class B { - val b = self - val c: A = b - } - - val a = self - val c: A = a - } - - - } - - object Arrays { - - val arr = List("a", "b", "c").toArray - val i = 2 - arr(i).charAt(0) - - val x = new ArrayBuffer[String] // testing overloaded polymorphic constructors - - val entries = Array("abc", "def") - - for ((x, i) <- entries.zipWithIndex) - println(x) - } - - object SeqExtractors { - val y = names match { - case List(x, z) => x - case List(x) => x - case List() => "" - } - val yy: String = y - } - - -} diff --git a/tests/pickling/unapply.scala b/tests/pickling/unapply.scala deleted file mode 100644 index ba885be7375a..000000000000 --- a/tests/pickling/unapply.scala +++ /dev/null @@ -1,11 +0,0 @@ -object test { - class Foo[T](val arg : T) - - object Foo { - def unapply [a](m : Foo[a]) = Some (m.arg) - } - def matchAndGetArgFromFoo[b]( e:Foo[b]):b = {e match { case Foo(x) => x }} -// Unapply node here will have type argument [a] instantiated to scala.Nothing: -// UnApply(TypeApply(Select(Ident(Foo),unapply),List(TypeTree[TypeVar(PolyParam(a) -> TypeRef(ThisType(TypeRef(NoPrefix,scala)),Nothing))])),List(),List(Bind(x,Ident(_)))) -// but the type of the UnApply node itself is correct: RefinedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,)),test$)),Foo), test$$Foo$$a, TypeAlias(TypeRef(NoPrefix,a))) -} diff --git a/tests/pickling/varargs.scala b/tests/pickling/varargs.scala deleted file mode 100644 index 616456616784..000000000000 --- a/tests/pickling/varargs.scala +++ /dev/null @@ -1,13 +0,0 @@ -object varargs { - List(1, 2, 3) - def g(x: Int*) = x.length - g(1, 2, 3, 4) - val x = if (true) 1 else 2 - def foo[T](x: T, y: T): T = x - foo(1, 2) - val xs = 1 :: 2 :: Nil - g(xs: _*) - g(Nil: _*) - g(1) - g() -} diff --git a/tests/pickling/zoo.scala b/tests/pickling/zoo.scala deleted file mode 100644 index e6bde86b1174..000000000000 --- a/tests/pickling/zoo.scala +++ /dev/null @@ -1,43 +0,0 @@ -package zoo - -object Test { -trait FoodStuff -trait Meat extends FoodStuff { - type IsMeat = Any -} -trait Grass extends FoodStuff { - type IsGrass = Any -} -trait Animal { - type Food <: FoodStuff - def eats(food: Food): Unit - def gets: Food -} -trait Cow extends Animal { - type IsMeat = Any - type Food <: Grass - def eats(food: Grass): Unit - def gets: Food -} -trait Lion extends Animal { - type Food = Meat - def eats(food: Meat): Unit - def gets: Meat -} -def newMeat: Meat = new Meat { -} -def newGrass: Grass = new Grass { -} -def newCow: Cow = new Cow { - type Food = Grass - def eats(food: Grass) = () - def gets = newGrass -} -def newLion: Lion = new Lion { - def eats(food: Meat) = () - def gets = newMeat -} -val milka = newCow -val leo = newLion -//leo.eats(milka) // structural select not supported -} diff --git a/tests/pickling/Labels.scala b/tests/pos/Labels.scala similarity index 100% rename from tests/pickling/Labels.scala rename to tests/pos/Labels.scala diff --git a/tests/pickling/default-param-interface.scala b/tests/pos/default-param-interface.scala similarity index 100% rename from tests/pickling/default-param-interface.scala rename to tests/pos/default-param-interface.scala diff --git a/tests/pickling/extmethods.scala b/tests/pos/extmethods-2.scala similarity index 100% rename from tests/pickling/extmethods.scala rename to tests/pos/extmethods-2.scala diff --git a/tests/pickling/i0290-type-bind.scala b/tests/pos/i0290-type-bind-2.scala similarity index 100% rename from tests/pickling/i0290-type-bind.scala rename to tests/pos/i0290-type-bind-2.scala diff --git a/tests/pickling/i1202a.scala b/tests/pos/i1202a.scala similarity index 100% rename from tests/pickling/i1202a.scala rename to tests/pos/i1202a.scala diff --git a/tests/pickling/i1202b.scala b/tests/pos/i1202b.scala similarity index 100% rename from tests/pickling/i1202b.scala rename to tests/pos/i1202b.scala diff --git a/tests/pickling/i1202c.scala b/tests/pos/i1202c.scala similarity index 100% rename from tests/pickling/i1202c.scala rename to tests/pos/i1202c.scala diff --git a/tests/pickling/i1202d.scala b/tests/pos/i1202d.scala similarity index 100% rename from tests/pickling/i1202d.scala rename to tests/pos/i1202d.scala diff --git a/tests/pickling/i1932/Filter.scala b/tests/pos/i1932/Filter.scala similarity index 100% rename from tests/pickling/i1932/Filter.scala rename to tests/pos/i1932/Filter.scala diff --git a/tests/pickling/i1932/Info.scala b/tests/pos/i1932/Info.scala similarity index 100% rename from tests/pickling/i1932/Info.scala rename to tests/pos/i1932/Info.scala diff --git a/tests/pickling/i2166.scala b/tests/pos/i2166.scala similarity index 100% rename from tests/pickling/i2166.scala rename to tests/pos/i2166.scala diff --git a/tests/pickling/i2437a.scala b/tests/pos/i2437a.scala similarity index 100% rename from tests/pickling/i2437a.scala rename to tests/pos/i2437a.scala diff --git a/tests/pickling/i2437b.scala b/tests/pos/i2437b.scala similarity index 100% rename from tests/pickling/i2437b.scala rename to tests/pos/i2437b.scala diff --git a/tests/pickling/i2840.scala b/tests/pos/i2840.scala similarity index 100% rename from tests/pickling/i2840.scala rename to tests/pos/i2840.scala diff --git a/tests/pickling/i3479.scala b/tests/pos/i3479.scala similarity index 100% rename from tests/pickling/i3479.scala rename to tests/pos/i3479.scala diff --git a/tests/pickling/i3816.scala b/tests/pos/i3816.scala similarity index 100% rename from tests/pickling/i3816.scala rename to tests/pos/i3816.scala diff --git a/tests/pickling/i4006.scala b/tests/pos/i4006.scala similarity index 100% rename from tests/pickling/i4006.scala rename to tests/pos/i4006.scala diff --git a/tests/pickling/i4006b.scala b/tests/pos/i4006b.scala similarity index 100% rename from tests/pickling/i4006b.scala rename to tests/pos/i4006b.scala diff --git a/tests/pickling/i4006c.scala b/tests/pos/i4006c.scala similarity index 100% rename from tests/pickling/i4006c.scala rename to tests/pos/i4006c.scala diff --git a/tests/pickling/i4430.scala b/tests/pos/i4430.scala similarity index 100% rename from tests/pickling/i4430.scala rename to tests/pos/i4430.scala diff --git a/tests/pickling/i982.scala b/tests/pos/i982.scala similarity index 100% rename from tests/pickling/i982.scala rename to tests/pos/i982.scala diff --git a/tests/pickling/innerclass.scala b/tests/pos/innerclass.scala similarity index 100% rename from tests/pickling/innerclass.scala rename to tests/pos/innerclass.scala diff --git a/tests/pickling/literals.scala b/tests/pos/literals.scala similarity index 100% rename from tests/pickling/literals.scala rename to tests/pos/literals.scala diff --git a/tests/pickling/ops.scala b/tests/pos/ops.scala similarity index 100% rename from tests/pickling/ops.scala rename to tests/pos/ops.scala diff --git a/tests/pickling/pickleTypes.scala b/tests/pos/pickleTypes.scala similarity index 100% rename from tests/pickling/pickleTypes.scala rename to tests/pos/pickleTypes.scala diff --git a/tests/pickling/private-leak.scala b/tests/pos/private-leak.scala similarity index 100% rename from tests/pickling/private-leak.scala rename to tests/pos/private-leak.scala diff --git a/tests/pickling/selfSym.scala b/tests/pos/selfSym.scala similarity index 100% rename from tests/pickling/selfSym.scala rename to tests/pos/selfSym.scala diff --git a/tests/pickling/simple.scala b/tests/pos/simple.scala similarity index 100% rename from tests/pickling/simple.scala rename to tests/pos/simple.scala diff --git a/tests/pickling/transparent.scala b/tests/pos/transparent.scala similarity index 100% rename from tests/pickling/transparent.scala rename to tests/pos/transparent.scala