summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala6
-rw-r--r--test/files/neg/bug4174.check4
-rw-r--r--test/files/neg/bug4174.scala9
3 files changed, 16 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 9140458fc3..781df7a88f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1324,9 +1324,9 @@ trait Namers { self: Analyzer =>
checkNoConflict(DEFERRED, PRIVATE)
checkNoConflict(FINAL, SEALED)
checkNoConflict(PRIVATE, PROTECTED)
- checkNoConflict(PRIVATE, OVERRIDE)
- /* checkNoConflict(PRIVATE, FINAL) // can't do this because FINAL also means compile-time constant */
- checkNoConflict(ABSTRACT, FINAL) // bug #1833
+ // checkNoConflict(PRIVATE, OVERRIDE) // this one leads to bad error messages like #4174, so catch in refchecks
+ // checkNoConflict(PRIVATE, FINAL) // can't do this because FINAL also means compile-time constant
+ checkNoConflict(ABSTRACT, FINAL)
checkNoConflict(DEFERRED, FINAL)
// @PP: I added this as a sanity check because these flags are supposed to be
diff --git a/test/files/neg/bug4174.check b/test/files/neg/bug4174.check
new file mode 100644
index 0000000000..4881c000ea
--- /dev/null
+++ b/test/files/neg/bug4174.check
@@ -0,0 +1,4 @@
+bug4174.scala:7: error: method bar overrides nothing
+ foo(new C { override def bar = 1 })
+ ^
+one error found
diff --git a/test/files/neg/bug4174.scala b/test/files/neg/bug4174.scala
new file mode 100644
index 0000000000..b4a5ab29da
--- /dev/null
+++ b/test/files/neg/bug4174.scala
@@ -0,0 +1,9 @@
+class C
+
+object Test {
+ def foo(c: C) = 0
+
+ def main(args: Array[String]): Unit = {
+ foo(new C { override def bar = 1 })
+ }
+}