File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ class LazyVals extends MiniPhase with IdentityDenotTransformer {
3636
3737 override def changesMembers : Boolean = true // the phase adds lazy val accessors
3838
39- def transformer : LazyVals = new LazyVals
40-
4139 val containerFlags : FlagSet = Synthetic | Mutable | Lazy
4240 val initFlags : FlagSet = Synthetic | Method
4341
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ class MoveStatics extends MiniPhase with SymTransformer {
2424 override def phaseName : String = MoveStatics .name
2525
2626 def transformSym (sym : SymDenotation )(implicit ctx : Context ): SymDenotation = {
27- if (sym.hasAnnotation(defn.ScalaStaticAnnot ) && sym.owner.is(Flags .Module ) && sym.owner.companionClass.exists) {
27+ if (sym.hasAnnotation(defn.ScalaStaticAnnot ) && sym.owner.is(Flags .Module ) &&
28+ sym.owner.companionClass.exists && ! sym.owner.companionClass.is(Flags .Trait )) {
2829 sym.owner.asClass.delete(sym.symbol)
2930 sym.owner.companionClass.asClass.enter(sym.symbol)
3031 val flags = if (sym.is(Flags .Method )) sym.flags else sym.flags | Flags .Mutable
@@ -60,6 +61,7 @@ class MoveStatics extends MiniPhase with SymTransformer {
6061 def move (module : TypeDef , companion : TypeDef ): List [Tree ] = {
6162 assert(companion ne module)
6263 if (! module.symbol.is(Flags .Module )) move(companion, module)
64+ else if (companion.ne(null ) && companion.symbol.is(Flags .Trait )) List (module, companion)
6365 else {
6466 val allMembers =
6567 (if (companion ne null ) {companion.rhs.asInstanceOf [Template ].body} else Nil ) ++
Original file line number Diff line number Diff line change 1+ trait Matchers {
2+ object Helper
3+ }
4+
5+ object Matchers extends Matchers
6+
7+ object Test {
8+ def main (args : Array [String ]): Unit = Matchers
9+ }
You can’t perform that action at this time.
0 commit comments