Skip to content

Commit 657fc86

Browse files
committed
Replace invalidateDenot by reloadDenot
1 parent 20344aa commit 657fc86

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
@@ -1842,7 +1842,7 @@ object SymDenotations {
18421842
if (entry != null) {
18431843
if (entry.sym == sym) return false
18441844
mscope.unlink(entry)
1845-
if (sym.name == nme.PACKAGE) packageObjRunId = NoRunId // ### check if needed
1845+
if (sym.name == nme.PACKAGE) packageObjRunId = NoRunId
18461846
}
18471847
true
18481848
}

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

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

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

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

@@ -1600,9 +1600,6 @@ object Types {
16001600
else symbol
16011601
}
16021602

1603-
private def lastKnownSymbol = // ### always combine with initial?
1604-
if (lastDenotation != null) lastDenotation.symbol else NoSymbol
1605-
16061603
def info(implicit ctx: Context): Type = denot.info
16071604

16081605
/** The denotation currently denoted by this type */
@@ -1713,7 +1710,7 @@ object Types {
17131710
else d
17141711
}
17151712

1716-
private[dotc] final def setDenot(denot: Denotation)(implicit ctx: Context): Unit = { // ### make private? (also others)
1713+
private def setDenot(denot: Denotation)(implicit ctx: Context): Unit = { // ### make private? (also others)
17171714
if (ctx.isAfterTyper)
17181715
assert(!denot.isOverloaded, this)
17191716
if (Config.checkNoDoubleBindings)
@@ -1892,11 +1889,6 @@ object Types {
18921889
case _ => withPrefix(prefix)
18931890
}
18941891

1895-
private[dotc] final def invalidateDenot()(implicit ctx: Context): Unit = {
1896-
lastDenotation = null
1897-
lastSymbol = null
1898-
}
1899-
19001892
private[dotc] final def withSym(sym: Symbol)(implicit ctx: Context): ThisType =
19011893
if ((designator ne sym) && sym.exists) NamedType(prefix, sym).asInstanceOf[ThisType]
19021894
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)