aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-08-25 16:52:55 +0200
committerMartin Odersky <odersky@gmail.com>2016-09-19 11:07:43 +0200
commit75358be7265a067e603bd95d422ca8edc0bdaeb7 (patch)
tree0fbfb23a8e38678f14414cf02536d5e4cbd0e077 /src/dotty/tools/dotc/core/SymDenotations.scala
parent07ea487704abe8969efcbb6672ce63a1748bbd73 (diff)
downloaddotty-75358be7265a067e603bd95d422ca8edc0bdaeb7.tar.gz
dotty-75358be7265a067e603bd95d422ca8edc0bdaeb7.tar.bz2
dotty-75358be7265a067e603bd95d422ca8edc0bdaeb7.zip
Fix select static
Need to do time travel to find out whether members were created as static symbols. After LambdaLift and Flatten most symbols are static anyway.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 47ec541ab..be2e3d8fe 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -46,7 +46,7 @@ trait SymDenotations { this: Context =>
val initial = denot.initial
val firstPhaseId = initial.validFor.firstPhaseId.max(ctx.typerPhase.id)
if ((initial ne denot) || ctx.phaseId != firstPhaseId)
- ctx.withPhase(firstPhaseId).stillValidInOwner(initial.asSymDenotation)
+ ctx.withPhase(firstPhaseId).stillValidInOwner(initial)
else
stillValidInOwner(denot)
}
@@ -77,7 +77,7 @@ trait SymDenotations { this: Context =>
implicit val ctx: Context = this
val initial = denot.initial
if ((initial ne denot) || ctx.phaseId != initial.validFor.firstPhaseId) {
- ctx.withPhase(initial.validFor.firstPhaseId).traceInvalid(initial.asSymDenotation)
+ ctx.withPhase(initial.validFor.firstPhaseId).traceInvalid(initial)
} else try {
val owner = denot.owner.denot
if (!traceInvalid(owner)) explainSym("owner is invalid")
@@ -346,14 +346,14 @@ object SymDenotations {
else {
def legalize(name: Name): Name = // JVM method names may not contain `<' or `>' characters
if (is(Method)) name.replace('<', '(').replace('>', ')') else name
- legalize(name.expandedName(initial.asSymDenotation.owner))
+ legalize(name.expandedName(initial.owner))
}
// need to use initial owner to disambiguate, as multiple private symbols with the same name
// might have been moved from different origins into the same class
/** The name with which the denoting symbol was created */
final def originalName(implicit ctx: Context) = {
- val d = initial.asSymDenotation
+ val d = initial
if (d is ExpandedName) d.name.unexpandedName else d.name // !!!DEBUG, was: effectiveName
}
@@ -435,13 +435,13 @@ object SymDenotations {
/** Is this symbol an anonymous class? */
final def isAnonymousClass(implicit ctx: Context): Boolean =
- isClass && (initial.asSymDenotation.name startsWith tpnme.ANON_CLASS)
+ isClass && (initial.name startsWith tpnme.ANON_CLASS)
final def isAnonymousFunction(implicit ctx: Context) =
- this.symbol.is(Method) && (initial.asSymDenotation.name startsWith nme.ANON_FUN)
+ this.symbol.is(Method) && (initial.name startsWith nme.ANON_FUN)
final def isAnonymousModuleVal(implicit ctx: Context) =
- this.symbol.is(ModuleVal) && (initial.asSymDenotation.name startsWith nme.ANON_CLASS)
+ this.symbol.is(ModuleVal) && (initial.name startsWith nme.ANON_CLASS)
/** Is this a companion class method or companion object method?
* These methods are generated by Symbols#synthesizeCompanionMethod
@@ -606,7 +606,7 @@ object SymDenotations {
/** Is this symbol a class that extends `AnyVal`? */
final def isValueClass(implicit ctx: Context): Boolean = {
- val di = this.initial.asSymDenotation
+ val di = initial
di.isClass &&
di.derivesFrom(defn.AnyValClass)(ctx.withPhase(di.validFor.firstPhaseId))
// We call derivesFrom at the initial phase both because AnyVal does not exist
@@ -1164,6 +1164,8 @@ object SymDenotations {
d
}
+ override def initial: SymDenotation = super.initial.asSymDenotation
+
/** Install this denotation as the result of the given denotation transformer. */
override def installAfter(phase: DenotTransformer)(implicit ctx: Context): Unit =
super.installAfter(phase)
@@ -1226,10 +1228,13 @@ object SymDenotations {
if (myTypeParams == null)
myTypeParams =
if (ctx.erasedTypes || is(Module)) Nil // fast return for modules to avoid scanning package decls
- else if (this ne initial) initial.asSymDenotation.typeParams
- else infoOrCompleter match {
- case info: TypeParamsCompleter => info.completerTypeParams(symbol)
- case _ => typeParamsFromDecls
+ else {
+ val di = initial
+ if (this ne di) di.typeParams
+ else infoOrCompleter match {
+ case info: TypeParamsCompleter => info.completerTypeParams(symbol)
+ case _ => typeParamsFromDecls
+ }
}
myTypeParams
}