diff options
author | Martin Odersky <odersky@gmail.com> | 2013-01-27 09:15:14 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-01-27 09:15:14 +0100 |
commit | bdbdfe811a86b3f30542ab63fb001012589757e9 (patch) | |
tree | c8ecdaf90860c44a083bf883cea3e7e97ea760c2 | |
parent | c215dbb2870a748ad7d3f2285c561cf452848c92 (diff) | |
download | dotty-bdbdfe811a86b3f30542ab63fb001012589757e9.tar.gz dotty-bdbdfe811a86b3f30542ab63fb001012589757e9.tar.bz2 dotty-bdbdfe811a86b3f30542ab63fb001012589757e9.zip |
Reverted tresatment of NoType in AppliedType: 6ed74c3a2f38aadfb0bf
-rw-r--r-- | src/dotty/tools/dotc/core/Substituters.scala | 12 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 14 |
2 files changed, 5 insertions, 21 deletions
diff --git a/src/dotty/tools/dotc/core/Substituters.scala b/src/dotty/tools/dotc/core/Substituters.scala index c6547f77d..a78b31571 100644 --- a/src/dotty/tools/dotc/core/Substituters.scala +++ b/src/dotty/tools/dotc/core/Substituters.scala @@ -38,8 +38,7 @@ trait Substituters { this: Context => case tp: NamedType => val sym = tp.symbol if (tp.prefix eq NoPrefix) { - if (sym eq from) - return if (to.exists) to else tp + if (sym eq from) return to } if (sym.isStatic) tp else tp.derivedNamedType(subst1(tp.prefix, from, to, map), tp.name) @@ -68,10 +67,8 @@ trait Substituters { this: Context => case tp: NamedType => val sym = tp.symbol if (tp.prefix eq NoPrefix) { - if (sym eq from1) - return if (to1.exists) to1 else tp - if (sym eq from2) - return if (to2.exists) to2 else tp + if (sym eq from1) return to1 + if (sym eq from2) return to2 } if (sym.isStatic) tp else tp.derivedNamedType(subst2(tp.prefix, from1, to1, from2, to2, map), tp.name) @@ -103,8 +100,7 @@ trait Substituters { this: Context => var fs = from var ts = to while (fs.nonEmpty) { - if (fs.head eq sym) - return if (ts.head.exists) ts.head else tp + if (fs.head eq sym) return ts.head fs = fs.tail ts = ts.tail } diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index b0d5695c7..09efd28c0 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -427,15 +427,7 @@ object Types { */ final def typeParams(implicit ctx: Context): List[TypeSymbol] = this match { case tp: AppliedType => - def loop(tparams: List[TypeSymbol], targs: List[Type]): List[TypeSymbol] = tparams match { - case tparam :: tparams1 => - if (targs.isEmpty) tparams - else if (targs.head eq NoType) loop(tparams1, targs.tail) - else tparam :: loop(tparams1, targs.tail) - case _ => - Nil - } - loop(tp.tycon.typeParams, tp.targs) + tp.tycon.typeParams drop tp.targs.length case tp: TypeProxy => tp.underlying.typeParams case tp: ClassInfo => @@ -745,10 +737,6 @@ object Types { // --- AppliedType ----------------------------------------------------------------- - /** An applied type of the form tycon[..targs]. - * ..targs must match the length to tycon.typeParams. - * Missing type arguments are represented by NoType. - */ abstract case class AppliedType(tycon: Type, targs: List[Type]) extends CachedProxyType { override def underlying(implicit ctx: Context) = tycon |