Skip to content

Commit 24ca6c0

Browse files
committed
Drop all code under !newScheme
1 parent c3be42e commit 24ca6c0

17 files changed

+201
-756
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
709709
val tp =
710710
if (sym.isType) {
711711
assert(!sym.is(TypeParam))
712-
if (config.Config.newScheme) TypeRef.withSym(tree.tpe, sym.asType)
713-
else TypeRef(tree.tpe, sym.name.asTypeName)
712+
TypeRef(tree.tpe, sym.asType)
714713
}
715714
else
716715
TermRef(tree.tpe, sym.name.asTermName, sym.denot.asSeenFrom(tree.tpe))
@@ -719,10 +718,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
719718

720719
/** A select node with the given selector name and signature and a computed type */
721720
def selectWithSig(name: Name, sig: Signature)(implicit ctx: Context): Tree =
722-
untpd.SelectWithSig(tree, name, sig)
723-
.withType(
724-
if (config.Config.newScheme) tree.tpe.select(name.asTermName, sig)
725-
else TermRef(tree.tpe, name.asTermName.withSig(sig)))
721+
untpd.SelectWithSig(tree, name, sig).withType(tree.tpe.select(name.asTermName, sig))
726722

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

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,4 @@ object Config {
179179

180180
/** When in IDE, turn StaleSymbol errors into warnings instead of crashing */
181181
final val ignoreStaleInIDE = true
182-
183-
val newScheme = true
184182
}

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: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,12 +1134,10 @@ object SymDenotations {
11341134
def thisType(implicit ctx: Context): Type = NoPrefix
11351135

11361136
override def typeRef(implicit ctx: Context): TypeRef =
1137-
if (Config.newScheme) TypeRef.withSym(owner.thisType, symbol.asType)
1138-
else TypeRef(owner.thisType, name.asTypeName, this)
1137+
TypeRef(owner.thisType, symbol)
11391138

11401139
override def termRef(implicit ctx: Context): TermRef =
1141-
if (Config.newScheme) TermRef.withSym(owner.thisType, symbol.asTerm)
1142-
else TermRef(owner.thisType, name.asTermName, this)
1140+
TermRef(owner.thisType, symbol)
11431141

11441142
/** The variance of this type parameter or type member as an Int, with
11451143
* +1 = Covariant, -1 = Contravariant, 0 = Nonvariant, or not a type parameter
@@ -1440,10 +1438,9 @@ object SymDenotations {
14401438
if (classParents.isEmpty && !emptyParentsExpected)
14411439
onBehalf.signalProvisional()
14421440
val builder = new BaseDataBuilder
1443-
for (p <- classParents) {
1444-
assert(p.typeSymbol.isClass, s"$this has $p")
1441+
for (p <- classParents)
14451442
builder.addAll(p.typeSymbol.asClass.baseClasses)
1446-
}
1443+
14471444
(classSymbol :: builder.baseClasses, builder.baseClassSet)
14481445
}
14491446

@@ -1849,8 +1846,7 @@ object SymDenotations {
18491846
if (entry != null) {
18501847
if (entry.sym == sym) return false
18511848
mscope.unlink(entry)
1852-
if (sym.owner == defn.ScalaShadowingPackageClass)
1853-
if (sym.name == nme.PACKAGE) packageObjRunId = NoRunId
1849+
if (sym.name == nme.PACKAGE) packageObjRunId = NoRunId // ### check if needed
18541850
}
18551851
true
18561852
}

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
@@ -158,9 +157,7 @@ trait Symbols { this: Context =>
158157
infoFn(module, modcls), privateWithin)
159158
val mdenot = SymDenotation(
160159
module, owner, name, modFlags | ModuleValCreationFlags,
161-
if (cdenot.isCompleted)
162-
if (config.Config.newScheme) TypeRef.withSym(owner.thisType, modcls)
163-
else TypeRef.withSymOLD(owner.thisType, modcls, modclsName)
160+
if (cdenot.isCompleted) TypeRef(owner.thisType, modcls)
164161
else new ModuleCompleter(modcls))
165162
module.denot = mdenot
166163
modcls.denot = cdenot
@@ -185,9 +182,7 @@ trait Symbols { this: Context =>
185182
newModuleSymbol(
186183
owner, name, modFlags, clsFlags,
187184
(module, modcls) => ClassInfo(
188-
owner.thisType, modcls, parents, decls,
189-
if (config.Config.newScheme) TermRef.withSym(owner.thisType, module)
190-
else TermRef.withSymOLD(owner.thisType, module, name)),
185+
owner.thisType, modcls, parents, decls, TermRef(owner.thisType, module)),
191186
privateWithin, coord, assocFile)
192187

193188
val companionMethodFlags = Flags.Synthetic | Flags.Private | Flags.Method
@@ -295,10 +290,7 @@ trait Symbols { this: Context =>
295290
for (name <- names) {
296291
val tparam = newNakedSymbol[TypeName](NoCoord)
297292
tparamBuf += tparam
298-
trefBuf += (
299-
if (config.Config.newScheme) TypeRef.withSym(owner.thisType, tparam)
300-
else TypeRef.withSymOLD(owner.thisType, tparam, name)
301-
)
293+
trefBuf += TypeRef(owner.thisType, tparam)
302294
}
303295
val tparams = tparamBuf.toList
304296
val bounds = boundsFn(trefBuf.toList)
@@ -463,16 +455,15 @@ object Symbols {
463455
// denotations pointing to the new symbol, so the validity periods check out OK.
464456
// But once a package member is overridden it is not longerr valid.
465457

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

0 commit comments

Comments
 (0)