aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeComparer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-03 17:50:26 +0100
committerMartin Odersky <odersky@gmail.com>2014-03-03 17:50:26 +0100
commitf3dacf968bc28f5f47612f75562a1a600e511815 (patch)
tree59f93971f168360b5bbc53a1934535620b6847db /src/dotty/tools/dotc/core/TypeComparer.scala
parentf0d5662e3f8668ed33bc7442951558d861e56073 (diff)
downloaddotty-f3dacf968bc28f5f47612f75562a1a600e511815.tar.gz
dotty-f3dacf968bc28f5f47612f75562a1a600e511815.tar.bz2
dotty-f3dacf968bc28f5f47612f75562a1a600e511815.zip
Fix of #34
The root cause of #34 was that we took a type argument which was an existential type. These are returned as type bounds, which make no sense in the calling context. To avoid that problem in the future, `typeArgs` got renamed to `argInfos`, so it is clear we get an info, not necessarily a value type. There are also added method `argTypes`, `argTypesLo`, `argTypesHi`, which return a type, but either throw an exception or return a lower/upper approximation of the argument is an existential type. There's another issue that the existential type only arose when compiling the same couple fo files the seciond time. We need to chase that one down separately.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 0af6ebf97..d46a8387f 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -616,7 +616,7 @@ class TypeComparer(initctx: Context) extends DotClass {
*/
def isSubTypeHK(tp1: Type, tp2: Type): Boolean = {
val tparams = tp1.typeParams
- val hkArgs = tp2.typeArgs
+ val hkArgs = tp2.argInfos
(hkArgs.length == tparams.length) && {
val base = tp1.narrow
(tparams, hkArgs).zipped.forall { (tparam, hkArg) =>
@@ -752,7 +752,7 @@ class TypeComparer(initctx: Context) extends DotClass {
/** The least upper bound of two types
* @note We do not admit singleton types in or-types as lubs.
*/
- def lub(tp1: Type, tp2: Type): Type =
+ def lub(tp1: Type, tp2: Type): Type = /*>|>*/ ctx.traceIndented(s"lub(${tp1.show}, ${tp2.show})", typr, show = true) /*<|<*/ {
if (tp1 eq tp2) tp1
else if (!tp1.exists) tp1
else if (!tp2.exists) tp2
@@ -772,6 +772,7 @@ class TypeComparer(initctx: Context) extends DotClass {
}
}
}
+ }
/** The least upper bound of a list of types */
final def lub(tps: List[Type]): Type =