@@ -46,7 +46,7 @@ trait SymDenotations { this: Context =>
46
46
val initial = denot.initial
47
47
val firstPhaseId = initial.validFor.firstPhaseId.max(ctx.typerPhase.id)
48
48
if ((initial ne denot) || ctx.phaseId != firstPhaseId)
49
- ctx.withPhase(firstPhaseId).stillValidInOwner(initial.asSymDenotation )
49
+ ctx.withPhase(firstPhaseId).stillValidInOwner(initial)
50
50
else
51
51
stillValidInOwner(denot)
52
52
}
@@ -77,7 +77,7 @@ trait SymDenotations { this: Context =>
77
77
implicit val ctx : Context = this
78
78
val initial = denot.initial
79
79
if ((initial ne denot) || ctx.phaseId != initial.validFor.firstPhaseId) {
80
- ctx.withPhase(initial.validFor.firstPhaseId).traceInvalid(initial.asSymDenotation )
80
+ ctx.withPhase(initial.validFor.firstPhaseId).traceInvalid(initial)
81
81
} else try {
82
82
val owner = denot.owner.denot
83
83
if (! traceInvalid(owner)) explainSym(" owner is invalid" )
@@ -346,14 +346,14 @@ object SymDenotations {
346
346
else {
347
347
def legalize (name : Name ): Name = // JVM method names may not contain `<' or `>' characters
348
348
if (is(Method )) name.replace('<' , '(' ).replace('>' , ')' ) else name
349
- legalize(name.expandedName(initial.asSymDenotation. owner))
349
+ legalize(name.expandedName(initial.owner))
350
350
}
351
351
// need to use initial owner to disambiguate, as multiple private symbols with the same name
352
352
// might have been moved from different origins into the same class
353
353
354
354
/** The name with which the denoting symbol was created */
355
355
final def originalName (implicit ctx : Context ) = {
356
- val d = initial.asSymDenotation
356
+ val d = initial
357
357
if (d is ExpandedName ) d.name.unexpandedName else d.name // !!!DEBUG, was: effectiveName
358
358
}
359
359
@@ -435,13 +435,13 @@ object SymDenotations {
435
435
436
436
/** Is this symbol an anonymous class? */
437
437
final def isAnonymousClass (implicit ctx : Context ): Boolean =
438
- isClass && (initial.asSymDenotation. name startsWith tpnme.ANON_CLASS )
438
+ isClass && (initial.name startsWith tpnme.ANON_CLASS )
439
439
440
440
final def isAnonymousFunction (implicit ctx : Context ) =
441
- this .symbol.is(Method ) && (initial.asSymDenotation. name startsWith nme.ANON_FUN )
441
+ this .symbol.is(Method ) && (initial.name startsWith nme.ANON_FUN )
442
442
443
443
final def isAnonymousModuleVal (implicit ctx : Context ) =
444
- this .symbol.is(ModuleVal ) && (initial.asSymDenotation. name startsWith nme.ANON_CLASS )
444
+ this .symbol.is(ModuleVal ) && (initial.name startsWith nme.ANON_CLASS )
445
445
446
446
/** Is this a companion class method or companion object method?
447
447
* These methods are generated by Symbols#synthesizeCompanionMethod
@@ -606,7 +606,7 @@ object SymDenotations {
606
606
607
607
/** Is this symbol a class that extends `AnyVal`? */
608
608
final def isValueClass (implicit ctx : Context ): Boolean = {
609
- val di = this . initial.asSymDenotation
609
+ val di = initial
610
610
di.isClass &&
611
611
di.derivesFrom(defn.AnyValClass )(ctx.withPhase(di.validFor.firstPhaseId))
612
612
// We call derivesFrom at the initial phase both because AnyVal does not exist
@@ -1164,6 +1164,8 @@ object SymDenotations {
1164
1164
d
1165
1165
}
1166
1166
1167
+ override def initial : SymDenotation = super .initial.asSymDenotation
1168
+
1167
1169
/** Install this denotation as the result of the given denotation transformer. */
1168
1170
override def installAfter (phase : DenotTransformer )(implicit ctx : Context ): Unit =
1169
1171
super .installAfter(phase)
@@ -1226,10 +1228,13 @@ object SymDenotations {
1226
1228
if (myTypeParams == null )
1227
1229
myTypeParams =
1228
1230
if (ctx.erasedTypes || is(Module )) Nil // fast return for modules to avoid scanning package decls
1229
- else if (this ne initial) initial.asSymDenotation.typeParams
1230
- else infoOrCompleter match {
1231
- case info : TypeParamsCompleter => info.completerTypeParams(symbol)
1232
- case _ => typeParamsFromDecls
1231
+ else {
1232
+ val di = initial
1233
+ if (this ne di) di.typeParams
1234
+ else infoOrCompleter match {
1235
+ case info : TypeParamsCompleter => info.completerTypeParams(symbol)
1236
+ case _ => typeParamsFromDecls
1237
+ }
1233
1238
}
1234
1239
myTypeParams
1235
1240
}
0 commit comments