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