Skip to content

Commit 939d1e2

Browse files
committed
Replace invalidateDenot by reloadDenot
1 parent a1ae7f9 commit 939d1e2

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ object SymDenotations {
18461846
if (entry != null) {
18471847
if (entry.sym == sym) return false
18481848
mscope.unlink(entry)
1849-
if (sym.name == nme.PACKAGE) packageObjRunId = NoRunId // ### check if needed
1849+
if (sym.name == nme.PACKAGE) packageObjRunId = NoRunId
18501850
}
18511851
true
18521852
}

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,11 +1135,11 @@ object Types {
11351135
def select(name: Name)(implicit ctx: Context): Type =
11361136
NamedType(this, name, member(name)).reduceProjection
11371137

1138-
/** The type <this . name> , reduced if possible, with given denotation if unreduced */
1139-
def select(name: Name, denot: Denotation)(implicit ctx: Context): Type = // ### drop name
1138+
/** The type <this . name> with given denotation, reduced if possible. */
1139+
def select(name: Name, denot: Denotation)(implicit ctx: Context): Type =
11401140
NamedType(this, name, denot).reduceProjection
11411141

1142-
/** The type <this . name> with either `sym` or its signed name as designator, reduced if possible */
1142+
/** The type <this . sym>, reduced if possible */
11431143
def select(sym: Symbol)(implicit ctx: Context): Type =
11441144
NamedType(this, sym).reduceProjection
11451145

@@ -1609,9 +1609,6 @@ object Types {
16091609
else symbol
16101610
}
16111611

1612-
private def lastKnownSymbol = // ### always combine with initial?
1613-
if (lastDenotation != null) lastDenotation.symbol else NoSymbol
1614-
16151612
def info(implicit ctx: Context): Type = denot.info
16161613

16171614
/** The denotation currently denoted by this type */
@@ -1722,7 +1719,7 @@ object Types {
17221719
else d
17231720
}
17241721

1725-
private[dotc] final def setDenot(denot: Denotation)(implicit ctx: Context): Unit = { // ### make private? (also others)
1722+
private def setDenot(denot: Denotation)(implicit ctx: Context): Unit = { // ### make private? (also others)
17261723
if (ctx.isAfterTyper)
17271724
assert(!denot.isOverloaded, this)
17281725
if (Config.checkNoDoubleBindings)
@@ -1901,11 +1898,6 @@ object Types {
19011898
case _ => withPrefix(prefix)
19021899
}
19031900

1904-
private[dotc] final def invalidateDenot()(implicit ctx: Context): Unit = {
1905-
lastDenotation = null
1906-
lastSymbol = null
1907-
}
1908-
19091901
private[dotc] final def withSym(sym: Symbol)(implicit ctx: Context): ThisType =
19101902
if ((designator ne sym) && sym.exists) NamedType(prefix, sym).asInstanceOf[ThisType]
19111903
else this

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,12 +1195,12 @@ class Namer { typer: Typer =>
11951195
}
11961196

11971197
// Here we pay the price for the cavalier setting info to TypeBounds.empty above.
1198-
// We need to compensate by invalidating caches in references that might
1198+
// We need to compensate by reloading the denotation of references that might
11991199
// still contain the TypeBounds.empty. If we do not do this, stdlib factories
12001200
// fail with a bounds error in PostTyper.
12011201
def ensureUpToDate(tp: Type, outdated: Type) = tp match {
12021202
case tref: TypeRef if tref.info == outdated && sym.info != outdated =>
1203-
tref.invalidateDenot() // ### verify still needed
1203+
tref.reloadDenot()
12041204
case _ =>
12051205
}
12061206
ensureUpToDate(sym.typeRef, dummyInfo)

0 commit comments

Comments
 (0)