aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2014-11-27 16:18:26 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2014-12-16 13:15:00 +0100
commit0b73ed1ce8747ab8b69dffa48f4bc6b264f9e939 (patch)
tree7977ba77fbb3207363c099b7b2a3ef6821ef2ef0 /src
parent1ba9f18f7109206fa913951f2c4cf8ec6cd4e69a (diff)
downloaddotty-0b73ed1ce8747ab8b69dffa48f4bc6b264f9e939.tar.gz
dotty-0b73ed1ce8747ab8b69dffa48f4bc6b264f9e939.tar.bz2
dotty-0b73ed1ce8747ab8b69dffa48f4bc6b264f9e939.zip
Mixing now also changes Scala2 traits into interfaces.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/transform/Mixin.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/Mixin.scala b/src/dotty/tools/dotc/transform/Mixin.scala
index 230763fae..9cd29881b 100644
--- a/src/dotty/tools/dotc/transform/Mixin.scala
+++ b/src/dotty/tools/dotc/transform/Mixin.scala
@@ -73,7 +73,12 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
override def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation =
if (sym.is(Accessor, butNot = Deferred) && sym.owner.is(Trait))
sym.copySymDenotation(initFlags = sym.flags | Deferred)
- else
+ else if(sym.is(Scala2x) && sym.is(Trait, JavaDefined)) { // fixup scala2 traits to become interfaces
+ val info = sym.asClass.classInfo
+ val parents: List[TypeRef] = defn.ObjectType.asInstanceOf[TypeRef] :: info.parents // new superClass is object
+ val newInfo = info.derivedClassInfo(classParents = parents)
+ sym.copySymDenotation(initFlags = sym.flags | JavaInterface, info = newInfo)
+ } else
sym
private def initializer(sym: Symbol)(implicit ctx: Context): TermSymbol = {