summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-21 00:24:29 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-21 00:24:29 -0700
commit6aea0ae85f72594798ec6c96e30cc1aef48c3a99 (patch)
tree86deb078e36a7d2a64308c86f4c97b010f4b606d /test/files
parent320827255b736f8405ba3b9a3d5b92947157ba33 (diff)
parent2d3b6bd321724c565fd458a2bbffb4ad211c54ff (diff)
downloadscala-6aea0ae85f72594798ec6c96e30cc1aef48c3a99.tar.gz
scala-6aea0ae85f72594798ec6c96e30cc1aef48c3a99.tar.bz2
scala-6aea0ae85f72594798ec6c96e30cc1aef48c3a99.zip
Merge pull request #731 from retronym/ticket/5617
SI-5617 Better error message for "x overrides nothing".
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/t5429.check20
-rw-r--r--test/files/neg/t5617.check8
-rw-r--r--test/files/neg/t5617.scala14
3 files changed, 37 insertions, 5 deletions
diff --git a/test/files/neg/t5429.check b/test/files/neg/t5429.check
index 1b89c59587..4350696bc8 100644
--- a/test/files/neg/t5429.check
+++ b/test/files/neg/t5429.check
@@ -46,14 +46,18 @@ t5429.scala:38: error: overriding method emptyArg in class A of type ()Int;
object emptyArg has incompatible type
override object emptyArg // fail
^
-t5429.scala:39: error: object oneArg overrides nothing
+t5429.scala:39: error: object oneArg overrides nothing.
+Note: the super classes of class C contain the following, non final members named oneArg:
+def oneArg(x: String): Int
override object oneArg // fail
^
t5429.scala:43: error: overriding lazy value lazyvalue in class A0 of type Any;
object lazyvalue must be declared lazy to override a concrete lazy value
override object lazyvalue // !!! this fails, but should succeed (lazy over lazy)
^
-t5429.scala:46: error: object oneArg overrides nothing
+t5429.scala:46: error: object oneArg overrides nothing.
+Note: the super classes of class C0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
override object oneArg // fail
^
t5429.scala:50: error: overriding value value in class A of type Int;
@@ -76,7 +80,9 @@ t5429.scala:58: error: overriding lazy value lazyvalue in class A0 of type Any;
value lazyvalue must be declared lazy to override a concrete lazy value
override val lazyvalue = 0 // fail (non-lazy)
^
-t5429.scala:61: error: value oneArg overrides nothing
+t5429.scala:61: error: value oneArg overrides nothing.
+Note: the super classes of class D0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
override val oneArg = 15 // fail
^
t5429.scala:65: error: overriding value value in class A of type Int;
@@ -103,7 +109,9 @@ t5429.scala:73: error: overriding lazy value lazyvalue in class A0 of type Any;
method lazyvalue needs to be a stable, immutable value
override def lazyvalue = 2 // fail
^
-t5429.scala:76: error: method oneArg overrides nothing
+t5429.scala:76: error: method oneArg overrides nothing.
+Note: the super classes of class E0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
override def oneArg = 15 // fail
^
t5429.scala:80: error: overriding value value in class A of type Int;
@@ -126,7 +134,9 @@ t5429.scala:87: error: overriding value value in class A0 of type Any;
lazy value value cannot override a concrete non-lazy value
override lazy val value = 0 // fail (strict over lazy)
^
-t5429.scala:91: error: value oneArg overrides nothing
+t5429.scala:91: error: value oneArg overrides nothing.
+Note: the super classes of class F0 contain the following, non final members named oneArg:
+def oneArg(x: String): Any
override lazy val oneArg = 15 // fail
^
34 errors found
diff --git a/test/files/neg/t5617.check b/test/files/neg/t5617.check
new file mode 100644
index 0000000000..79cc3a1e32
--- /dev/null
+++ b/test/files/neg/t5617.check
@@ -0,0 +1,8 @@
+t5617.scala:12: error: method foo overrides nothing.
+Note: the super classes of trait C contain the following, non final members named foo:
+def foo(u: Unit): Int
+def foo(x: Boolean): Int
+def foo(i: Int)(b: String): Int
+ override def foo(s: String): Int
+ ^
+one error found
diff --git a/test/files/neg/t5617.scala b/test/files/neg/t5617.scala
new file mode 100644
index 0000000000..41541b5e90
--- /dev/null
+++ b/test/files/neg/t5617.scala
@@ -0,0 +1,14 @@
+trait A {
+ def foo(i: Int)(b: String): Int
+ def foo(u: Unit): Int // not reported
+ def foo(x: Float): Int // not reported
+}
+trait B[X] extends A {
+ def foo(x: X): Int
+ def foo(u: Unit): Int
+ final def foo(x: Float): Int = 0 // not reported
+}
+trait C extends B[Boolean] {
+ override def foo(s: String): Int
+ val foo = 0 // not reported
+}