diff options
-rw-r--r-- | src/dotty/tools/dotc/transform/MixinOps.scala | 7 | ||||
-rw-r--r-- | tests/pos/scala2traits/dotty-subclass.scala | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/transform/MixinOps.scala b/src/dotty/tools/dotc/transform/MixinOps.scala index 64f0edfb8..48c6f9bea 100644 --- a/src/dotty/tools/dotc/transform/MixinOps.scala +++ b/src/dotty/tools/dotc/transform/MixinOps.scala @@ -13,12 +13,15 @@ class MixinOps(cls: ClassSymbol, thisTransform: DenotTransformer)(implicit ctx: val superCls: Symbol = cls.superClass val mixins: List[ClassSymbol] = cls.mixins - def implementation(member: TermSymbol): TermSymbol = - member.copy( + def implementation(member: TermSymbol): TermSymbol = { + val res = member.copy( owner = cls, name = member.name.stripScala2LocalSuffix, flags = member.flags &~ Deferred, info = cls.thisType.memberInfo(member)).enteredAfter(thisTransform).asTerm + res.addAnnotations(member) + res + } def superRef(target: Symbol, pos: Position = cls.pos): Tree = { val sup = if (target.isConstructor && !target.owner.is(Trait)) diff --git a/tests/pos/scala2traits/dotty-subclass.scala b/tests/pos/scala2traits/dotty-subclass.scala index 4e162dd14..62720b993 100644 --- a/tests/pos/scala2traits/dotty-subclass.scala +++ b/tests/pos/scala2traits/dotty-subclass.scala @@ -1,7 +1,13 @@ // This is supposed to be compiled by Dotty class Sub extends T -class A extends S2T with S2Tprivate { +trait DT { + + @volatile lazy val dx = 2 + +} + +class A extends S2T with S2Tprivate with DT { val a: Int = 3 var b = 2 } |