aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.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/typer/Typer.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/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 400a1407a..96fe73e7d 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -438,7 +438,7 @@ class Typer extends Namer with Applications with Implicits {
}
def typedPair(tree: untpd.Pair, pt: Type)(implicit ctx: Context) = track("typedPair") {
- val (leftProto, rightProto) = pt.typeArgs match {
+ val (leftProto, rightProto) = pt.argTypesLo match {
case l :: r :: Nil if pt isRef defn.PairClass => (l, r)
case _ => (WildcardType, WildcardType)
}
@@ -561,7 +561,7 @@ class Typer extends Namer with Applications with Implicits {
val params = args.asInstanceOf[List[untpd.ValDef]]
val (protoFormals, protoResult): (List[Type], Type) = pt match {
case _ if defn.isFunctionType(pt) =>
- (pt.dealias.typeArgs.init, pt.dealias.typeArgs.last)
+ (pt.dealias.argInfos.init, pt.dealias.argInfos.last)
case SAMType(meth) =>
val mt @ MethodType(_, paramTypes) = meth.info
(paramTypes, mt.resultType)
@@ -750,7 +750,7 @@ class Typer extends Namer with Applications with Implicits {
val expr1 = typed(tree.expr, pt)
val handler1 = typed(tree.handler, defn.FunctionType(defn.ThrowableType :: Nil, pt))
val finalizer1 = typed(tree.finalizer, defn.UnitType)
- val handlerTypeArgs = handler1.tpe.baseTypeArgs(defn.FunctionClass(1))
+ val handlerTypeArgs = handler1.tpe.baseArgTypesHi(defn.FunctionClass(1))
val ownType = if (handlerTypeArgs.nonEmpty) expr1.tpe | handlerTypeArgs(1) else expr1.tpe
cpy.Try(tree, expr1, handler1, finalizer1) withType ownType
}