diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-08 08:52:31 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-08-08 08:52:31 +0200 |
commit | 0ea83a289e80c973e42810aee83e0f4a7102fee5 (patch) | |
tree | 12283d2855c3d66f67e7c80939bb39e15af9a449 /test/files/neg | |
parent | 1241e40ed4442abd635f44ce997013268b956b4b (diff) | |
parent | 45d045f8e3d7006890c5a3a187b8b2fc262ad5c7 (diff) | |
download | scala-0ea83a289e80c973e42810aee83e0f4a7102fee5.tar.gz scala-0ea83a289e80c973e42810aee83e0f4a7102fee5.tar.bz2 scala-0ea83a289e80c973e42810aee83e0f4a7102fee5.zip |
Merge branch '2.10.x'
Conflicts:
src/compiler/scala/tools/nsc/ast/TreeGen.scala
src/compiler/scala/tools/nsc/settings/AestheticSettings.scala
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/macro-invalidsig-context-bounds.check | 4 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala | 2 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-implicit-params.check | 6 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala | 6 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala | 2 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala | 6 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-tparams-notparams-c.check | 2 | ||||
-rw-r--r-- | test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala | 6 | ||||
-rw-r--r-- | test/files/neg/t3692-new.check | 18 | ||||
-rw-r--r-- | test/files/neg/t3692-old.check | 31 | ||||
-rw-r--r-- | test/files/neg/t6074.check | 4 | ||||
-rw-r--r-- | test/files/neg/t6074.scala | 6 | ||||
-rw-r--r-- | test/files/neg/unchecked-suppress.check | 10 | ||||
-rw-r--r-- | test/files/neg/unchecked-suppress.flags | 1 | ||||
-rw-r--r-- | test/files/neg/unchecked-suppress.scala | 10 |
15 files changed, 82 insertions, 32 deletions
diff --git a/test/files/neg/macro-invalidsig-context-bounds.check b/test/files/neg/macro-invalidsig-context-bounds.check index b2ce4b1caa..894eabc442 100644 --- a/test/files/neg/macro-invalidsig-context-bounds.check +++ b/test/files/neg/macro-invalidsig-context-bounds.check @@ -1,4 +1,4 @@ -Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than TypeTag evidences
- def foo[U: c.TypeTag: Numeric](c: Ctx) = {
+Impls_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences
+ def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = {
^
one error found
diff --git a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala index 633981ce19..5aa9a7eaf9 100644 --- a/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-context-bounds/Impls_1.scala @@ -2,7 +2,7 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.TypeTag: Numeric](c: Ctx) = { + def foo[U: c.AbsTypeTag: Numeric](c: Ctx) = { import c.universe._ Literal(Constant(42)) } diff --git a/test/files/neg/macro-invalidsig-implicit-params.check b/test/files/neg/macro-invalidsig-implicit-params.check index 6416ed0a09..029b8a4634 100644 --- a/test/files/neg/macro-invalidsig-implicit-params.check +++ b/test/files/neg/macro-invalidsig-implicit-params.check @@ -1,4 +1,4 @@ -Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than TypeTag evidences
- def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
- ^
+Impls_Macros_1.scala:5: error: macro implementations cannot have implicit parameters other than AbsTypeTag evidences
+ def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = {
+ ^
one error found
diff --git a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala index b32a20ba06..f724538993 100644 --- a/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala +++ b/test/files/neg/macro-invalidsig-implicit-params/Impls_Macros_1.scala @@ -2,13 +2,13 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo_targs[T, U: c.TypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { + def foo_targs[T, U: c.AbsTypeTag](c: Ctx)(implicit x: c.Expr[Int]) = { import c.{prefix => prefix} import c.universe._ val body = Block( Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("invoking foo_targs...")))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticTpe)))), - Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.TypeTag[U]].tpe)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("type of prefix is: " + prefix.staticType)))), + Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Literal(Constant("U is: " + implicitly[c.AbsTypeTag[U]].tpe)))), Literal(Constant(()))) c.Expr[Unit](body) } diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala index 98a3a6db7c..afbe0f0915 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-a/Impls_1.scala @@ -2,5 +2,5 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[U: c.TypeTag](c: Ctx) = ??? + def foo[U: c.AbsTypeTag](c: Ctx) = ??? }
\ No newline at end of file diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala index dbc7000485..b48f9d5f98 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-b/Impls_1.scala @@ -2,9 +2,9 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.TypeTag, U: c.TypeTag, V](c: Ctx)(implicit V: c.TypeTag[V]): c.Expr[Unit] = { - println(implicitly[c.TypeTag[T]]) - println(implicitly[c.TypeTag[U]]) + def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = { + println(implicitly[c.AbsTypeTag[T]]) + println(implicitly[c.AbsTypeTag[U]]) println(V) c.literalUnit } diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c.check b/test/files/neg/macro-invalidsig-tparams-notparams-c.check index e3e17c7506..b1078fb233 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c.check +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c.check @@ -1,4 +1,4 @@ -Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.TypeTag[T], implicit evidence$2: c.TypeTag[U], implicit V: c.TypeTag[V])c.Expr[Unit]
+Macros_Test_2.scala:3: error: wrong number of type parameters for method foo: [T, U, V](c: scala.reflect.macros.Context)(implicit evidence$1: c.AbsTypeTag[T], implicit evidence$2: c.AbsTypeTag[U], implicit V: c.AbsTypeTag[V])c.Expr[Unit]
def foo[V] = macro Impls.foo[V]
^
one error found
diff --git a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala index 3edadb115d..3506bdc789 100644 --- a/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala +++ b/test/files/neg/macro-invalidsig-tparams-notparams-c/Impls_1.scala @@ -2,10 +2,10 @@ import scala.reflect.runtime.universe._ import scala.reflect.macros.{Context => Ctx} object Impls { - def foo[T: c.TypeTag, U: c.TypeTag, V](c: Ctx)(implicit V: c.TypeTag[V]): c.Expr[Unit] = { + def foo[T: c.AbsTypeTag, U: c.AbsTypeTag, V](c: Ctx)(implicit V: c.AbsTypeTag[V]): c.Expr[Unit] = { import c.universe._ - println(implicitly[c.TypeTag[T]]) - println(implicitly[c.TypeTag[U]]) + println(implicitly[c.AbsTypeTag[T]]) + println(implicitly[c.AbsTypeTag[U]]) println(V) c.literalUnit } diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check index 349e4fe48a..5aa991c105 100644 --- a/test/files/neg/t3692-new.check +++ b/test/files/neg/t3692-new.check @@ -1,4 +1,14 @@ -t3692-new.scala:16: error: unreachable code
- case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
- ^
-one error found
+t3692-new.scala:14: warning: non-variable type argument Int in type pattern Map[Int,Int] is unchecked since it is eliminated by erasure + case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] + ^ +t3692-new.scala:15: warning: non-variable type argument Int in type pattern Map[Int,V] is unchecked since it is eliminated by erasure + case m1: Map[Int, V] => new java.util.HashMap[Integer, V] + ^ +t3692-new.scala:16: 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-new.scala:16: error: unreachable code + case m2: Map[T, Int] => new java.util.HashMap[T, Integer] + ^ +three warnings found +one error found diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check index 92d71f7e4e..950f82951c 100644 --- a/test/files/neg/t3692-old.check +++ b/test/files/neg/t3692-old.check @@ -1,11 +1,20 @@ -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]
- ^
-two warnings found
-one error found
+t3692-old.scala:13: warning: non-variable type argument Int in type pattern Map[Int,Int] is unchecked since it is eliminated by erasure + case m0: Map[Int, Int] => new java.util.HashMap[Integer, Integer] + ^ +t3692-old.scala:14: warning: non-variable type argument Int in type pattern Map[Int,V] is unchecked since it is eliminated by erasure + case m1: Map[Int, V] => new java.util.HashMap[Integer, V] + ^ +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 +one error found diff --git a/test/files/neg/t6074.check b/test/files/neg/t6074.check new file mode 100644 index 0000000000..38670e5b3d --- /dev/null +++ b/test/files/neg/t6074.check @@ -0,0 +1,4 @@ +t6074.scala:5: error: constructor A in class A cannot be accessed in object T + def t = new A() + ^ +one error found diff --git a/test/files/neg/t6074.scala b/test/files/neg/t6074.scala new file mode 100644 index 0000000000..8c14f00f19 --- /dev/null +++ b/test/files/neg/t6074.scala @@ -0,0 +1,6 @@ +class A private () { } +class B { } +object T { + implicit def a2b(a: A): B = null + def t = new A() +} diff --git a/test/files/neg/unchecked-suppress.check b/test/files/neg/unchecked-suppress.check new file mode 100644 index 0000000000..2e23d21386 --- /dev/null +++ b/test/files/neg/unchecked-suppress.check @@ -0,0 +1,10 @@ +unchecked-suppress.scala:4: error: non-variable type argument Int in type pattern Set[Int] is unchecked since it is eliminated by erasure + case xs: Set[Int] => xs.head // unchecked + ^ +unchecked-suppress.scala:5: error: non-variable type argument String in type pattern Map[String @unchecked,String] is unchecked since it is eliminated by erasure + case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay + ^ +unchecked-suppress.scala:7: error: non-variable type argument Int in type pattern (Int, Int) => Int is unchecked since it is eliminated by erasure + case f: ((Int, Int) => Int) => // unchecked + ^ +three errors found diff --git a/test/files/neg/unchecked-suppress.flags b/test/files/neg/unchecked-suppress.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/unchecked-suppress.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/unchecked-suppress.scala b/test/files/neg/unchecked-suppress.scala new file mode 100644 index 0000000000..7bd61a2a4d --- /dev/null +++ b/test/files/neg/unchecked-suppress.scala @@ -0,0 +1,10 @@ +class A { + def f(x: Any) = x match { + case xs: List[String @unchecked] => xs.head // okay + case xs: Set[Int] => xs.head // unchecked + case xs: Map[String @unchecked, String] => xs.head // one unchecked, one okay + case f: ((Int @unchecked) => (Int @unchecked)) => f(5) // okay + case f: ((Int, Int) => Int) => // unchecked + case _ => "" + } +} |