File tree 3 files changed +12
-3
lines changed
compiler/src/dotty/tools/dotc/transform
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 {
36
36
37
37
override def changesMembers : Boolean = true // the phase adds lazy val accessors
38
38
39
- def transformer : LazyVals = new LazyVals
40
-
41
39
val containerFlags : FlagSet = Synthetic | Mutable | Lazy
42
40
val initFlags : FlagSet = Synthetic | Method
43
41
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ class MoveStatics extends MiniPhase with SymTransformer {
24
24
override def phaseName : String = MoveStatics .name
25
25
26
26
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 )) {
28
29
sym.owner.asClass.delete(sym.symbol)
29
30
sym.owner.companionClass.asClass.enter(sym.symbol)
30
31
val flags = if (sym.is(Flags .Method )) sym.flags else sym.flags | Flags .Mutable
@@ -60,6 +61,7 @@ class MoveStatics extends MiniPhase with SymTransformer {
60
61
def move (module : TypeDef , companion : TypeDef ): List [Tree ] = {
61
62
assert(companion ne module)
62
63
if (! module.symbol.is(Flags .Module )) move(companion, module)
64
+ else if (companion.ne(null ) && companion.symbol.is(Flags .Trait )) List (module, companion)
63
65
else {
64
66
val allMembers =
65
67
(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