diff options
author | Martin Odersky <odersky@gmail.com> | 2014-03-21 18:39:35 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-03-21 18:39:35 +0100 |
commit | 9b17c6c86f3150afa7b5b395c23ec3fdf9c14200 (patch) | |
tree | 61651354673a1fbbe2800d047e3dfd8211567af9 /src | |
parent | 5f318bc925c227d2bce5cff31610803185b57f54 (diff) | |
download | dotty-9b17c6c86f3150afa7b5b395c23ec3fdf9c14200.tar.gz dotty-9b17c6c86f3150afa7b5b395c23ec3fdf9c14200.tar.bz2 dotty-9b17c6c86f3150afa7b5b395c23ec3fdf9c14200.zip |
Fix of Fix of t1236: higher-kinded
Fix of d6df293d2120f2247198cb6646a23c338f7dcbbf. It turned out the original commit
was faulty in that iterator.flatten did not typecheck. The problem is fixed in this
commit and flatten is added to the collections test.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index d66d4069c..ce1c1e869 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -649,13 +649,13 @@ class TypeComparer(initctx: Context) extends DotClass { val base = tp1.narrow tparams.map(base.memberInfo) } - val hkArgs = tp2.argInfos - hk.println(s"isSubTypeHK: args1 = $args1, hkargs = $hkArgs") - val boundsOK = (args1 corresponds hkArgs)(isSubType) + val hkBounds = tp2.argInfos.map(_.asInstanceOf[TypeBounds]) + val boundsOK = (hkBounds corresponds args1)(_ contains _) val variancesOK = argInfos1.nonEmpty || (tparams corresponds tp2.typeSymbol.name.hkVariances) { (tparam, v) => v == 0 || tparam.variance == v } + hk.println(s"isSubTypeHK: args1 = $args1, hk-bounds = $hkBounds $boundsOK $variancesOK") boundsOK && variancesOK } diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index e9c3c56b2..7cd66f5dd 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -1926,7 +1926,10 @@ object Types { if (lo eq tp) this else TypeAlias(tp, variance) - def contains(tp: Type)(implicit ctx: Context) = lo <:< tp && tp <:< hi + def contains(tp: Type)(implicit ctx: Context) = tp match { + case tp: TypeBounds => lo <:< tp.lo && tp.hi <:< hi + case _ => lo <:< tp && tp <:< hi + } def & (that: TypeBounds)(implicit ctx: Context): TypeBounds = { val v = this commonVariance that |