aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-03-27 18:23:07 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:11 +0200
commit21ab9a1355036aa953db4e1f87c8f0f9a06506b5 (patch)
tree3824573b541226f7e90609e7163383b471838667 /compiler
parent0efd6b93cf45be4cb211093185fef2923f53ef67 (diff)
downloaddotty-21ab9a1355036aa953db4e1f87c8f0f9a06506b5.tar.gz
dotty-21ab9a1355036aa953db4e1f87c8f0f9a06506b5.tar.bz2
dotty-21ab9a1355036aa953db4e1f87c8f0f9a06506b5.zip
Get rid of ExpandedName flag
Diffstat (limited to 'compiler')
-rw-r--r--compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/ast/Desugar.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/Definitions.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/Flags.scala23
-rw-r--r--compiler/src/dotty/tools/dotc/core/NameExtractors.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/core/NameOps.scala10
-rw-r--r--compiler/src/dotty/tools/dotc/core/Signature.scala8
-rw-r--r--compiler/src/dotty/tools/dotc/core/SymDenotations.scala6
-rw-r--r--compiler/src/dotty/tools/dotc/core/TypeApplications.scala9
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala3
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala1
-rw-r--r--compiler/src/dotty/tools/dotc/core/unpickleScala2/PickleBuffer.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala7
-rw-r--r--compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala5
-rw-r--r--compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala7
-rw-r--r--compiler/src/dotty/tools/dotc/transform/Mixin.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/transform/SuperAccessors.scala2
-rw-r--r--compiler/src/dotty/tools/dotc/transform/SymUtils.scala4
20 files changed, 57 insertions, 48 deletions
diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
index 309d97261..45bbca017 100644
--- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
+++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
@@ -421,7 +421,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
val Flag_METHOD: Flags = Flags.Method.bits
val ExcludedForwarderFlags: Flags = {
Flags.Specialized | Flags.Lifted | Flags.Protected | Flags.JavaStatic |
- Flags.ExpandedName | Flags.Bridge | Flags.VBridge | Flags.Private | Flags.Macro
+ Flags.Bridge | Flags.VBridge | Flags.Private | Flags.Macro
}.bits
diff --git a/compiler/src/dotty/tools/dotc/ast/Desugar.scala b/compiler/src/dotty/tools/dotc/ast/Desugar.scala
index 66fc6bf84..e2679ef56 100644
--- a/compiler/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/compiler/src/dotty/tools/dotc/ast/Desugar.scala
@@ -244,7 +244,7 @@ object desugar {
def typeDef(tdef: TypeDef)(implicit ctx: Context): Tree = {
if (tdef.mods is PrivateLocalParam) {
val tparam = cpy.TypeDef(tdef)(name = tdef.name.expandedName(ctx.owner))
- .withMods(tdef.mods &~ PrivateLocal | ExpandedName)
+ .withMods(tdef.mods &~ PrivateLocal)
val alias = cpy.TypeDef(tdef)(rhs = refOfDef(tparam))
.withMods(tdef.mods & VarianceFlags | PrivateLocalParamAccessor | Synthetic)
Thicket(tparam, alias)
diff --git a/compiler/src/dotty/tools/dotc/core/Definitions.scala b/compiler/src/dotty/tools/dotc/core/Definitions.scala
index b70fcb093..670b919ac 100644
--- a/compiler/src/dotty/tools/dotc/core/Definitions.scala
+++ b/compiler/src/dotty/tools/dotc/core/Definitions.scala
@@ -67,7 +67,7 @@ class Definitions {
enterTypeField(cls, name, flags | ClassTypeParamCreationFlags, scope)
private def enterSyntheticTypeParam(cls: ClassSymbol, paramFlags: FlagSet, scope: MutableScope, suffix: String = "T0") =
- enterTypeParam(cls, suffix.toTypeName.expandedName(cls), ExpandedName | paramFlags, scope)
+ enterTypeParam(cls, suffix.toTypeName.expandedName(cls), paramFlags, scope)
// NOTE: Ideally we would write `parentConstrs: => Type*` but SIP-24 is only
// implemented in Dotty and not in Scala 2.
diff --git a/compiler/src/dotty/tools/dotc/core/Flags.scala b/compiler/src/dotty/tools/dotc/core/Flags.scala
index 29f1078a2..8a1e14c63 100644
--- a/compiler/src/dotty/tools/dotc/core/Flags.scala
+++ b/compiler/src/dotty/tools/dotc/core/Flags.scala
@@ -272,9 +272,6 @@ object Flags {
*/
final val Synthetic = commonFlag(18, "<synthetic>")
- /** Symbol's name is expanded */
- final val ExpandedName = commonFlag(19, "<expandedname>")
-
/** A covariant type variable / an outer accessor */
final val CovariantOrOuter = commonFlag(20, "")
final val Covariant = typeFlag(20, "<covariant>")
@@ -308,7 +305,6 @@ object Flags {
final val CaseAccessor = termFlag(25, "<caseaccessor>")
/** A binding for a type parameter of a base class or trait.
- * TODO: Replace with combination of isType, ExpandedName, and Override?
*/
final val BaseTypeArg = typeFlag(25, "<basetypearg>")
@@ -409,9 +405,6 @@ object Flags {
final val Scala2ExistentialCommon = commonFlag(55, "<existential>")
final val Scala2Existential = Scala2ExistentialCommon.toTypeFlags
- /** An overloaded symbol (Scala 2.x only) */
- final val Scala2Overloaded = termFlag(56, "<overloaded>")
-
/** A module variable (Scala 2.x only) */
final val Scala2ModuleVar = termFlag(57, "<modulevar>")
@@ -424,6 +417,13 @@ object Flags {
/** A method that is known to have inherited default parameters */
final val InheritedDefaultParams = termFlag(60, "<inherited-default-param>")
+ /** Translation of Scala2's EXPANDEDNAME flag. This flag is never stored in
+ * symbols, is only used locally when reading the flags of a Scala2 symbol.
+ * It's therefore safe to share the code with `InheritedDefaultParams` because
+ * the latter is never present in Scala2 unpickle info.
+ */
+ final val Scala2ExpandedName = InheritedDefaultParams.toCommonFlags
+
/** A method that is known to have no default parameters */
final val NoDefaultParams = termFlag(61, "<no-default-param>")
@@ -475,7 +475,7 @@ object Flags {
/** Flags that are passed from a type parameter of a class to a refinement symbol
* that sets the type parameter */
- final val RetainedTypeArgFlags = VarianceFlags | ExpandedName | Protected | Local
+ final val RetainedTypeArgFlags = VarianceFlags | Protected | Local
/** Modules always have these flags set */
final val ModuleCreationFlags = ModuleVal | Lazy | Final | Stable
@@ -502,7 +502,7 @@ object Flags {
*/
final val RetainedModuleValAndClassFlags: FlagSet =
AccessFlags | Package | Case |
- Synthetic | ExpandedName | JavaDefined | JavaStatic | Artifact |
+ Synthetic | JavaDefined | JavaStatic | Artifact |
Erroneous | Lifted | MixedIn | Specialized
/** Flags that can apply to a module val */
@@ -550,9 +550,6 @@ object Flags {
/** A private accessor */
final val PrivateAccessor = allOf(Private, Accessor)
- /** A type parameter with synthesized name */
- final val ExpandedTypeParam = allOf(ExpandedName, TypeParam)
-
/** An inline method */
final val InlineMethod = allOf(Inline, Method)
@@ -578,7 +575,7 @@ object Flags {
final val FinalOrInline = Final | Inline
/** If symbol of a type alias has these flags, prefer the alias */
- final val AliasPreferred = TypeParam | BaseTypeArg | ExpandedName
+ final val AliasPreferred = TypeParam | BaseTypeArg
/** A covariant type parameter instance */
final val LocalCovariant = allOf(Local, Covariant)
diff --git a/compiler/src/dotty/tools/dotc/core/NameExtractors.scala b/compiler/src/dotty/tools/dotc/core/NameExtractors.scala
index ae7d65829..eaac30bf5 100644
--- a/compiler/src/dotty/tools/dotc/core/NameExtractors.scala
+++ b/compiler/src/dotty/tools/dotc/core/NameExtractors.scala
@@ -45,7 +45,7 @@ object NameExtractors {
class PrefixNameExtractor(tag: Int, prefix: String, infoString: String) extends ClassifiedNameExtractor(tag, infoString) {
def mkString(underlying: TermName, info: ThisInfo) =
- underlying.mapLast(n => termName(prefix + n)).toString
+ underlying.mapLast(n => termName(prefix + n.toString)).toString
}
class SuffixNameExtractor(tag: Int, suffix: String, infoString: String) extends ClassifiedNameExtractor(tag, infoString) {
@@ -99,7 +99,7 @@ object NameExtractors {
object QualifiedName extends QualifiedNameExtractor(QUALIFIED, ".", "Qualified")
object FlattenedName extends QualifiedNameExtractor(FLATTENED, "$", "Flattened")
- object XpandedName extends QualifiedNameExtractor(EXPANDED, str.EXPAND_SEPARATOR, "Expanded")
+ object ExpandedName extends QualifiedNameExtractor(EXPANDED, str.EXPAND_SEPARATOR, "Expanded")
object TraitSetterName extends QualifiedNameExtractor(TRAITSETTER, str.TRAIT_SETTER_SEPARATOR, "TraitSetter")
object DefaultGetterName extends NumberedNameExtractor(DEFAULTGETTER, "DefaultGetter") {
@@ -146,6 +146,6 @@ object NameExtractors {
val separatorToQualified: Map[String, QualifiedNameExtractor] =
Map("." -> QualifiedName,
"$" -> FlattenedName,
- str.EXPAND_SEPARATOR -> XpandedName,
+ str.EXPAND_SEPARATOR -> ExpandedName,
str.TRAIT_SETTER_SEPARATOR -> TraitSetterName)
} \ No newline at end of file
diff --git a/compiler/src/dotty/tools/dotc/core/NameOps.scala b/compiler/src/dotty/tools/dotc/core/NameOps.scala
index c837bc25c..f467fbcd5 100644
--- a/compiler/src/dotty/tools/dotc/core/NameOps.scala
+++ b/compiler/src/dotty/tools/dotc/core/NameOps.scala
@@ -138,7 +138,7 @@ object NameOps {
/** The expanded name of `name` relative to given class `base`.
*/
def expandedName(base: Symbol, separator: Name)(implicit ctx: Context): N =
- expandedName(if (base is Flags.ExpandedName) base.name else base.fullNameSeparated("$"), separator)
+ expandedName(if (base.name.is(ExpandedName)) base.name else base.fullNameSeparated("$"), separator)
def expandedName(base: Symbol)(implicit ctx: Context): N = expandedName(base, nme.EXPAND_SEPARATOR)
@@ -161,7 +161,7 @@ object NameOps {
/** Revert the expanded name. */
def unexpandedName: N = likeTyped {
- name.rewrite { case XpandedName(_, unexp) => unexp }
+ name.rewrite { case ExpandedName(_, unexp) => unexp }
}
def unexpandedNameOfMangled: N = likeTyped {
@@ -175,8 +175,8 @@ object NameOps {
if (idx < 0) name else (name drop (idx + nme.EXPAND_SEPARATOR.length))
}
- def expandedPrefix: N = likeTyped { name.exclude(XpandedName) }
-
+ def expandedPrefix: N = likeTyped { name.exclude(ExpandedName) }
+
def expandedPrefixOfMangled: N = {
val idx = name.lastIndexOfSlice(nme.EXPAND_SEPARATOR)
assert(idx >= 0)
@@ -188,7 +188,7 @@ object NameOps {
val unmangled = unexpandedNameOfMangled
if (name eq unmangled) name
else likeTyped(
- XpandedName(expandedPrefixOfMangled.toTermName, unmangled.asSimpleName))
+ ExpandedName(expandedPrefixOfMangled.toTermName, unmangled.asSimpleName))
}
else name
diff --git a/compiler/src/dotty/tools/dotc/core/Signature.scala b/compiler/src/dotty/tools/dotc/core/Signature.scala
index fcd1e2376..4699cecf2 100644
--- a/compiler/src/dotty/tools/dotc/core/Signature.scala
+++ b/compiler/src/dotty/tools/dotc/core/Signature.scala
@@ -34,6 +34,14 @@ import scala.annotation.tailrec
case class Signature(paramsSig: List[TypeName], resSig: TypeName) {
import Signature._
+/* FIXME does not compile under dotty, we get a missing param error
+ def checkUnqual(name: TypeName) = name mapParts { part =>
+ assert(!part.contains('.'), name)
+ part
+ }
+ paramsSig.foreach(checkUnqual)
+ checkUnqual(resSig)
+*/
/** Two names are consistent if they are the same or one of them is tpnme.Uninstantiated */
private def consistent(name1: TypeName, name2: TypeName) =
name1 == name2 || name1 == tpnme.Uninstantiated || name2 == tpnme.Uninstantiated
diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
index 4e40d1e05..bbebdd21d 100644
--- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -367,7 +367,7 @@ object SymDenotations {
/** The expanded name of this denotation. */
final def expandedName(implicit ctx: Context) =
- if (is(ExpandedName) || isConstructor) name
+ if (name.is(ExpandedName) || isConstructor) name
else {
def legalize(name: Name): Name = // JVM method names may not contain `<' or `>' characters
if (is(Method)) name.replace('<', '(').replace('>', ')') else name
@@ -1210,9 +1210,7 @@ object SymDenotations {
/** If denotation is private, remove the Private flag and expand the name if necessary */
def ensureNotPrivate(implicit ctx: Context) =
if (is(Private))
- copySymDenotation(
- name = expandedName,
- initFlags = this.flags &~ Private | ExpandedName)
+ copySymDenotation(name = expandedName, initFlags = this.flags &~ Private)
else this
}
diff --git a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala
index 94b726491..0220928a2 100644
--- a/compiler/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/compiler/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -11,6 +11,7 @@ import util.Stats._
import util.common._
import Names._
import NameOps._
+import NameExtractors._
import Flags._
import StdNames.tpnme
import util.Positions.Position
@@ -464,11 +465,6 @@ class TypeApplications(val self: Type) extends AnyVal {
self
case _ =>
val v = tparam.paramVariance
- /* Not neeeded.
- if (v > 0 && !(tparam is Local) && !(tparam is ExpandedTypeParam)) TypeBounds.upper(self)
- else if (v < 0 && !(tparam is Local) && !(tparam is ExpandedTypeParam)) TypeBounds.lower(self)
- else
- */
TypeAlias(self, v)
}
@@ -510,13 +506,14 @@ class TypeApplications(val self: Type) extends AnyVal {
*/
final def baseTypeWithArgs(base: Symbol)(implicit ctx: Context): Type = ctx.traceIndented(s"btwa ${self.show} wrt $base", core, show = true) {
def default = self.baseTypeRef(base).appliedTo(baseArgInfos(base))
+ def isExpandedTypeParam(sym: Symbol) = sym.is(TypeParam) && sym.name.is(ExpandedName)
self match {
case tp: TypeRef =>
tp.info match {
case TypeBounds(_, hi) => hi.baseTypeWithArgs(base)
case _ => default
}
- case tp @ RefinedType(parent, name, _) if !tp.member(name).symbol.is(ExpandedTypeParam) =>
+ case tp @ RefinedType(parent, name, _) if !isExpandedTypeParam(tp.member(name).symbol) =>
tp.wrapIfMember(parent.baseTypeWithArgs(base))
case tp: TermRef =>
tp.underlying.baseTypeWithArgs(base)
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala b/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala
index 74c4265f2..a09a21964 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/NameBuffer.scala
@@ -62,7 +62,7 @@ class NameBuffer extends TastyBuffer(10000) {
withLength { writeNameRef(qualified); writeNameRef(selector) }
case FlattenedName(qualified, selector) =>
withLength { writeNameRef(qualified); writeNameRef(selector) }
- case XpandedName(prefix, original) =>
+ case ExpandedName(prefix, original) =>
withLength { writeNameRef(prefix); writeNameRef(original) }
case SignedName(original, Signature(params, result)) =>
withLength(
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala
index 6dd22db88..d20e890c2 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/TastyUnpickler.scala
@@ -54,7 +54,7 @@ class TastyUnpickler(reader: TastyReader) {
case FLATTENED =>
FlattenedName(readName(), readName().asSimpleName)
case EXPANDED =>
- XpandedName(readName(), readName().asSimpleName)
+ ExpandedName(readName(), readName().asSimpleName)
case SIGNED =>
val original = readName()
val result = readName().toTypeName
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
index 2da638291..e697ff028 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
@@ -13,6 +13,7 @@ import NameOps._, NameExtractors._
import StdNames.nme
import TastyBuffer._
import TypeApplications._
+import transform.SymUtils._
import config.Config
class TreePickler(pickler: TastyPickler) {
@@ -141,7 +142,7 @@ class TreePickler(pickler: TastyPickler) {
withLength { pickleType(tycon); args.foreach(pickleType(_)) }
case ConstantType(value) =>
pickleConstant(value)
- case tpe: TypeRef if tpe.info.isAlias && tpe.symbol.is(Flags.AliasPreferred) =>
+ case tpe: TypeRef if tpe.info.isAlias && tpe.symbol.isAliasPreferred =>
pickleType(tpe.superType)
case tpe: WithFixedSym =>
val sym = tpe.symbol
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
index 11c04e2b4..d8497f39d 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -428,7 +428,6 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi
if (!rhsIsEmpty) skipTree()
val (givenFlags, annots, privateWithin) = readModifiers(end)
val nameFlags =
- (if (name.is(XpandedName)) ExpandedName else EmptyFlags) |
(if (name.is(NameExtractors.SuperAccessorName)) SuperAccessor else EmptyFlags)
pickling.println(i"creating symbol $name at $start with flags $givenFlags")
val flags = normalizeFlags(tag, givenFlags | nameFlags, name, isAbsType, rhsIsEmpty)
diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/PickleBuffer.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/PickleBuffer.scala
index 6ee9f1f9e..773c6760e 100644
--- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/PickleBuffer.scala
+++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/PickleBuffer.scala
@@ -229,7 +229,7 @@ object PickleBuffer {
MODULEVAR -> Scala2ModuleVar,
LAZY -> Lazy,
MIXEDIN -> (MixedIn, Scala2Existential),
- EXPANDEDNAME -> ExpandedName,
+ EXPANDEDNAME -> Scala2ExpandedName,
IMPLCLASS -> (Scala2PreSuper, ImplClass),
SPECIALIZED -> Specialized,
VBRIDGE -> VBridge,
diff --git a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
index c37d60b41..aed0e97f1 100644
--- a/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
@@ -437,7 +437,10 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
if (name == nme.TRAIT_CONSTRUCTOR) nme.CONSTRUCTOR
else name.asTermName.unmangleMethodName
}
- if (flags is ExpandedName) name = name.unmangleExpandedName
+ if (flags is Scala2ExpandedName) {
+ name = name.unmangleExpandedName
+ flags = flags &~ Scala2ExpandedName
+ }
if (flags is SuperAccessor) name = name.asTermName.unmangleSuperName
def isClassRoot = (name == classRoot.name) && (owner == classRoot.owner) && !(flags is ModuleClass)
@@ -476,7 +479,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
var flags1 = flags
if (flags is TypeParam) {
name1 = name1.expandedName(owner)
- flags1 |= owner.typeParamCreationFlags | ExpandedName
+ flags1 |= owner.typeParamCreationFlags
}
ctx.newSymbol(owner, name1, flags1, localMemberUnpickler, coord = start)
case CLASSsym =>
diff --git a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 798a1c854..f6399d3b7 100644
--- a/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -13,6 +13,7 @@ import Trees._
import TypeApplications._
import Decorators._
import config.Config
+import transform.SymUtils._
import scala.annotation.switch
import language.implicitConversions
@@ -63,7 +64,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
override protected def simpleNameString(sym: Symbol): String = {
val name = if (ctx.property(XprintMode).isEmpty) sym.originalName else sym.name
- nameString(if (sym is ExpandedTypeParam) name.asTypeName.unexpandedName else name)
+ nameString(if (sym.is(TypeParam)) name.asTypeName.unexpandedName else name)
}
override def fullNameString(sym: Symbol): String =
@@ -131,7 +132,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
if (defn.isTupleClass(cls)) return toTextTuple(args)
return (toTextLocal(tycon) ~ "[" ~ Text(args map argText, ", ") ~ "]").close
case tp: TypeRef =>
- val hideType = !ctx.settings.debugAlias.value && (tp.symbol is AliasPreferred)
+ val hideType = !ctx.settings.debugAlias.value && (tp.symbol.isAliasPreferred)
if (hideType && !ctx.phase.erasedTypes && !tp.symbol.isCompleting) {
tp.info match {
case TypeAlias(alias) => return toText(alias)
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