aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-03-05 21:59:50 +0100
committerMartin Odersky <odersky@gmail.com>2013-03-05 21:59:50 +0100
commit1e70081069055630821bb6ca6c1e307e1ab074b4 (patch)
treef02afc70f9e6412206adf649ecbc767393db7bcb /src/dotty/tools/dotc/core/Types.scala
parent3efd95c6b2f9a0347edcdc14535ff6ed6dae054c (diff)
downloaddotty-1e70081069055630821bb6ca6c1e307e1ab074b4.tar.gz
dotty-1e70081069055630821bb6ca6c1e307e1ab074b4.tar.bz2
dotty-1e70081069055630821bb6ca6c1e307e1ab074b4.zip
More polishing of types.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index e48eece8d..6d3849435 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -401,16 +401,8 @@ object Types {
* poly types.
*/
def matches(that: Type)(implicit ctx: Context): Boolean =
- ctx.typeComparer.matchesType(this, that, !ctx.phase.erasedTypes)
-
- /** Does this type match that type
- *
- */
-
- /** The info of `denot`, seen as a member of this type. */
-// final def memberInfo(denot: SymDenotation)(implicit ctx: Context): Type = {
-// denot.info.asSeenFrom(this, denot.owner)
-// }
+ ctx.typeComparer.matchesType(
+ this, that, alwaysMatchSimple = !ctx.phase.erasedTypes)
/** The info of `sym`, seen as a member of this type. */
final def memberInfo(sym: Symbol)(implicit ctx: Context): Type = {
@@ -428,7 +420,7 @@ object Types {
*/
final def widen(implicit ctx: Context): Type = this match {
case tp: SingletonType => tp.underlying.widen
- case tp: ExprType => tp.underlying.widen
+ case tp: ExprType => tp.resultType.widen
case _ => this
}
@@ -452,10 +444,14 @@ object Types {
case _ => Nil
}
+ /** This type seen as if it were the type of a member of prefix type `pre`
+ * declared in class `cls`.
+ */
final def asSeenFrom(pre: Type, cls: Symbol)(implicit ctx: Context): Type =
- if ((cls is PackageClass) ||
- ctx.erasedTypes && cls != defn.ArrayClass ||
- (pre eq cls.thisType)) this
+ if ( (cls is PackageClass)
+ || ctx.erasedTypes && cls != defn.ArrayClass
+ || (pre eq cls.thisType)
+ ) this
else ctx.asSeenFrom(this, pre, cls, null)
/** The signature of this type. This is by default NotAMethod,
@@ -574,7 +570,7 @@ object Types {
}
final def isWrong: Boolean = !exists // !!! needed?
- final def exists: Boolean = true
+ def exists: Boolean = true
final def &(that: Type)(implicit ctx: Context): Type =
ctx.glb(this, that)
@@ -1256,6 +1252,7 @@ object Types {
case object NoType extends UncachedGroundType {
def symbol = NoSymbol
def info = NoType
+ override def exists = false
}
/** Cached for efficiency because hashing is faster */