summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-26 11:00:26 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-07-02 11:44:50 +0200
commitcba0cbb892e991a0946270d1a7da63993f248225 (patch)
tree47583676e4f3e7ad9e0288a373ee9fd9ac4d2cc4 /test
parentd14d8178fa39961951d7dd74a37994db86a13063 (diff)
downloadscala-cba0cbb892e991a0946270d1a7da63993f248225.tar.gz
scala-cba0cbb892e991a0946270d1a7da63993f248225.tar.bz2
scala-cba0cbb892e991a0946270d1a7da63993f248225.zip
Improves backward compatibility of manifests
1) type ClassManifest[T] = ClassTag[T] (solves a problem with toArray[T: ClassManifest] defined on most of the collections; if these types weren't aliases, then we won't be able to change the signature of that method to toArray[T: ClassTag], because that would break source compatibility for those who override toArray in their custom collections) 2) Compiler-generated manifests no longer trigger deprecation warnings (this is implemented by using ClassManifestFactory instead of ClassManifest and ManifestFactory instead of Manifest) 3) Deprecation messages got improved to reflect the changes that were introduced in 2.10.0-M4.
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/classmanifests_new_deprecations.check61
-rw-r--r--test/files/neg/classmanifests_new_deprecations.flags1
-rw-r--r--test/files/neg/classmanifests_new_deprecations.scala37
-rw-r--r--test/files/neg/interop_abstypetags_arenot_classmanifests.check2
-rw-r--r--test/files/neg/interop_typetags_arenot_classmanifests.check2
-rw-r--r--test/files/neg/t3692-old.check11
-rw-r--r--test/files/run/classmanifests_new_alias.check2
-rw-r--r--test/files/run/classmanifests_new_alias.scala5
-rw-r--r--test/files/run/classmanifests_new_core.check2
-rw-r--r--test/files/run/classmanifests_new_core.scala4
-rw-r--r--test/files/run/interop_classtags_are_classmanifests.check6
-rw-r--r--test/pending/run/reify_implicits-new.check (renamed from test/files/run/reify_implicits-new.check)0
-rw-r--r--test/pending/run/reify_implicits-new.scala (renamed from test/files/run/reify_implicits-new.scala)0
-rw-r--r--test/pending/run/reify_implicits-old.check (renamed from test/files/run/reify_implicits-old.check)0
-rw-r--r--test/pending/run/reify_implicits-old.scala (renamed from test/files/run/reify_implicits-old.scala)0
15 files changed, 124 insertions, 9 deletions
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check
new file mode 100644
index 0000000000..841e893249
--- /dev/null
+++ b/test/files/neg/classmanifests_new_deprecations.check
@@ -0,0 +1,61 @@
+classmanifests_new_deprecations.scala:2: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ def cm1[T: ClassManifest] = ???
+ ^
+classmanifests_new_deprecations.scala:3: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ def cm2[T](implicit evidence$1: ClassManifest[T]) = ???
+ ^
+classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ val cm3: ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:4: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ val cm3: ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:6: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ def rcm1[T: scala.reflect.ClassManifest] = ???
+ ^
+classmanifests_new_deprecations.scala:7: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ???
+ ^
+classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ val rcm3: scala.reflect.ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:8: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
+ val rcm3: scala.reflect.ClassManifest[Int] = null
+ ^
+classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Predef is deprecated: Use scala.reflect.ClassTag instead
+ type CM[T] = ClassManifest[T]
+ ^
+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
diff --git a/test/files/neg/classmanifests_new_deprecations.flags b/test/files/neg/classmanifests_new_deprecations.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/classmanifests_new_deprecations.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/classmanifests_new_deprecations.scala b/test/files/neg/classmanifests_new_deprecations.scala
new file mode 100644
index 0000000000..563a0bc197
--- /dev/null
+++ b/test/files/neg/classmanifests_new_deprecations.scala
@@ -0,0 +1,37 @@
+object Test extends App {
+ def cm1[T: ClassManifest] = ???
+ def cm2[T](implicit evidence$1: ClassManifest[T]) = ???
+ val cm3: ClassManifest[Int] = null
+
+ def rcm1[T: scala.reflect.ClassManifest] = ???
+ def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ???
+ val rcm3: scala.reflect.ClassManifest[Int] = null
+
+ type CM[T] = ClassManifest[T]
+ def acm1[T: CM] = ???
+ def acm2[T](implicit evidence$1: CM[T]) = ???
+ val acm3: CM[Int] = null
+
+ type RCM[T] = scala.reflect.ClassManifest[T]
+ def arcm1[T: RCM] = ???
+ def arcm2[T](implicit evidence$1: RCM[T]) = ???
+ val arcm3: RCM[Int] = null
+
+ def m1[T: Manifest] = ???
+ def m2[T](implicit evidence$1: Manifest[T]) = ???
+ val m3: Manifest[Int] = null
+
+ def rm1[T: scala.reflect.Manifest] = ???
+ def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ???
+ val rm3: scala.reflect.Manifest[Int] = null
+
+ type M[T] = Manifest[T]
+ def am1[T: M] = ???
+ def am2[T](implicit evidence$1: M[T]) = ???
+ val am3: M[Int] = null
+
+ type RM[T] = scala.reflect.Manifest[T]
+ def arm1[T: RM] = ???
+ def arm2[T](implicit evidence$1: RM[T]) = ???
+ val arm3: RM[Int] = null
+} \ No newline at end of file
diff --git a/test/files/neg/interop_abstypetags_arenot_classmanifests.check b/test/files/neg/interop_abstypetags_arenot_classmanifests.check
index 3134aadb58..15bdcfc5b1 100644
--- a/test/files/neg/interop_abstypetags_arenot_classmanifests.check
+++ b/test/files/neg/interop_abstypetags_arenot_classmanifests.check
@@ -1,4 +1,4 @@
-interop_abstypetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T]
+interop_abstypetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T.
println(classManifest[T])
^
one error found
diff --git a/test/files/neg/interop_typetags_arenot_classmanifests.check b/test/files/neg/interop_typetags_arenot_classmanifests.check
index 403625b4da..b404f94d69 100644
--- a/test/files/neg/interop_typetags_arenot_classmanifests.check
+++ b/test/files/neg/interop_typetags_arenot_classmanifests.check
@@ -1,4 +1,4 @@
-interop_typetags_arenot_classmanifests.scala:5: error: could not find implicit value for parameter m: ClassManifest[T]
+interop_typetags_arenot_classmanifests.scala:5: error: No ClassManifest available for T.
println(classManifest[T])
^
one error found
diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check
index a97a7d31ec..92d71f7e4e 100644
--- a/test/files/neg/t3692-old.check
+++ b/test/files/neg/t3692-old.check
@@ -1,8 +1,11 @@
-t3692-old.scala:6: warning: object Manifest in package reflect is deprecated: Use TypeTag instead
- new ManifestTester().toJavaMap(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: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]
^
-one warning found
+two warnings found
one error found
diff --git a/test/files/run/classmanifests_new_alias.check b/test/files/run/classmanifests_new_alias.check
new file mode 100644
index 0000000000..ffb8482f91
--- /dev/null
+++ b/test/files/run/classmanifests_new_alias.check
@@ -0,0 +1,2 @@
+Int
+true
diff --git a/test/files/run/classmanifests_new_alias.scala b/test/files/run/classmanifests_new_alias.scala
new file mode 100644
index 0000000000..12bd93bab6
--- /dev/null
+++ b/test/files/run/classmanifests_new_alias.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ type CM[T] = ClassManifest[T]
+ println(implicitly[CM[Int]])
+ println(implicitly[CM[Int]] eq Manifest.Int)
+} \ No newline at end of file
diff --git a/test/files/run/classmanifests_new_core.check b/test/files/run/classmanifests_new_core.check
new file mode 100644
index 0000000000..ffb8482f91
--- /dev/null
+++ b/test/files/run/classmanifests_new_core.check
@@ -0,0 +1,2 @@
+Int
+true
diff --git a/test/files/run/classmanifests_new_core.scala b/test/files/run/classmanifests_new_core.scala
new file mode 100644
index 0000000000..63dbfab25c
--- /dev/null
+++ b/test/files/run/classmanifests_new_core.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ println(classManifest[Int])
+ println(classManifest[Int] eq Manifest.Int)
+} \ No newline at end of file
diff --git a/test/files/run/interop_classtags_are_classmanifests.check b/test/files/run/interop_classtags_are_classmanifests.check
index c59e92d4eb..7a0a829af2 100644
--- a/test/files/run/interop_classtags_are_classmanifests.check
+++ b/test/files/run/interop_classtags_are_classmanifests.check
@@ -1,3 +1,3 @@
-Int
-java.lang.String
-Array[Int]
+ClassTag[int]
+ClassTag[class java.lang.String]
+ClassTag[class [I]
diff --git a/test/files/run/reify_implicits-new.check b/test/pending/run/reify_implicits-new.check
index e3aeb20f6b..e3aeb20f6b 100644
--- a/test/files/run/reify_implicits-new.check
+++ b/test/pending/run/reify_implicits-new.check
diff --git a/test/files/run/reify_implicits-new.scala b/test/pending/run/reify_implicits-new.scala
index 42a1deef26..42a1deef26 100644
--- a/test/files/run/reify_implicits-new.scala
+++ b/test/pending/run/reify_implicits-new.scala
diff --git a/test/files/run/reify_implicits-old.check b/test/pending/run/reify_implicits-old.check
index e3aeb20f6b..e3aeb20f6b 100644
--- a/test/files/run/reify_implicits-old.check
+++ b/test/pending/run/reify_implicits-old.check
diff --git a/test/files/run/reify_implicits-old.scala b/test/pending/run/reify_implicits-old.scala
index 8ff256d2d4..8ff256d2d4 100644
--- a/test/files/run/reify_implicits-old.scala
+++ b/test/pending/run/reify_implicits-old.scala