summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-08-26 20:06:25 +0200
committerJason Zaugg <jzaugg@gmail.com>2013-09-27 09:26:13 +0200
commit2ccbfa57783270049105b8c171d69159d54e578c (patch)
tree6beeddb44701335f15c1660e959319cd62316feb /test/files
parentf0ca5aec4c575fe297adcd3e2b16018fff4a0639 (diff)
downloadscala-2ccbfa57783270049105b8c171d69159d54e578c.tar.gz
scala-2ccbfa57783270049105b8c171d69159d54e578c.tar.bz2
scala-2ccbfa57783270049105b8c171d69159d54e578c.zip
SI-7783 Don't issue deprecation warnings for inferred TypeTrees
Deprecation checks in RefChecks were looking into all TypeTrees to find references to deprecated type aliases. However, when the compiler infers a type argument or type of a member it creates a TypeTree (with a null original) that was also leading to warnings. I ran into this problem often when upgrading a build from SBT 0.12 to 0.13: a plugin I was using used the deprecated type alias, and I suffered transitively when I used methods from its API. This commit disables the checks for inferred TypeTree-s.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/classmanifests_new_deprecations.check8
-rw-r--r--test/files/neg/t7783.check16
-rw-r--r--test/files/neg/t7783.flags1
-rw-r--r--test/files/neg/t7783.scala15
-rw-r--r--test/files/run/t4542.check3
5 files changed, 33 insertions, 10 deletions
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check
index 12428c7626..4ad4a12b3e 100644
--- a/test/files/neg/classmanifests_new_deprecations.check
+++ b/test/files/neg/classmanifests_new_deprecations.check
@@ -7,9 +7,6 @@ classmanifests_new_deprecations.scala:3: error: type ClassManifest in object Pre
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] = ???
^
@@ -19,13 +16,10 @@ classmanifests_new_deprecations.scala:7: error: type ClassManifest in package re
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]
^
-10 errors found
+8 errors found
diff --git a/test/files/neg/t7783.check b/test/files/neg/t7783.check
new file mode 100644
index 0000000000..f489b3c8fd
--- /dev/null
+++ b/test/files/neg/t7783.check
@@ -0,0 +1,16 @@
+t7783.scala:1: error: type D in object O is deprecated:
+object O { class C; @deprecated("", "") type D = C; def foo: Seq[D] = Nil }
+ ^
+t7783.scala:11: error: type D in object O is deprecated:
+ type T = O.D
+ ^
+t7783.scala:12: error: type D in object O is deprecated:
+ locally(null: O.D)
+ ^
+t7783.scala:13: error: type D in object O is deprecated:
+ val x: O.D = null
+ ^
+t7783.scala:14: error: type D in object O is deprecated:
+ locally(null.asInstanceOf[O.D])
+ ^
+5 errors found
diff --git a/test/files/neg/t7783.flags b/test/files/neg/t7783.flags
new file mode 100644
index 0000000000..d1b831ea87
--- /dev/null
+++ b/test/files/neg/t7783.flags
@@ -0,0 +1 @@
+-deprecation -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7783.scala b/test/files/neg/t7783.scala
new file mode 100644
index 0000000000..995b644a09
--- /dev/null
+++ b/test/files/neg/t7783.scala
@@ -0,0 +1,15 @@
+object O { class C; @deprecated("", "") type D = C; def foo: Seq[D] = Nil }
+
+object NoWarn {
+ O.foo // nowarn
+ O.foo +: Nil // nowarn
+ def bar(a: Any, b: Any) = () // nowarn
+ bar(b = O.foo, a = ()) // nowarn
+}
+
+object Warn {
+ type T = O.D
+ locally(null: O.D)
+ val x: O.D = null
+ locally(null.asInstanceOf[O.D])
+}
diff --git a/test/files/run/t4542.check b/test/files/run/t4542.check
index cd7a2905e2..5c293a8d80 100644
--- a/test/files/run/t4542.check
+++ b/test/files/run/t4542.check
@@ -11,9 +11,6 @@ defined class Foo
scala> val f = new Foo
<console>:8: warning: class Foo is deprecated: foooo
val f = new Foo
- ^
-<console>:8: warning: class Foo is deprecated: foooo
- val f = new Foo
^
f: Foo = Bippy