diff options
author | Martin Odersky <odersky@gmail.com> | 2016-06-29 20:10:09 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-11 13:35:03 +0200 |
commit | c1e27a035cccda42542e24f3fa6a57c6955c9923 (patch) | |
tree | 1954fc995ea7b076f0dc0b25549ebaae24ccf7d0 /src/dotty/tools/dotc/core/Types.scala | |
parent | c28dd1b84ad611bb51e096f2a973c2157569ea86 (diff) | |
download | dotty-c1e27a035cccda42542e24f3fa6a57c6955c9923.tar.gz dotty-c1e27a035cccda42542e24f3fa6a57c6955c9923.tar.bz2 dotty-c1e27a035cccda42542e24f3fa6a57c6955c9923.zip |
Change underlying of HKApply
It's now the same as upperBound, i.e. the underlying of the
type constructor re-applied to the arguments.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index ac0048e16..a9fc294cd 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -152,6 +152,10 @@ object Types { case tp: TypeRef => val sym = tp.symbol if (sym.isClass) sym.derivesFrom(cls) else tp.underlying.derivesFrom(cls) + case tp: TypeLambda => + tp.resType.derivesFrom(cls) + case tp: HKApply => + tp.tycon.derivesFrom(cls) case tp: TypeProxy => tp.underlying.derivesFrom(cls) case tp: AndType => @@ -458,6 +462,8 @@ object Types { goParam(tp) case tp: RecType => goRec(tp) + case tp: HKApply => + go(tp.upperBound) case tp: TypeProxy => go(tp.underlying) case tp: ClassInfo => @@ -512,6 +518,7 @@ object Types { if (!rt.openedTwice) rt.opened = false } } + def goRefined(tp: RefinedType) = { val pdenot = go(tp.parent) val rinfo = tp.refinedInfo @@ -540,6 +547,7 @@ object Types { safeIntersection = ctx.pendingMemberSearches.contains(name)) } } + def goThis(tp: ThisType) = { val d = go(tp.underlying) if (d.exists) @@ -2708,14 +2716,14 @@ object Types { /** A higher kinded type application `C[T_1, ..., T_n]` */ abstract case class HKApply(tycon: Type, args: List[Type]) extends CachedProxyType with ValueType { - override def underlying(implicit ctx: Context): Type = tycon + override def underlying(implicit ctx: Context): Type = upperBound def derivedAppliedType(tycon: Type, args: List[Type])(implicit ctx: Context): Type = if ((tycon eq this.tycon) && (args eq this.args)) this else tycon.appliedTo(args) override def computeHash = doHash(tycon, args) - def upperBound(implicit ctx: Context): Type = tycon.stripTypeVar match { + def upperBound(implicit ctx: Context): Type = tycon match { case tp: TypeProxy => tp.underlying.appliedTo(args) case _ => defn.AnyType } |