Skip to content

Commit 2e70f3e

Browse files
committed
Drop all code under !newScheme
1 parent ebb7e99 commit 2e70f3e

16 files changed

+199
-750
lines changed

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
710710

711711
/** A select node with the given selector name and signature and a computed type */
712712
def selectWithSig(name: Name, sig: Signature)(implicit ctx: Context): Tree =
713-
untpd.SelectWithSig(tree, name, sig)
714-
.withType(
715-
if (config.Config.newScheme) tree.tpe.select(name.asTermName, sig)
716-
else TermRef(tree.tpe, name.asTermName.withSig(sig)))
713+
untpd.SelectWithSig(tree, name, sig).withType(tree.tpe.select(name.asTermName, sig))
717714

718715
/** A select node with selector name and signature taken from `sym`.
719716
* Note: Use this method instead of select(sym) if the referenced symbol

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

Lines changed: 0 additions & 75 deletions
This file was deleted.

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Texts.Text
99
import Decorators._
1010
import Contexts.Context
1111
import StdNames.str
12-
import Designators._
1312
import util.Chars.isIdentifierStart
1413
import collection.IndexedSeqOptimized
1514
import collection.immutable
@@ -30,6 +29,11 @@ object Names {
3029

3130
implicit def eqName: Eq[Name, Name] = Eq
3231

32+
/** A common superclass of Name and Symbol. After bootstrap, this should be
33+
* just the type alias Name | Symbol
34+
*/
35+
abstract class Designator extends util.DotClass
36+
3337
/** A name if either a term name or a type name. Term names can be simple
3438
* or derived. A simple term name is essentially an interned string stored
3539
* in a name table. A derived term name adds a tag, and possibly a number
@@ -151,12 +155,6 @@ object Names {
151155
/** Does (the last part of) this name end with `str`? */
152156
def endsWith(str: String): Boolean = lastPart.endsWith(str)
153157

154-
/** Designator overrides */
155-
override def isTerm(implicit ctx: Context) = isTermName
156-
override def isType(implicit ctx: Context) = isTypeName
157-
override def asTerm(implicit ctx: Context) = asTermName
158-
override def asType(implicit ctx: Context) = asTypeName
159-
160158
override def hashCode = System.identityHashCode(this)
161159
override def equals(that: Any) = this eq that.asInstanceOf[AnyRef]
162160
}

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,12 +1130,10 @@ object SymDenotations {
11301130
def thisType(implicit ctx: Context): Type = NoPrefix
11311131

11321132
override def typeRef(implicit ctx: Context): TypeRef =
1133-
if (Config.newScheme) TypeRef.withSym(owner.thisType, symbol.asType)
1134-
else TypeRef(owner.thisType, name.asTypeName, this)
1133+
TypeRef(owner.thisType, symbol)
11351134

11361135
override def termRef(implicit ctx: Context): TermRef =
1137-
if (Config.newScheme) TermRef.withSym(owner.thisType, symbol.asTerm)
1138-
else TermRef(owner.thisType, name.asTermName, this)
1136+
TermRef(owner.thisType, symbol)
11391137

11401138
/** The variance of this type parameter or type member as an Int, with
11411139
* +1 = Covariant, -1 = Contravariant, 0 = Nonvariant, or not a type parameter
@@ -1436,10 +1434,9 @@ object SymDenotations {
14361434
if (classParents.isEmpty && !emptyParentsExpected)
14371435
onBehalf.signalProvisional()
14381436
val builder = new BaseDataBuilder
1439-
for (p <- classParents) {
1440-
assert(p.typeSymbol.isClass, s"$this has $p")
1437+
for (p <- classParents)
14411438
builder.addAll(p.typeSymbol.asClass.baseClasses)
1442-
}
1439+
14431440
(classSymbol :: builder.baseClasses, builder.baseClassSet)
14441441
}
14451442

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

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import java.lang.AssertionError
1010
import Decorators._
1111
import Symbols._
1212
import Contexts._
13-
import Designators._
1413
import SymDenotations._
1514
import printing.Texts._
1615
import printing.Printer
@@ -154,9 +153,7 @@ trait Symbols { this: Context =>
154153
infoFn(module, modcls), privateWithin)
155154
val mdenot = SymDenotation(
156155
module, owner, name, modFlags | ModuleValCreationFlags,
157-
if (cdenot.isCompleted)
158-
if (config.Config.newScheme) TypeRef.withSym(owner.thisType, modcls)
159-
else TypeRef.withSymOLD(owner.thisType, modcls, modclsName)
156+
if (cdenot.isCompleted) TypeRef(owner.thisType, modcls)
160157
else new ModuleCompleter(modcls))
161158
module.denot = mdenot
162159
modcls.denot = cdenot
@@ -181,9 +178,7 @@ trait Symbols { this: Context =>
181178
newModuleSymbol(
182179
owner, name, modFlags, clsFlags,
183180
(module, modcls) => ClassInfo(
184-
owner.thisType, modcls, parents, decls,
185-
if (config.Config.newScheme) TermRef.withSym(owner.thisType, module)
186-
else TermRef.withSymOLD(owner.thisType, module, name)),
181+
owner.thisType, modcls, parents, decls, TermRef(owner.thisType, module)),
187182
privateWithin, coord, assocFile)
188183

189184
val companionMethodFlags = Flags.Synthetic | Flags.Private | Flags.Method
@@ -291,10 +286,7 @@ trait Symbols { this: Context =>
291286
for (name <- names) {
292287
val tparam = newNakedSymbol[TypeName](NoCoord)
293288
tparamBuf += tparam
294-
trefBuf += (
295-
if (config.Config.newScheme) TypeRef.withSym(owner.thisType, tparam)
296-
else TypeRef.withSymOLD(owner.thisType, tparam, name)
297-
)
289+
trefBuf += TypeRef(owner.thisType, tparam)
298290
}
299291
val tparams = tparamBuf.toList
300292
val bounds = boundsFn(trefBuf.toList)
@@ -459,16 +451,15 @@ object Symbols {
459451
// denotations pointing to the new symbol, so the validity periods check out OK.
460452
// But once a package member is overridden it is not longerr valid.
461453

462-
/** Designator overrides */
463-
final override def isTerm(implicit ctx: Context): Boolean =
454+
final def isTerm(implicit ctx: Context): Boolean =
464455
(if (defRunId == ctx.runId) lastDenot else denot).isTerm
465-
final override def isType(implicit ctx: Context): Boolean =
456+
final def isType(implicit ctx: Context): Boolean =
466457
(if (defRunId == ctx.runId) lastDenot else denot).isType
467-
final override def asTerm(implicit ctx: Context): TermSymbol = {
458+
final def asTerm(implicit ctx: Context): TermSymbol = {
468459
assert(isTerm, s"asTerm called on not-a-Term $this" );
469460
asInstanceOf[TermSymbol]
470461
}
471-
final override def asType(implicit ctx: Context): TypeSymbol = {
462+
final def asType(implicit ctx: Context): TypeSymbol = {
472463
assert(isType, s"isType called on not-a-Type $this");
473464
asInstanceOf[TypeSymbol]
474465
}

0 commit comments

Comments
 (0)