aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-12-26 10:13:03 +0100
committerMartin Odersky <odersky@gmail.com>2012-12-26 10:13:03 +0100
commit01c99aa384b42e3d19bb7e8e0f7b85ea9102e199 (patch)
tree91fdae34110effdd712441dff4d0c2761c247336 /src/dotty
parenta42900db82a35e612779a8d4ca685a9fa76cc92d (diff)
downloaddotty-01c99aa384b42e3d19bb7e8e0f7b85ea9102e199.tar.gz
dotty-01c99aa384b42e3d19bb7e8e0f7b85ea9102e199.tar.bz2
dotty-01c99aa384b42e3d19bb7e8e0f7b85ea9102e199.zip
Added isStatic check to asSeenFrom
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 92c0fe78a..591c7dddd 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -158,8 +158,6 @@ object Types {
def prefix: Type = ???
- def isTrivial: Boolean = ???
-
def resultType: Type = ???
def baseClasses(implicit ctx: Context): List[ClassSymbol] =
@@ -170,19 +168,17 @@ object Types {
def isCachable: Boolean = false
def asSeenFrom(pre: Type, clazz: Symbol)(implicit ctx: Context): Type =
- if (isTrivial ||
- ctx.erasedTypes && clazz != defn.ArrayClass ||
- clazz.isStaticMono) this
+ if (clazz.isStaticMono || ctx.erasedTypes && clazz != defn.ArrayClass ) this
else asSeenFrom(pre, clazz, null)
- def asSeenFrom(pre: Type, clazz: Symbol, map: AsSeenFromMap)(implicit ctx: Context): Type = {
+ def asSeenFrom(pre: Type, clazz: Symbol, theMap: AsSeenFromMap)(implicit ctx: Context): Type = {
def skipPrefixOf(pre: Type, clazz: Symbol) =
(pre eq NoType) || (pre eq NoPrefix) || clazz.isPackageClass
- def toPrefix(pre: Type, clazz: Symbol, thisclazz: ClassSymbol, tp: Type): Type =
+ def toPrefix(pre: Type, clazz: Symbol, thisclazz: ClassSymbol): Type =
if (skipPrefixOf(pre, clazz))
- tp
+ this
else if ((thisclazz isNonBottomSubClass clazz) &&
(pre.widen.typeSymbol isNonBottomSubClass thisclazz))
pre match {
@@ -190,10 +186,10 @@ object Types {
case _ => pre
}
else
- toPrefix(pre.baseType(clazz).prefix, clazz.owner, thisclazz, tp)
+ toPrefix(pre.baseType(clazz).prefix, clazz.owner, thisclazz)
- def toInstance(pre: Type, clazz: Symbol, tparam: Symbol, tp: Type): Type = {
- if (skipPrefixOf(pre, clazz)) tp
+ def toInstance(pre: Type, clazz: Symbol, tparam: Symbol): Type = {
+ if (skipPrefixOf(pre, clazz)) this
else {
val tparamOwner = tparam.owner
@@ -224,21 +220,20 @@ object Types {
else throwError
if (tparamOwner == clazz && prefixMatches) instParamFrom(basePre)
- else toInstance(basePre.prefix, clazz.owner, tparam, tp)
+ else toInstance(basePre.prefix, clazz.owner, tparam)
}
}
this match {
case tp: NamedType =>
val sym = tp.symbol
- if (tp.symbol.isTypeParameter)
- toInstance(pre, clazz, sym, this)
- else
- tp.derivedNamedType(tp.prefix.asSeenFrom(pre, clazz), tp.name)
+ if (tp.symbol.isTypeParameter) toInstance(pre, clazz, sym)
+ else if (sym.isStatic) this
+ else tp.derivedNamedType(tp.prefix.asSeenFrom(pre, clazz, theMap), tp.name)
case ThisType(thisclazz) =>
- toPrefix(pre, clazz, thisclazz, this)
+ toPrefix(pre, clazz, thisclazz)
case _ =>
- val asSeenFromMap = if (map != null) map else new AsSeenFromMap(pre, clazz)
+ val asSeenFromMap = if (theMap != null) theMap else new AsSeenFromMap(pre, clazz)
this match {
case tp: AppliedType =>
tp.derivedAppliedType(