summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-06-26 23:21:38 +0200
committerJason Zaugg <jzaugg@gmail.com>2012-06-26 23:21:38 +0200
commitac71812170547acdce74fc224bfa9f3a776b4cd1 (patch)
tree5e4935f645c02bf8e2a173eb7e4fd904871efd0d /src/compiler
parentd1687d7418598b56269edbaa70a3b3ce820fdf64 (diff)
downloadscala-ac71812170547acdce74fc224bfa9f3a776b4cd1.tar.gz
scala-ac71812170547acdce74fc224bfa9f3a776b4cd1.tar.bz2
scala-ac71812170547acdce74fc224bfa9f3a776b4cd1.zip
SI-2796 Warn if early definitions are used with a trait.
For which they (currently) have no special meaning.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index acf1b3dc59..4d6e1c71a1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1753,6 +1753,12 @@ trait Typers extends Modes with Adaptations with Tags {
if (clazz.info.firstParent.typeSymbol == AnyValClass)
validateDerivedValueClass(clazz, body1)
+ if (clazz.isTrait) {
+ for (decl <- clazz.info.decls if decl.isTerm && decl.isEarlyInitialized) {
+ unit.warning(decl.pos, "Implementation restriction: early definitions in traits are not initialized before the super class is initialized.")
+ }
+ }
+
treeCopy.Template(templ, parents1, self1, body1) setType clazz.tpe
}