aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Checking.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Checking.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Checking.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala
index 41d9f9572..321c275d7 100644
--- a/compiler/src/dotty/tools/dotc/typer/Checking.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala
@@ -338,6 +338,11 @@ object Checking {
checkNoConflict(Final, Sealed)
checkNoConflict(Private, Protected)
checkNoConflict(Abstract, Override)
+ if (sym.isType && !sym.is(Deferred))
+ for (cls <- sym.allOverriddenSymbols.filter(_.isClass)) {
+ fail(i"$sym cannot have the same name as ${cls.showLocated} -- class definitions cannot be overridden")
+ sym.setFlag(Private) // break the overriding relationship by making sym Private
+ }
}
/** Check the type signature of the symbol `M` defined by `tree` does not refer