Skip to content

Commit 762f16b

Browse files
committed
Drop BaseTypeArg flag
... and related code
1 parent 5850775 commit 762f16b

File tree

11 files changed

+3
-46
lines changed

11 files changed

+3
-46
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class ScalaSettings extends Settings.SettingGroup {
6767
val Ycheck = PhasesSetting("-Ycheck", "Check the tree at the end of")
6868
val YcheckMods = BooleanSetting("-Ycheck-mods", "Check that symbols and their defining trees have modifiers in sync")
6969
val debug = BooleanSetting("-Ydebug", "Increase the quantity of debugging output.")
70-
val debugAlias = BooleanSetting("-Ydebug-alias", "Never follow alias when printing types")
7170
val debugTrace = BooleanSetting("-Ydebug-trace", "Trace core operations")
7271
val debugFlags = BooleanSetting("-Ydebug-flags", "Print all flags of definitions")
7372
val debugNames = BooleanSetting("-Ydebug-names", "Show internal representation of names")

compiler/src/dotty/tools/dotc/core/Definitions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,6 @@ class Definitions {
719719
else ArrayType.appliedTo(elem :: Nil)
720720
def unapply(tp: Type)(implicit ctx: Context): Option[Type] = tp.dealias match {
721721
case AppliedType(at, arg :: Nil) if at isRef ArrayType.symbol => Some(arg)
722-
case at: RefinedType if (at isRef ArrayType.symbol) && at.argInfos.length == 1 => Some(at.argInfos.head) // @!!!
723722
case _ => None
724723
}
725724
}

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,6 @@ object Flags {
303303
/** A case parameter accessor */
304304
final val CaseAccessor = termFlag(25, "<caseaccessor>")
305305

306-
/** A binding for a type parameter of a base class or trait.
307-
*/
308-
final val BaseTypeArg = typeFlag(25, "<basetypearg>") // @!!!
309-
310-
final val CaseAccessorOrBaseTypeArg = CaseAccessor.toCommonFlags
311-
312306
/** A super accessor */
313307
final val Scala2SuperAccessor = termFlag(26, "<superaccessor>")
314308

@@ -451,7 +445,7 @@ object Flags {
451445
final val FromStartFlags =
452446
Module | Package | Deferred | MethodOrHKCommon | Param | ParamAccessor.toCommonFlags |
453447
Scala2ExistentialCommon | Mutable.toCommonFlags | Touched | JavaStatic |
454-
CovariantOrOuter | ContravariantOrLabel | CaseAccessorOrBaseTypeArg |
448+
CovariantOrOuter | ContravariantOrLabel | CaseAccessor.toCommonFlags |
455449
Fresh | Erroneous | ImplicitCommon | Permanent | Synthetic |
456450
SuperAccessorOrScala2x | Inline
457451

@@ -573,9 +567,6 @@ object Flags {
573567
/** value that's final or inline */
574568
final val FinalOrInline = Final | Inline
575569

576-
/** If symbol of a type alias has these flags, prefer the alias */
577-
final val AliasPreferred = TypeParam | BaseTypeArg
578-
579570
/** A covariant type parameter instance */
580571
final val LocalCovariant = allOf(Local, Covariant)
581572

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,21 +243,6 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
243243
}
244244
}
245245

246-
private def enterArgBinding(formal: Symbol, info: Type, cls: ClassSymbol, decls: Scope) = {
247-
val lazyInfo = new LazyType { // needed so we do not force `formal`.
248-
def complete(denot: SymDenotation)(implicit ctx: Context): Unit = {
249-
denot setFlag formal.flags & RetainedTypeArgFlags
250-
denot.info = info
251-
}
252-
}
253-
val sym = ctx.newSymbol(
254-
cls, formal.name,
255-
formal.flagsUNSAFE & RetainedTypeArgFlags | BaseTypeArg | Override,
256-
lazyInfo,
257-
coord = cls.coord)
258-
cls.enter(sym, decls)
259-
}
260-
261246
/** An argument bounds violation is a triple consisting of
262247
* - the argument tree
263248
* - a string "upper" or "lower" indicating which bound is violated

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ class TreePickler(pickler: TastyPickler) {
144144
withLength { pickleType(tycon); args.foreach(pickleType(_)) }
145145
case ConstantType(value) =>
146146
pickleConstant(value)
147-
case tpe: TypeRef if tpe.info.isAlias && tpe.symbol.isAliasPreferred =>
148-
pickleType(tpe.superType)
149147
case tpe: WithFixedSym =>
150148
val sym = tpe.symbol
151149
def pickleRef() =

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
158158
case EtaExpansion(tycon) =>
159159
return toText(tycon)
160160
case tp: TypeRef =>
161-
val hideType = !ctx.settings.debugAlias.value && (tp.symbol.isAliasPreferred)
162-
if (hideType && !ctx.phase.erasedTypes && !tp.symbol.isCompleting) {
163-
tp.info match {
164-
case TypeAlias(alias) => return toText(alias)
165-
case _ => if (tp.prefix.isInstanceOf[ThisType]) return nameString(tp.symbol)
166-
}
167-
}
168-
else if (tp.symbol.isAnonymousClass && !ctx.settings.uniqid.value)
161+
if (tp.symbol.isAnonymousClass && !ctx.settings.uniqid.value)
169162
return toText(tp.info)
170163
case ExprType(result) =>
171164
return "=> " ~ toText(result)

compiler/src/dotty/tools/dotc/transform/SymUtils.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ class SymUtils(val self: Symbol) extends AnyVal {
5555
def isAnyOverride(implicit ctx: Context) = self.is(Override) || self.is(AbsOverride)
5656
// careful: AbsOverride is a term only flag. combining with Override would catch only terms.
5757

58-
def isAliasPreferred(implicit ctx: Context) =
59-
self.is(AliasPreferred) || self.name.is(ExpandedName)
60-
6158
def isSuperAccessor(implicit ctx: Context) = self.name.is(SuperAccessorName)
6259

6360
/** A type or term parameter or a term parameter accessor */

compiler/src/dotty/tools/dotc/transform/TreeChecker.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,6 @@ object TreeChecker {
487487
assert(definedBinders.get(tp.binder) != null, s"orphan param: ${tp.show}, hash of binder = ${System.identityHashCode(tp.binder)}, tree = ${tree.show}, type = $tp0")
488488
case tp: TypeVar =>
489489
apply(tp.underlying)
490-
case tp: TypeRef if tp.info.isAlias && tp.symbol.isAliasPreferred =>
491-
apply(tp.superType)
492490
case _ =>
493491
mapOver(tp)
494492
}

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ object RefChecks {
253253
def compatibleTypes(memberTp: Type, otherTp: Type): Boolean =
254254
try
255255
if (member.isType) // intersection of bounds to refined types must be nonempty
256-
member.is(BaseTypeArg) || // @!!!
257256
memberTp.bounds.hi.hasSameKindAs(otherTp.bounds.hi) &&
258257
((memberTp frozen_<:< otherTp) ||
259258
!member.owner.derivesFrom(other.owner) && {

compiler/src/dotty/tools/dotc/typer/VarianceChecker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class VarianceChecker()(implicit ctx: Context) {
6262
/** Check variance of abstract type `tvar` when referred from `base`. */
6363
private def checkVarianceOfSymbol(tvar: Symbol): Option[VarianceError] = {
6464
val relative = relativeVariance(tvar, base)
65-
if (relative == Bivariant || tvar.is(BaseTypeArg)) None
65+
if (relative == Bivariant) None
6666
else {
6767
val required = compose(relative, this.variance)
6868
def tvar_s = s"$tvar (${varianceString(tvar.flags)} ${tvar.showLocated})"

compiler/test/dotty/tools/dotc/ast/DesugarTests.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ class DesugarTests extends DottyTest {
1515
assert(
1616
// remaining symbols must be either synthetic:
1717
sym.is(Synthetic) ||
18-
// or be a type argument from product:
19-
(sym.isType && sym.is(BaseTypeArg)) ||
2018
// or be a constructor:
2119
sym.name == nme.CONSTRUCTOR,
2220
s"found: $sym (${sym.flags})"

0 commit comments

Comments
 (0)