aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-09-18 09:40:26 +0200
committerMartin Odersky <odersky@gmail.com>2013-09-18 09:40:26 +0200
commit283c41637ce5e50655c31e729fa4c0baf3ece185 (patch)
treeb0dfae2b98e126c9119d9cbbbd39a7627b3b1023 /src/dotty/tools/dotc/core/SymDenotations.scala
parent64a312432ca2cded23ca2d9244276231c52a52c2 (diff)
downloaddotty-283c41637ce5e50655c31e729fa4c0baf3ece185.tar.gz
dotty-283c41637ce5e50655c31e729fa4c0baf3ece185.tar.bz2
dotty-283c41637ce5e50655c31e729fa4c0baf3ece185.zip
Experimental branch that drops {Term/Type}RefWithSym types
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 0d1c9b597..dee841102 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -104,6 +104,7 @@ object SymDenotations {
protected[dotc] final def info_=(tp: Type) = {
def illegal: String = s"illegal type for module $this: $tp"
+ /*
if (this is Module) // make sure module invariants that allow moduleClass and sourceModule to work are kept.
tp match {
case tp: ClassInfo => assert(tp.selfInfo.isInstanceOf[TermRefBySym], illegal)
@@ -111,6 +112,7 @@ object SymDenotations {
case tp: ExprType => assert(tp.resultType.isInstanceOf[TypeRefBySym], illegal)
case _ =>
}
+ */
myInfo = tp
}
@@ -416,7 +418,8 @@ object SymDenotations {
* accessed via prefix `pre`?
*/
def membersNeedAsSeenFrom(pre: Type)(implicit ctx: Context) =
- !( this.isStaticOwner
+ !( this.isTerm
+ || this.isStaticOwner
|| ctx.erasedTypes && symbol != defn.ArrayClass
|| (pre eq thisType)
)
@@ -452,20 +455,20 @@ object SymDenotations {
* the completers.
*/
/** The class implementing this module, NoSymbol if not applicable. */
- final def moduleClass: Symbol =
+ final def moduleClass(implicit ctx: Context): Symbol =
if (this is ModuleVal)
myInfo match {
- case info: TypeRefBySym => info.fixedSym
- case ExprType(info: TypeRefBySym) => info.fixedSym // needed after uncurry, when module terms might be accessor defs
- case info: LazyType => info.moduleClass
- case _ => println(s"missing module class for $name: $myInfo"); NoSymbol
+ case info: TypeRef => info.symbol
+ case ExprType(info: TypeRef) => info.symbol // needed after uncurry, when module terms might be accessor defs
+ case info: LazyType => info.moduleClass
+ case _ => println(s"missing module class for $name: $myInfo"); NoSymbol
}
else NoSymbol
/** The module implemented by this module class, NoSymbol if not applicable. */
- final def sourceModule: Symbol = myInfo match {
- case ClassInfo(_, _, _, _, selfType: TermRefBySym) if this is ModuleClass =>
- selfType.fixedSym
+ final def sourceModule(implicit ctx: Context): Symbol = myInfo match {
+ case ClassInfo(_, _, _, _, selfType: TermRef) if this is ModuleClass =>
+ selfType.symbol
case info: LazyType =>
info.sourceModule
case _ =>
@@ -617,13 +620,13 @@ object SymDenotations {
/** The symbolic typeref representing the type constructor for this type.
* @throws ClassCastException is this is not a type
*/
- final def symTypeRef(implicit ctx: Context): TypeRefBySym =
+ final def symTypeRef(implicit ctx: Context): TypeRef =
TypeRef.withSym(owner.thisType, symbol.asType)
/** The symbolic termref pointing to this termsymbol
* @throws ClassCastException is this is not a term
*/
- def symTermRef(implicit ctx: Context): TermRefBySym =
+ def symTermRef(implicit ctx: Context): TermRef =
TermRef.withSym(owner.thisType, symbol.asTerm)
def symRef(implicit ctx: Context): NamedType =