From 21ab9a1355036aa953db4e1f87c8f0f9a06506b5 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 27 Mar 2017 18:23:07 +0200 Subject: Get rid of ExpandedName flag --- compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala | 7 ++++--- compiler/src/dotty/tools/dotc/transform/Mixin.scala | 2 +- compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala | 2 +- compiler/src/dotty/tools/dotc/transform/SymUtils.scala | 4 ++++ 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/transform') diff --git a/compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala b/compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala index 9c01aaa9a..594d85bfa 100644 --- a/compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala +++ b/compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala @@ -14,6 +14,7 @@ import DenotTransformers._ import Annotations._ import StdNames._ import NameOps._ +import NameExtractors._ import ast.Trees._ /** This phase augments Scala2 traits with implementation classes and with additional members @@ -66,7 +67,7 @@ class AugmentScala2Traits extends MiniPhaseTransform with IdentityDenotTransform meth.copy( owner = implClass, name = mold.name.asTermName, - flags = Method | JavaStatic | mold.flags & ExpandedName, + flags = Method | JavaStatic, info = fullyParameterizedType(mold.info, mixin)) } @@ -75,7 +76,7 @@ class AugmentScala2Traits extends MiniPhaseTransform with IdentityDenotTransform name = getter.ensureNotPrivate.name .expandedName(getter.owner, nme.TRAIT_SETTER_SEPARATOR) .asTermName.setterName, - flags = Method | Accessor | ExpandedName, + flags = Method | Accessor, info = MethodType(getter.info.resultType :: Nil, defn.UnitType)) for (sym <- mixin.info.decls) { @@ -89,7 +90,7 @@ class AugmentScala2Traits extends MiniPhaseTransform with IdentityDenotTransform else if (!sym.is(Deferred) && !sym.setter.exists && !sym.info.resultType.isInstanceOf[ConstantType]) traitSetter(sym.asTerm).enteredAfter(thisTransform) - if ((sym.is(PrivateAccessor, butNot = ExpandedName) && + if ((sym.is(PrivateAccessor) && !sym.name.is(ExpandedName) && (sym.isGetter || sym.isSetter)) // strangely, Scala 2 fields are also methods that have Accessor set. || sym.is(SuperAccessor)) // scala2 superaccessors are pickled as private, but are compiled as public expanded sym.ensureNotPrivate.installAfter(thisTransform) diff --git a/compiler/src/dotty/tools/dotc/transform/Mixin.scala b/compiler/src/dotty/tools/dotc/transform/Mixin.scala index e9ec4890c..fc23d96ee 100644 --- a/compiler/src/dotty/tools/dotc/transform/Mixin.scala +++ b/compiler/src/dotty/tools/dotc/transform/Mixin.scala @@ -220,7 +220,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform => ref(mixin.implClass).select(implClassGetter).appliedTo(This(cls)) } - if (isCurrent(getter) || getter.is(ExpandedName)) { + if (isCurrent(getter) || getter.name.is(ExpandedName)) { val rhs = if (was(getter, ParamAccessor)) nextArgument() else if (isScala2x) diff --git a/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala b/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala index 728c1696b..32923f0f5 100644 --- a/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala +++ b/compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala @@ -79,7 +79,7 @@ class SuperAccessors(thisTransformer: DenotTransformer) { .suchThat(_.signature == superInfo.signature).symbol .orElse { ctx.debuglog(s"add super acc ${sym.showLocated} to $clazz") - val deferredOrPrivate = if (clazz is Trait) Deferred | ExpandedName else Private + val deferredOrPrivate = if (clazz is Trait) Deferred else Private val acc = ctx.newSymbol( clazz, superName, SuperAccessor | Artifact | Method | deferredOrPrivate, superInfo, coord = sym.coord).enteredAfter(thisTransformer) diff --git a/compiler/src/dotty/tools/dotc/transform/SymUtils.scala b/compiler/src/dotty/tools/dotc/transform/SymUtils.scala index 105f54d3a..f6ff539fe 100644 --- a/compiler/src/dotty/tools/dotc/transform/SymUtils.scala +++ b/compiler/src/dotty/tools/dotc/transform/SymUtils.scala @@ -10,6 +10,7 @@ import Decorators._ import Names._ import StdNames._ import NameOps._ +import NameExtractors._ import Flags._ import Annotations._ @@ -51,6 +52,9 @@ class SymUtils(val self: Symbol) extends AnyVal { def isAnyOverride(implicit ctx: Context) = self.is(Override) || self.is(AbsOverride) // careful: AbsOverride is a term only flag. combining with Override would catch only terms. + def isAliasPreferred(implicit ctx: Context) = + self.is(AliasPreferred) || self.name.is(ExpandedName) + /** If this is a constructor, its owner: otherwise this. */ final def skipConstructor(implicit ctx: Context): Symbol = if (self.isConstructor) self.owner else self -- cgit v1.2.3