diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/classmanifests_new_deprecations.check | 32 | ||||
-rw-r--r-- | test/files/neg/t3692-old.check | 8 | ||||
-rw-r--r-- | test/files/neg/unchecked-abstract.check | 32 | ||||
-rw-r--r-- | test/files/neg/unchecked-abstract.scala | 96 | ||||
-rw-r--r-- | test/files/pos/t6215.scala | 1 | ||||
-rw-r--r-- | test/files/pos/t6485a/Macros_1.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t6485a/Test_2.scala | 5 | ||||
-rw-r--r-- | test/files/pos/t6485b/Test.scala | 10 | ||||
-rw-r--r-- | test/files/run/manifests-undeprecated-in-2.10.0.flags | 1 | ||||
-rw-r--r-- | test/files/run/manifests-undeprecated-in-2.10.0.scala | 15 | ||||
-rw-r--r-- | test/files/run/reflection-implicit.scala | 2 | ||||
-rw-r--r-- | test/files/run/reflection-methodsymbol-params.scala | 16 | ||||
-rw-r--r-- | test/files/run/reflection-valueclasses-magic.scala | 6 | ||||
-rw-r--r-- | test/files/run/t6344.check | 16 |
14 files changed, 123 insertions, 122 deletions
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check index e10308a66f..12428c7626 100644 --- a/test/files/neg/classmanifests_new_deprecations.check +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -28,34 +28,4 @@ classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Pr classmanifests_new_deprecations.scala:15: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead type RCM[T] = scala.reflect.ClassManifest[T] ^ -classmanifests_new_deprecations.scala:20: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - def m1[T: Manifest] = ??? - ^ -classmanifests_new_deprecations.scala:21: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - def m2[T](implicit evidence$1: Manifest[T]) = ??? - ^ -classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - val m3: Manifest[Int] = null - ^ -classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - val m3: Manifest[Int] = null - ^ -classmanifests_new_deprecations.scala:24: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - def rm1[T: scala.reflect.Manifest] = ??? - ^ -classmanifests_new_deprecations.scala:25: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ??? - ^ -classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - val rm3: scala.reflect.Manifest[Int] = null - ^ -classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - val rm3: scala.reflect.Manifest[Int] = null - ^ -classmanifests_new_deprecations.scala:28: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - type M[T] = Manifest[T] - ^ -classmanifests_new_deprecations.scala:33: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - type RM[T] = scala.reflect.Manifest[T] - ^ -20 errors found +10 errors found diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check index 950f82951c..9f3ae516aa 100644 --- a/test/files/neg/t3692-old.check +++ b/test/files/neg/t3692-old.check @@ -7,14 +7,8 @@ t3692-old.scala:14: warning: non-variable type argument Int in type pattern Map[ t3692-old.scala:15: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure case m2: Map[T, Int] => new java.util.HashMap[T, Integer] ^ -t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { - ^ -t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { - ^ t3692-old.scala:15: error: unreachable code case m2: Map[T, Int] => new java.util.HashMap[T, Integer] ^ -5 warnings found +three warnings found one error found diff --git a/test/files/neg/unchecked-abstract.check b/test/files/neg/unchecked-abstract.check index dc7a8d93d0..6e811dc156 100644 --- a/test/files/neg/unchecked-abstract.check +++ b/test/files/neg/unchecked-abstract.check @@ -1,25 +1,25 @@ -unchecked-abstract.scala:16: error: abstract type H in type Con[M.this.H] is unchecked since it is eliminated by erasure - /* warn */ println(x.isInstanceOf[Con[H]]) +unchecked-abstract.scala:16: error: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure + /* warn */ println(x.isInstanceOf[Contravariant[H]]) ^ -unchecked-abstract.scala:21: error: abstract type H in type Con[M.this.H] is unchecked since it is eliminated by erasure - /* warn */ println(x.isInstanceOf[Con[H]]) +unchecked-abstract.scala:21: error: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure + /* warn */ println(x.isInstanceOf[Contravariant[H]]) ^ -unchecked-abstract.scala:27: error: abstract type T in type Inv[M.this.T] is unchecked since it is eliminated by erasure - /* warn */ println(x.isInstanceOf[Inv[T]]) +unchecked-abstract.scala:27: error: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure + /* warn */ println(x.isInstanceOf[Invariant[T]]) ^ -unchecked-abstract.scala:28: error: abstract type L in type Inv[M.this.L] is unchecked since it is eliminated by erasure - /* warn */ println(x.isInstanceOf[Inv[L]]) +unchecked-abstract.scala:28: error: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure + /* warn */ println(x.isInstanceOf[Invariant[L]]) ^ -unchecked-abstract.scala:31: error: abstract type H in type Inv[M.this.H] is unchecked since it is eliminated by erasure - /* warn */ println(x.isInstanceOf[Inv[H]]) +unchecked-abstract.scala:31: error: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure + /* warn */ println(x.isInstanceOf[Invariant[H]]) ^ -unchecked-abstract.scala:33: error: abstract type L in type Inv[M.this.L] is unchecked since it is eliminated by erasure - /* warn */ println(x.isInstanceOf[Inv[L]]) +unchecked-abstract.scala:33: error: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure + /* warn */ println(x.isInstanceOf[Invariant[L]]) ^ -unchecked-abstract.scala:36: error: abstract type H in type Inv[M.this.H] is unchecked since it is eliminated by erasure - /* warn */ println(x.isInstanceOf[Inv[H]]) +unchecked-abstract.scala:36: error: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure + /* warn */ println(x.isInstanceOf[Invariant[H]]) ^ -unchecked-abstract.scala:37: error: abstract type T in type Inv[M.this.T] is unchecked since it is eliminated by erasure - /* warn */ println(x.isInstanceOf[Inv[T]]) +unchecked-abstract.scala:37: error: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure + /* warn */ println(x.isInstanceOf[Invariant[T]]) ^ 8 errors found diff --git a/test/files/neg/unchecked-abstract.scala b/test/files/neg/unchecked-abstract.scala index 5b915755f4..23c8281ca8 100644 --- a/test/files/neg/unchecked-abstract.scala +++ b/test/files/neg/unchecked-abstract.scala @@ -1,56 +1,56 @@ -trait Con[-X] -trait Inv[X] -trait Cov[+X] +trait Contravariant[-X] +trait Invariant[X] +trait Covariant[+X] abstract class M { type H type L <: H type T >: L <: H - def h1(x: Con[H]) = { - /* nowarn */ println(x.isInstanceOf[Con[H]]) - /* nowarn */ println(x.isInstanceOf[Con[T]]) - /* nowarn */ println(x.isInstanceOf[Con[L]]) + def h1(x: Contravariant[H]) = { + /* nowarn */ println(x.isInstanceOf[Contravariant[H]]) + /* nowarn */ println(x.isInstanceOf[Contravariant[T]]) + /* nowarn */ println(x.isInstanceOf[Contravariant[L]]) } - def h2(x: Con[T]) = { - /* warn */ println(x.isInstanceOf[Con[H]]) - /* nowarn */ println(x.isInstanceOf[Con[T]]) - /* nowarn */ println(x.isInstanceOf[Con[L]]) + def h2(x: Contravariant[T]) = { + /* warn */ println(x.isInstanceOf[Contravariant[H]]) + /* nowarn */ println(x.isInstanceOf[Contravariant[T]]) + /* nowarn */ println(x.isInstanceOf[Contravariant[L]]) } - def h3(x: Con[L]) = { - /* warn */ println(x.isInstanceOf[Con[H]]) - /* warn */ println(x.isInstanceOf[Con[T]]) - /* nowarn */ println(x.isInstanceOf[Con[L]]) + def h3(x: Contravariant[L]) = { + /* warn */ println(x.isInstanceOf[Contravariant[H]]) + /* warn */ println(x.isInstanceOf[Contravariant[T]]) + /* nowarn */ println(x.isInstanceOf[Contravariant[L]]) } - def h4(x: Inv[H]) = { - /* nowarn */ println(x.isInstanceOf[Inv[H]]) - /* warn */ println(x.isInstanceOf[Inv[T]]) - /* warn */ println(x.isInstanceOf[Inv[L]]) + def h4(x: Invariant[H]) = { + /* nowarn */ println(x.isInstanceOf[Invariant[H]]) + /* warn */ println(x.isInstanceOf[Invariant[T]]) + /* warn */ println(x.isInstanceOf[Invariant[L]]) } - def h5(x: Inv[T]) = { - /* warn */ println(x.isInstanceOf[Inv[H]]) - /* nowarn */ println(x.isInstanceOf[Inv[T]]) - /* warn */ println(x.isInstanceOf[Inv[L]]) + def h5(x: Invariant[T]) = { + /* warn */ println(x.isInstanceOf[Invariant[H]]) + /* nowarn */ println(x.isInstanceOf[Invariant[T]]) + /* warn */ println(x.isInstanceOf[Invariant[L]]) } - def h6(x: Inv[L]) = { - /* warn */ println(x.isInstanceOf[Inv[H]]) - /* warn */ println(x.isInstanceOf[Inv[T]]) - /* nowarn */ println(x.isInstanceOf[Inv[L]]) + def h6(x: Invariant[L]) = { + /* warn */ println(x.isInstanceOf[Invariant[H]]) + /* warn */ println(x.isInstanceOf[Invariant[T]]) + /* nowarn */ println(x.isInstanceOf[Invariant[L]]) } - def h7(x: Cov[H]) = { - /* nowarn */ println(x.isInstanceOf[Cov[H]]) - /* warn */ println(x.isInstanceOf[Cov[T]]) - /* warn */ println(x.isInstanceOf[Cov[L]]) + def h7(x: Covariant[H]) = { + /* nowarn */ println(x.isInstanceOf[Covariant[H]]) + /* warn */ println(x.isInstanceOf[Covariant[T]]) + /* warn */ println(x.isInstanceOf[Covariant[L]]) } - def h8(x: Cov[T]) = { - /* nowarn */ println(x.isInstanceOf[Cov[H]]) - /* nowarn */ println(x.isInstanceOf[Cov[T]]) - /* warn */ println(x.isInstanceOf[Cov[L]]) + def h8(x: Covariant[T]) = { + /* nowarn */ println(x.isInstanceOf[Covariant[H]]) + /* nowarn */ println(x.isInstanceOf[Covariant[T]]) + /* warn */ println(x.isInstanceOf[Covariant[L]]) } - def h9(x: Cov[L]) = { - /* nowarn */ println(x.isInstanceOf[Cov[H]]) - /* nowarn */ println(x.isInstanceOf[Cov[T]]) - /* nowarn */ println(x.isInstanceOf[Cov[L]]) + def h9(x: Covariant[L]) = { + /* nowarn */ println(x.isInstanceOf[Covariant[H]]) + /* nowarn */ println(x.isInstanceOf[Covariant[T]]) + /* nowarn */ println(x.isInstanceOf[Covariant[L]]) } } @@ -59,17 +59,17 @@ object Test extends M { type T = Int type L = Nothing - val conh = new Con[H] { } - val cont = new Con[T] { } - val conl = new Con[L] { } + val conh = new Contravariant[H] { } + val cont = new Contravariant[T] { } + val conl = new Contravariant[L] { } - val invh = new Inv[H] { } - val invt = new Inv[T] { } - val invl = new Inv[L] { } + val invh = new Invariant[H] { } + val invt = new Invariant[T] { } + val invl = new Invariant[L] { } - val covh = new Cov[H] { } - val covt = new Cov[T] { } - val covl = new Cov[L] { } + val covh = new Covariant[H] { } + val covt = new Covariant[T] { } + val covl = new Covariant[L] { } def main(args: Array[String]): Unit = { h1(conh) diff --git a/test/files/pos/t6215.scala b/test/files/pos/t6215.scala new file mode 100644 index 0000000000..2f66892b69 --- /dev/null +++ b/test/files/pos/t6215.scala @@ -0,0 +1 @@ +class Foo(val v: String) extends AnyVal { private def len = v.length ; def f = len } diff --git a/test/files/pos/t6485a/Macros_1.scala b/test/files/pos/t6485a/Macros_1.scala new file mode 100644 index 0000000000..85c2d5dbdb --- /dev/null +++ b/test/files/pos/t6485a/Macros_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.macros.Context + +object Macros { + def crash(c: Context): c.Expr[Unit] = c.universe.reify(()) +}
\ No newline at end of file diff --git a/test/files/pos/t6485a/Test_2.scala b/test/files/pos/t6485a/Test_2.scala new file mode 100644 index 0000000000..54e260ac74 --- /dev/null +++ b/test/files/pos/t6485a/Test_2.scala @@ -0,0 +1,5 @@ +import scala.language.experimental.macros + +final class Ops[T](val x: T) extends AnyVal { + def f = macro Macros.crash +} diff --git a/test/files/pos/t6485b/Test.scala b/test/files/pos/t6485b/Test.scala new file mode 100644 index 0000000000..382df1c453 --- /dev/null +++ b/test/files/pos/t6485b/Test.scala @@ -0,0 +1,10 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +final class Ops[T](val x: T) extends AnyVal { + def f = macro Macros.crash +} + +object Macros { + def crash(c: Context): c.Expr[Unit] = c.universe.reify(()) +}
\ No newline at end of file diff --git a/test/files/run/manifests-undeprecated-in-2.10.0.flags b/test/files/run/manifests-undeprecated-in-2.10.0.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/run/manifests-undeprecated-in-2.10.0.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/run/manifests-undeprecated-in-2.10.0.scala b/test/files/run/manifests-undeprecated-in-2.10.0.scala new file mode 100644 index 0000000000..82e90b3a89 --- /dev/null +++ b/test/files/run/manifests-undeprecated-in-2.10.0.scala @@ -0,0 +1,15 @@ +object Test extends App { + def m1a: scala.reflect.Manifest[Int] = scala.reflect.Manifest.Int + def m2a: scala.reflect.OptManifest[Int] = ??? + def m3a = scala.reflect.NoManifest + + def m1b: Manifest[Int] = Manifest.Int + def m2b: OptManifest[Int] = ??? + def m3b = NoManifest + + val m4a = manifest[Int] + val m5a = optManifest[Int] + + val m4b = implicitly[Manifest[Int]] + val m5b = implicitly[OptManifest[Int]] +}
\ No newline at end of file diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala index 637ef24e14..0bcb0bc3a0 100644 --- a/test/files/run/reflection-implicit.scala +++ b/test/files/run/reflection-implicit.scala @@ -9,7 +9,7 @@ class C { object Test extends App { val decls = typeOf[C].typeSymbol.typeSignature.declarations.sorted.toList.filter(sym => !sym.isTerm || (sym.isMethod && !sym.asMethod.isConstructor)) println(decls map (_.isImplicit)) - val param = decls.find(_.name.toString == "d").get.asMethod.params.last.head + val param = decls.find(_.name.toString == "d").get.asMethod.paramss.last.head param.typeSignature println(param.isImplicit) }
\ No newline at end of file diff --git a/test/files/run/reflection-methodsymbol-params.scala b/test/files/run/reflection-methodsymbol-params.scala index 7174c6f49b..45b1f9628f 100644 --- a/test/files/run/reflection-methodsymbol-params.scala +++ b/test/files/run/reflection-methodsymbol-params.scala @@ -13,12 +13,12 @@ class C { } object Test extends App { - println(typeOf[C].member(newTermName("x1")).asMethod.params) - println(typeOf[C].member(newTermName("x2")).asMethod.params) - println(typeOf[C].member(newTermName("x3")).asMethod.params) - println(typeOf[C].member(newTermName("x4")).asMethod.params) - println(typeOf[C].member(newTermName("y1")).asMethod.params) - println(typeOf[C].member(newTermName("y2")).asMethod.params) - println(typeOf[C].member(newTermName("y3")).asMethod.params) - println(typeOf[C].member(newTermName("y4")).asMethod.params) + println(typeOf[C].member(newTermName("x1")).asMethod.paramss) + println(typeOf[C].member(newTermName("x2")).asMethod.paramss) + println(typeOf[C].member(newTermName("x3")).asMethod.paramss) + println(typeOf[C].member(newTermName("x4")).asMethod.paramss) + println(typeOf[C].member(newTermName("y1")).asMethod.paramss) + println(typeOf[C].member(newTermName("y2")).asMethod.paramss) + println(typeOf[C].member(newTermName("y3")).asMethod.paramss) + println(typeOf[C].member(newTermName("y4")).asMethod.paramss) }
\ No newline at end of file diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala index 577939d2db..c4a26e460a 100644 --- a/test/files/run/reflection-valueclasses-magic.scala +++ b/test/files/run/reflection-valueclasses-magic.scala @@ -13,7 +13,7 @@ object Test extends App { def key(sym: Symbol) = { sym match { // initialize parameter symbols - case meth: MethodSymbol => meth.params.flatten.map(_.typeSignature) + case meth: MethodSymbol => meth.paramss.flatten.map(_.typeSignature) } sym + ": " + sym.typeSignature } @@ -47,8 +47,8 @@ object Test extends App { val meth = tpe.declaration(newTermName(method).encodedName.toTermName) val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod) testees foreach (testee => { - val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.params.flatten.apply(i).typeSignature) } - print(s"testing ${tpe.typeSymbol.name}.$method(${testee.params.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ") + val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.paramss.flatten.apply(i).typeSignature) } + print(s"testing ${tpe.typeSymbol.name}.$method(${testee.paramss.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ") wrap(cm.reflect(receiver).reflectMethod(testee)(convertedArgs: _*)) }) } diff --git a/test/files/run/t6344.check b/test/files/run/t6344.check index 5ac04d0320..8d9adac849 100644 --- a/test/files/run/t6344.check +++ b/test/files/run/t6344.check @@ -101,14 +101,14 @@ public int ValueInt.x() public int ValueInt.x() public java.lang.Object ValueInt.x() public java.lang.Object ValueInt.x() -public static Gen ValueInt.extension$plus(int,Gen,Gen) -public static Gen<java.lang.Object> ValueInt.extension$plus(int,Gen<java.lang.Object>,Gen<java.lang.Object>) -public static boolean ValueInt.extension$equals(int,java.lang.Object) -public static boolean ValueInt.extension$equals(int,java.lang.Object) -public static int ValueInt.extension$hashCode(int) -public static int ValueInt.extension$hashCode(int) -public static int ValueInt.extension$iplus(int,int,int) -public static int ValueInt.extension$iplus(int,int,int) +public static Gen ValueInt.plus$extension(int,Gen,Gen) +public static Gen<java.lang.Object> ValueInt.plus$extension(int,Gen<java.lang.Object>,Gen<java.lang.Object>) +public static boolean ValueInt.equals$extension(int,java.lang.Object) +public static boolean ValueInt.equals$extension(int,java.lang.Object) +public static int ValueInt.hashCode$extension(int) +public static int ValueInt.hashCode$extension(int) +public static int ValueInt.iplus$extension(int,int,int) +public static int ValueInt.iplus$extension(int,int,int) RefInt public Gen RefInt.plus(Gen,Gen) |