Skip to content

Commit b13f68e

Browse files
committed
Rename IdentityHashMap -> EqHashMap
1 parent fa7698e commit b13f68e

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
119119
private var lateFiles = mutable.Set[AbstractFile]()
120120

121121
/** A cache for static references to packages and classes */
122-
val staticRefs = util.IdentityHashMap[Name, Denotation](initialCapacity = 1024)
122+
val staticRefs = util.EqHashMap[Name, Denotation](initialCapacity = 1024)
123123

124124
/** Actions that need to be performed at the end of the current compilation run */
125125
private var finalizeActions = mutable.ListBuffer[() => Unit]()

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,14 +1564,14 @@ object SymDenotations {
15641564
initPrivateWithin: Symbol)
15651565
extends SymDenotation(symbol, maybeOwner, name, initFlags, initInfo, initPrivateWithin) {
15661566

1567-
import util.IdentityHashMap
1567+
import util.EqHashMap
15681568

15691569
// ----- caches -------------------------------------------------------
15701570

15711571
private var myTypeParams: List[TypeSymbol] = null
15721572
private var fullNameCache: SimpleIdentityMap[QualifiedNameKind, Name] = SimpleIdentityMap.empty
15731573

1574-
private var myMemberCache: IdentityHashMap[Name, PreDenotation] = null
1574+
private var myMemberCache: EqHashMap[Name, PreDenotation] = null
15751575
private var myMemberCachePeriod: Period = Nowhere
15761576

15771577
/** A cache from types T to baseType(T, C) */
@@ -1582,9 +1582,9 @@ object SymDenotations {
15821582
private var baseDataCache: BaseData = BaseData.None
15831583
private var memberNamesCache: MemberNames = MemberNames.None
15841584

1585-
private def memberCache(using Context): IdentityHashMap[Name, PreDenotation] = {
1585+
private def memberCache(using Context): EqHashMap[Name, PreDenotation] = {
15861586
if (myMemberCachePeriod != ctx.period) {
1587-
myMemberCache = IdentityHashMap()
1587+
myMemberCache = EqHashMap()
15881588
myMemberCachePeriod = ctx.period
15891589
}
15901590
myMemberCache

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import reporting.Message
3030
import collection.mutable
3131
import io.AbstractFile
3232
import language.implicitConversions
33-
import util.{SourceFile, NoSource, Property, SourcePosition, SrcPos, IdentityHashMap}
33+
import util.{SourceFile, NoSource, Property, SourcePosition, SrcPos, EqHashMap}
3434
import scala.collection.JavaConverters._
3535
import scala.annotation.internal.sharable
3636
import config.Printers.typr
@@ -495,7 +495,7 @@ object Symbols {
495495
/** The current class */
496496
def currentClass(using Context): ClassSymbol = ctx.owner.enclosingClass.asClass
497497

498-
type MutableSymbolMap[T] = IdentityHashMap[Symbol, T]
498+
type MutableSymbolMap[T] = EqHashMap[Symbol, T]
499499

500500
// ---- Factory methods for symbol creation ----------------------
501501
//

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ class TreePickler(pickler: TastyPickler) {
4444

4545
private val symRefs = Symbols.MutableSymbolMap[Addr](256)
4646
private val forwardSymRefs = Symbols.MutableSymbolMap[List[Addr]]()
47-
private val pickledTypes = util.IdentityHashMap[Type, Addr]()
47+
private val pickledTypes = util.EqHashMap[Type, Addr]()
4848

4949
/** A list of annotation trees for every member definition, so that later
5050
* parallel position pickling does not need to access and force symbols.
5151
*/
52-
private val annotTrees = util.IdentityHashMap[untpd.MemberDef, mutable.ListBuffer[Tree]]()
52+
private val annotTrees = util.EqHashMap[untpd.MemberDef, mutable.ListBuffer[Tree]]()
5353

5454
/** A map from member definitions to their doc comments, so that later
5555
* parallel comment pickling does not need to access symbols of trees (which
5656
* would involve accessing symbols of named types and possibly changing phases
5757
* in doing so).
5858
*/
59-
private val docStrings = util.IdentityHashMap[untpd.MemberDef, Comment]()
59+
private val docStrings = util.EqHashMap[untpd.MemberDef, Comment]()
6060

6161
def treeAnnots(tree: untpd.MemberDef): List[Tree] =
6262
val ts = annotTrees.lookup(tree)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import Trees._
2828
import transform.SymUtils._
2929
import transform.TypeUtils._
3030
import Hashable._
31-
import util.{SourceFile, NoSource, IdentityHashMap}
31+
import util.{SourceFile, NoSource, EqHashMap}
3232
import config.{Config, Feature}
3333
import Feature.migrateTo3
3434
import config.Printers.{implicits, implicitsDetailed}
@@ -289,7 +289,7 @@ object Implicits:
289289
* @param outerCtx the next outer context that makes visible further implicits
290290
*/
291291
class ContextualImplicits(val refs: List[ImplicitRef], val outerImplicits: ContextualImplicits)(initctx: Context) extends ImplicitRefs(initctx) {
292-
private val eligibleCache = IdentityHashMap[Type, List[Candidate]]()
292+
private val eligibleCache = EqHashMap[Type, List[Candidate]]()
293293

294294
/** The level increases if current context has a different owner or scope than
295295
* the context of the next-outer ImplicitRefs. This is however disabled under

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import SymDenotations.SymDenotation
2121
import Inferencing.isFullyDefined
2222
import config.Printers.inlining
2323
import ErrorReporting.errorTree
24-
import dotty.tools.dotc.util.{SimpleIdentityMap, SimpleIdentitySet, IdentityHashMap, SourceFile, SourcePosition, SrcPos}
24+
import dotty.tools.dotc.util.{SimpleIdentityMap, SimpleIdentitySet, EqHashMap, SourceFile, SourcePosition, SrcPos}
2525
import dotty.tools.dotc.parsing.Parsers.Parser
2626
import Nullables.{given _}
2727

compiler/src/dotty/tools/dotc/util/IdentityHashMap.scala renamed to compiler/src/dotty/tools/dotc/util/EqHashMap.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package dotty.tools.dotc.util
33
/** A specialized implementation of GenericHashMap with identity hash and `eq`
44
* as comparison.
55
*/
6-
class IdentityHashMap[Key, Value]
6+
class EqHashMap[Key, Value]
77
(initialCapacity: Int = 8, capacityMultiple: Int = 2)
88
extends GenericHashMap[Key, Value](initialCapacity, capacityMultiple):
99
import GenericHashMap.DenseLimit
@@ -78,4 +78,4 @@ extends GenericHashMap[Key, Value](initialCapacity, capacityMultiple):
7878
val key = oldTable(idx).asInstanceOf[Key]
7979
if key != null then addOld(key, oldTable(idx + 1).asInstanceOf[Value])
8080
idx += 2
81-
end IdentityHashMap
81+
end EqHashMap

0 commit comments

Comments
 (0)