summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-09-10 23:25:40 +0200
committerJason Zaugg <jzaugg@gmail.com>2012-09-11 00:19:05 +0200
commit028de5d78225d3eb4d41d87bdbe56b7631ef76d1 (patch)
treea6d847d01d41347c2af488d3b4f5564415a2ab2e /test/files/neg
parentc78fe024711925c40f9fc15221ea04a6f99a5691 (diff)
downloadscala-028de5d78225d3eb4d41d87bdbe56b7631ef76d1.tar.gz
scala-028de5d78225d3eb4d41d87bdbe56b7631ef76d1.tar.bz2
scala-028de5d78225d3eb4d41d87bdbe56b7631ef76d1.zip
Rescues @deprecated{Inheritance, Overriding}
While they ought to be generalized to aribirary modifier changes before being offered in the standard library, the opportunity to use them in 2.10 is too important to pass up. So for now, they're private[scala]. En route: - made the error messages more concise - fix positioning of inheritance error - improve test coverage
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t6162-inheritance.check10
-rw-r--r--test/files/neg/t6162-inheritance.scala17
-rw-r--r--test/files/neg/t6162-overriding.check7
-rw-r--r--test/files/neg/t6162-overriding.scala11
4 files changed, 39 insertions, 6 deletions
diff --git a/test/files/neg/t6162-inheritance.check b/test/files/neg/t6162-inheritance.check
index 69112d7f86..a7d3cc3238 100644
--- a/test/files/neg/t6162-inheritance.check
+++ b/test/files/neg/t6162-inheritance.check
@@ -1,4 +1,10 @@
-t6162-inheritance.scala:4: error: class SubFoo inherits from class Foo, but inheriting from that class is deprecated: `Foo` will be made final in a future version.
+t6162-inheritance.scala:6: error: inheritance from class Foo in package t6126 is deprecated: `Foo` will be made final in a future version.
class SubFoo extends Foo
+ ^
+t6162-inheritance.scala:11: error: inheritance from trait T in package t6126 is deprecated
+object SubT extends T
+ ^
+t6162-inheritance.scala:17: error: inheritance from trait S in package t6126 is deprecated
+ new S {
^
-one error found \ No newline at end of file
+three errors found
diff --git a/test/files/neg/t6162-inheritance.scala b/test/files/neg/t6162-inheritance.scala
index 67bd4466c3..7b47b9285a 100644
--- a/test/files/neg/t6162-inheritance.scala
+++ b/test/files/neg/t6162-inheritance.scala
@@ -1,4 +1,19 @@
+package scala.t6126
+
@deprecatedInheritance("`Foo` will be made final in a future version.", "2.10.0")
class Foo
-class SubFoo extends Foo \ No newline at end of file
+class SubFoo extends Foo
+
+@deprecatedInheritance()
+trait T
+
+object SubT extends T
+
+@deprecatedInheritance()
+trait S
+
+object O {
+ new S {
+ }
+}
diff --git a/test/files/neg/t6162-overriding.check b/test/files/neg/t6162-overriding.check
index 14221ddc63..e774888d36 100644
--- a/test/files/neg/t6162-overriding.check
+++ b/test/files/neg/t6162-overriding.check
@@ -1,4 +1,7 @@
-t6162-overriding.scala:7: error: method bar in class SubBar overrides method bar in class Bar, but overriding this member is deprecated: `bar` will be made private in a future version.
+t6162-overriding.scala:14: error: overriding method bar in class Bar is deprecated: `bar` will be made private in a future version.
override def bar = 43
^
-one error found
+t6162-overriding.scala:15: error: overriding method baz in class Bar is deprecated
+ override def baz = 43
+ ^
+two errors found
diff --git a/test/files/neg/t6162-overriding.scala b/test/files/neg/t6162-overriding.scala
index 4907dbb075..4cab0c2dee 100644
--- a/test/files/neg/t6162-overriding.scala
+++ b/test/files/neg/t6162-overriding.scala
@@ -1,8 +1,17 @@
+package scala.t6162
+
class Bar {
@deprecatedOverriding("`bar` will be made private in a future version.", "2.10.0")
def bar = 42
+
+ @deprecatedOverriding()
+ def baz = 42
+
+ def baz(a: Any) = 0
}
class SubBar extends Bar {
override def bar = 43
-} \ No newline at end of file
+ override def baz = 43
+ override def baz(a: Any) = 43 // okay
+}