@@ -2221,7 +2221,7 @@ object Types {
2221
2221
2222
2222
private def computeName : Name = designator match {
2223
2223
case name : Name => name
2224
- case sym : Symbol => sym.originDenotation.name
2224
+ case sym => sym.asSymbol .originDenotation.name
2225
2225
}
2226
2226
2227
2227
final override def signature (using Context ): Signature =
@@ -2272,10 +2272,12 @@ object Types {
2272
2272
else computeSymbol
2273
2273
2274
2274
private def computeSymbol (using Context ): Symbol =
2275
- val result = designator match
2276
- case sym : Symbol =>
2277
- if (sym.isValidInCurrentRun) sym else denot.symbol
2278
- case name =>
2275
+ val desig = designator
2276
+ val result =
2277
+ if desig.isSymbol then
2278
+ val sym = desig.asSymbol
2279
+ if sym.isValidInCurrentRun then sym else denot.symbol
2280
+ else
2279
2281
(if (denotationIsCurrent) lastDenotation.asInstanceOf [Denotation ] else denot).symbol
2280
2282
if checkedPeriod.code != NowhereCode then checkedPeriod = ctx.period
2281
2283
result
@@ -2295,10 +2297,11 @@ object Types {
2295
2297
* type accumulators, as well as to be safe in diagnostic printing.
2296
2298
* Normally, it's better to use `symbol`, not `currentSymbol`.
2297
2299
*/
2298
- final def currentSymbol (using Context ): Symbol = designator match {
2299
- case sym : Symbol => sym
2300
- case _ => if (denotationIsCurrent) lastDenotation.nn.symbol else NoSymbol
2301
- }
2300
+ final def currentSymbol (using Context ): Symbol =
2301
+ val desig = designator
2302
+ if desig.isSymbol then desig.asSymbol
2303
+ else if denotationIsCurrent then lastDenotation.nn.symbol
2304
+ else NoSymbol
2302
2305
2303
2306
/** Retrieves currently valid symbol without necessarily updating denotation.
2304
2307
* Assumes that symbols do not change between periods in the same run.
@@ -2340,7 +2343,8 @@ object Types {
2340
2343
val sym = lastSymbol
2341
2344
val allowPrivate = sym == null || (sym == NoSymbol ) || sym.lastKnownDenotation.flagsUNSAFE.is(Private )
2342
2345
finish(memberDenot(name, allowPrivate))
2343
- case sym : Symbol =>
2346
+ case desig =>
2347
+ val sym = desig.asSymbol
2344
2348
val symd = sym.lastKnownDenotation
2345
2349
if (symd.validFor.runId != ctx.runId && ! stillValid(symd))
2346
2350
finish(memberDenot(symd.initial.name, allowPrivate = false ))
@@ -2452,11 +2456,8 @@ object Types {
2452
2456
val lastSym = denot.symbol.asInstanceOf [Symbol ]
2453
2457
lastSymbol = lastSym
2454
2458
checkedPeriod = if (prefix.isProvisional) Nowhere else ctx.period
2455
- designator match {
2456
- case sym : Symbol if designator ne lastSym =>
2457
- designator = lastSym
2458
- case _ =>
2459
- }
2459
+ if designator.isSymbol && (designator ne lastSym) then
2460
+ designator = lastSym
2460
2461
checkDenot()
2461
2462
}
2462
2463
@@ -2675,7 +2676,7 @@ object Types {
2675
2676
val adapted = withSym(denot.symbol)
2676
2677
val result =
2677
2678
if (adapted.eq(this )
2678
- || designator.isInstanceOf [ Symbol ]
2679
+ || designator.isSymbol
2679
2680
|| ! adapted.denotationIsCurrent
2680
2681
|| adapted.info.eq(denot.info))
2681
2682
adapted
@@ -2864,12 +2865,12 @@ object Types {
2864
2865
}
2865
2866
2866
2867
final class CachedTermRef (prefix : Type , designator : Designator , hc : Int ) extends TermRef (prefix, designator) {
2867
- assert((prefix ne NoPrefix ) || designator.isInstanceOf [ Symbol ] )
2868
+ assert((prefix ne NoPrefix ) || designator.isSymbol )
2868
2869
myHash = hc
2869
2870
}
2870
2871
2871
2872
final class CachedTypeRef (prefix : Type , designator : Designator , hc : Int ) extends TypeRef (prefix, designator) {
2872
- assert((prefix ne NoPrefix ) || designator.isInstanceOf [ Symbol ] )
2873
+ assert((prefix ne NoPrefix ) || designator.isSymbol )
2873
2874
myHash = hc
2874
2875
}
2875
2876
0 commit comments