@@ -1504,7 +1504,7 @@ object Types {
1504
1504
1505
1505
def designatorName : Name = designator.asInstanceOf [Name ] // ### todo: remove
1506
1506
1507
- private [dotc] def init (givenName : Name )(implicit ctx : Context ): this .type = {
1507
+ private [dotc] def init ()(implicit ctx : Context ): this .type = {
1508
1508
(designator : Designator ) match { // dotty shortcoming: need the upcast
1509
1509
case DerivedName (underlying, info : SignedName .SignedInfo ) =>
1510
1510
myName = underlying.asInstanceOf [ThisName ]
@@ -1513,13 +1513,15 @@ object Types {
1513
1513
case designator : Name =>
1514
1514
myName = designator.asInstanceOf [ThisName ]
1515
1515
case designator : Symbol =>
1516
- myName = givenName.asInstanceOf [ThisName ]
1517
1516
uncheckedSetSym(designator)
1518
1517
}
1519
1518
this
1520
1519
}
1521
1520
1522
- final def name : ThisName = myName
1521
+ final def name (implicit ctx : Context ): ThisName = {
1522
+ if (myName == null ) myName = designator.asInstanceOf [Symbol ].name.asInstanceOf [ThisName ]
1523
+ myName
1524
+ }
1523
1525
1524
1526
final override def signature (implicit ctx : Context ): Signature =
1525
1527
if (mySig != null ) mySig
@@ -1745,13 +1747,10 @@ object Types {
1745
1747
1746
1748
def reloadDenot ()(implicit ctx : Context ) = setDenot(loadDenot)
1747
1749
1748
- protected def asMemberOf (prefix : Type , allowPrivate : Boolean )(implicit ctx : Context ): Denotation = {
1749
- def recur (name : Name ): Denotation =
1750
- if (name.is(ShadowedName )) prefix.nonPrivateMember(name.exclude(ShadowedName ))
1751
- else if (! allowPrivate) prefix.nonPrivateMember(name)
1752
- else prefix.member(name)
1753
- recur(name)
1754
- }
1750
+ protected def asMemberOf (prefix : Type , allowPrivate : Boolean )(implicit ctx : Context ): Denotation =
1751
+ if (name.is(ShadowedName )) prefix.nonPrivateMember(name.exclude(ShadowedName ))
1752
+ else if (! allowPrivate) prefix.nonPrivateMember(name)
1753
+ else prefix.member(name)
1755
1754
1756
1755
/** (1) Reduce a type-ref `W # X` or `W { ... } # U`, where `W` is a wildcard type
1757
1756
* to an (unbounded) wildcard type.
@@ -2006,9 +2005,6 @@ object Types {
2006
2005
2007
2006
trait WithFixedSym extends NamedType {
2008
2007
def fixedSym : Symbol = designator.asInstanceOf [Symbol ]
2009
- assert(fixedSym ne null )
2010
- assert(fixedSym ne NoSymbol )
2011
- uncheckedSetSym(fixedSym)
2012
2008
2013
2009
override def withDenot (denot : Denotation )(implicit ctx : Context ): ThisType = {
2014
2010
assert(denot.symbol eq fixedSym)
@@ -2027,13 +2023,6 @@ object Types {
2027
2023
case _ => false
2028
2024
}
2029
2025
override def computeHash = unsupported(" computeHash" )
2030
-
2031
- def checkInst (n : Name , sym : Symbol )(implicit ctx : Context ): this .type = {
2032
- // assert(name == n, i"bad name: ${name.debugString}, expected: ${n.debugString}, ${System.identityHashCode(name)}, ${System.identityHashCode(n)}")
2033
- // assert(fixedSym eq sym)
2034
- // assert(symbol eq sym)
2035
- this
2036
- }
2037
2026
}
2038
2027
2039
2028
final class CachedTermRef (prefix : Type , designator : TermDesignator , hc : Int ) extends TermRef (prefix, designator) {
@@ -2049,10 +2038,10 @@ object Types {
2049
2038
}
2050
2039
2051
2040
// Those classes are non final as Linker extends them.
2052
- class TermRefWithFixedSym (prefix : Type , d : Name , designator : TermSymbol , hc : Int ) extends TermRef (prefix, designator) with WithFixedSym {
2041
+ class TermRefWithFixedSym (prefix : Type , designator : TermSymbol , hc : Int ) extends TermRef (prefix, designator) with WithFixedSym {
2053
2042
myHash = hc
2054
2043
}
2055
- class TypeRefWithFixedSym (prefix : Type , d : Name , designator : TypeSymbol , hc : Int ) extends TypeRef (prefix, designator) with WithFixedSym {
2044
+ class TypeRefWithFixedSym (prefix : Type , designator : TypeSymbol , hc : Int ) extends TypeRef (prefix, designator) with WithFixedSym {
2056
2045
myHash = hc
2057
2046
}
2058
2047
@@ -2110,7 +2099,7 @@ object Types {
2110
2099
* with given prefix, name, and signature
2111
2100
*/
2112
2101
def withFixedSym (prefix : Type , name : TermName , sym : TermSymbol )(implicit ctx : Context ): TermRef =
2113
- ctx.uniqueWithFixedSyms.enterIfNew(prefix, name, sym).asInstanceOf [TermRefWithFixedSym ].checkInst(name, sym)
2102
+ ctx.uniqueWithFixedSyms.enterIfNew(prefix, name, sym).asInstanceOf [TermRef ]
2114
2103
2115
2104
/** Create a term ref referring to given symbol with given name, taking the signature
2116
2105
* from the symbol if it is completed, or creating a term ref without
@@ -2164,7 +2153,7 @@ object Types {
2164
2153
* with given prefix, name, and symbol.
2165
2154
*/
2166
2155
def withFixedSym (prefix : Type , name : TypeName , sym : TypeSymbol )(implicit ctx : Context ): TypeRef =
2167
- ctx.uniqueWithFixedSyms.enterIfNew(prefix, name, sym).asInstanceOf [TypeRefWithFixedSym ].checkInst(name, sym)
2156
+ ctx.uniqueWithFixedSyms.enterIfNew(prefix, name, sym).asInstanceOf [TypeRef ]
2168
2157
2169
2158
/** Create a type ref referring to given symbol with given name.
2170
2159
* This is very similar to TypeRef(Type, Symbol),
@@ -4438,7 +4427,7 @@ object Types {
4438
4427
val watchList = List [String ](
4439
4428
) map (_.toTypeName)
4440
4429
4441
- def isWatched (tp : Type ) = tp match {
4430
+ def isWatched (tp : Type )( implicit ctx : Context ) = tp match {
4442
4431
case ref : TypeRef => watchList contains ref.name
4443
4432
case _ => false
4444
4433
}
0 commit comments