diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-04 23:26:03 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-04 23:26:03 -0700 |
commit | bb86fa21031d446c870887eabbc8b52b6416b25b (patch) | |
tree | 1121efd3cb5bc5cabc41bd43ec110068ef3d6e3b /src/compiler | |
parent | b9371a739a6ac0399fece24ba202a2c9f40e3cc8 (diff) | |
parent | ac71812170547acdce74fc224bfa9f3a776b4cd1 (diff) | |
download | scala-bb86fa21031d446c870887eabbc8b52b6416b25b.tar.gz scala-bb86fa21031d446c870887eabbc8b52b6416b25b.tar.bz2 scala-bb86fa21031d446c870887eabbc8b52b6416b25b.zip |
Merge pull request #777 from retronym/ticket/2796
SI-2796 Warn if early definitions are used with a trait.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 |
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 52cce11deb..018daf4568 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 } |