aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2016-04-18 21:49:35 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2016-06-07 14:18:27 +0200
commit7cacd0f0625654b408c11fe37553342f027c8043 (patch)
treee1483ea591b7597804df94397b3bc91b1a4b8fc8 /src
parentce2b9642c35c15bff80dfc274248f13a5c1a32d1 (diff)
downloaddotty-7cacd0f0625654b408c11fe37553342f027c8043.tar.gz
dotty-7cacd0f0625654b408c11fe37553342f027c8043.tar.bz2
dotty-7cacd0f0625654b408c11fe37553342f027c8043.zip
Fix #1224: static members do not override\implement parent symbols.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/transform/CheckStatic.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/transform/CheckStatic.scala b/src/dotty/tools/dotc/transform/CheckStatic.scala
index d47c88130..3a452ca08 100644
--- a/src/dotty/tools/dotc/transform/CheckStatic.scala
+++ b/src/dotty/tools/dotc/transform/CheckStatic.scala
@@ -61,13 +61,15 @@ class CheckStatic extends MiniPhaseTransform { thisTransformer =>
def clashes = companion.asClass.membersNamed(defn.name)
if (!companion.exists) {
- ctx.error("object that conatin @static members should have companion class", defn.pos)
+ ctx.error("object that contains @static members should have companion class", defn.pos)
} else if (clashes.exists) {
ctx.error("companion classes cannot define members with same name as @static member", defn.pos)
} else if (defn.symbol.is(Flags.Mutable) && companion.is(Flags.Trait)) {
- ctx.error("Companions of traits cannot define mutable @static fields")
+ ctx.error("Companions of traits cannot define mutable @static fields", defn.pos)
} else if (defn.symbol.is(Flags.Lazy)) {
- ctx.error("Lazy @static fields are not supported")
+ ctx.error("Lazy @static fields are not supported", defn.pos)
+ } else if (defn.symbol.allOverriddenSymbols.nonEmpty) {
+ ctx.error("@static members cannot override or implement non-static ones")
}
} else hadNonStaticField = hadNonStaticField || defn.isInstanceOf[ValDef]