Skip to content

Commit a3c69a5

Browse files
committed
Get rid of FixedSymUniques
1 parent 6bca2da commit a3c69a5

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

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

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,12 +1923,13 @@ object Types {
19231923
override def equals(that: Any) = that match {
19241924
case that: NamedType =>
19251925
this.designator == that.designator &&
1926-
this.prefix == that.prefix &&
1927-
!that.isInstanceOf[WithFixedSym]
1926+
this.prefix == that.prefix
19281927
case _ =>
19291928
false
19301929
}
19311930

1931+
override def computeHash = unsupported("computeHash")
1932+
19321933
/* A version of toString which also prints aliases. Can be used for debugging
19331934
override def toString =
19341935
if (isTerm) s"TermRef($prefix, $name)"
@@ -2017,24 +2018,16 @@ object Types {
20172018

20182019
override def newLikeThis(prefix: Type)(implicit ctx: Context): NamedType =
20192020
NamedType.withFixedSym(prefix, fixedSym)
2020-
2021-
override def equals(that: Any) = that match {
2022-
case that: WithFixedSym => this.prefix == that.prefix && (this.fixedSym eq that.fixedSym)
2023-
case _ => false
2024-
}
2025-
override def computeHash = unsupported("computeHash")
20262021
}
20272022

20282023
final class CachedTermRef(prefix: Type, designator: TermDesignator, hc: Int) extends TermRef(prefix, designator) {
20292024
assert(prefix ne NoPrefix)
20302025
myHash = hc
2031-
override def computeHash = unsupported("computeHash")
20322026
}
20332027

20342028
final class CachedTypeRef(prefix: Type, designator: TypeDesignator, hc: Int) extends TypeRef(prefix, designator) {
20352029
assert(prefix ne NoPrefix)
20362030
myHash = hc
2037-
override def computeHash = unsupported("computeHash")
20382031
}
20392032

20402033
// Those classes are non final as Linker extends them.
@@ -2073,7 +2066,7 @@ object Types {
20732066
* of prefix with given name.
20742067
*/
20752068
def apply(prefix: Type, designator: TermName)(implicit ctx: Context): TermRef =
2076-
ctx.uniqueNamedTypes.enterIfNew(prefix, designator).asInstanceOf[TermRef]
2069+
ctx.uniqueNamedTypes.enterIfNew(prefix, designator, isTerm = true).asInstanceOf[TermRef]
20772070

20782071
/** Create term ref referring to given symbol, taking the signature
20792072
* from the symbol if it is completed, or creating a term ref without
@@ -2099,7 +2092,7 @@ object Types {
20992092
* with given prefix, name, and signature
21002093
*/
21012094
def withFixedSym(prefix: Type, name: TermName, sym: TermSymbol)(implicit ctx: Context): TermRef =
2102-
ctx.uniqueWithFixedSyms.enterIfNew(prefix, name, sym).asInstanceOf[TermRef]
2095+
ctx.uniqueNamedTypes.enterIfNew(prefix, sym, isTerm = true).asInstanceOf[TermRef]
21032096

21042097
/** Create a term ref referring to given symbol with given name, taking the signature
21052098
* from the symbol if it is completed, or creating a term ref without
@@ -2143,7 +2136,7 @@ object Types {
21432136
object TypeRef {
21442137
/** Create type ref with given prefix and name */
21452138
def apply(prefix: Type, name: TypeName)(implicit ctx: Context): TypeRef =
2146-
ctx.uniqueNamedTypes.enterIfNew(prefix, name).asInstanceOf[TypeRef]
2139+
ctx.uniqueNamedTypes.enterIfNew(prefix, name, isTerm = false).asInstanceOf[TypeRef]
21472140

21482141
/** Create type ref to given symbol */
21492142
def apply(prefix: Type, sym: TypeSymbol)(implicit ctx: Context): TypeRef =
@@ -2153,7 +2146,7 @@ object Types {
21532146
* with given prefix, name, and symbol.
21542147
*/
21552148
def withFixedSym(prefix: Type, name: TypeName, sym: TypeSymbol)(implicit ctx: Context): TypeRef =
2156-
ctx.uniqueWithFixedSyms.enterIfNew(prefix, name, sym).asInstanceOf[TypeRef]
2149+
ctx.uniqueNamedTypes.enterIfNew(prefix, sym, isTerm = false).asInstanceOf[TypeRef]
21572150

21582151
/** Create a type ref referring to given symbol with given name.
21592152
* This is very similar to TypeRef(Type, Symbol),

0 commit comments

Comments
 (0)