summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2008-02-07 14:54:31 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2008-02-07 14:54:31 +0000
commit264b9c05a2e6040a0d08fd6962223bcef2b510db (patch)
tree12417658000100b73b7fc7c0304fd188733e4bf6 /src
parent481741edaa615e8d9176c9c65aebe0217ff1b23a (diff)
downloadscala-264b9c05a2e6040a0d08fd6962223bcef2b510db.tar.gz
scala-264b9c05a2e6040a0d08fd6962223bcef2b510db.tar.bz2
scala-264b9c05a2e6040a0d08fd6962223bcef2b510db.zip
fixes #320
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1969880022..8f0efd5819 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2368,12 +2368,18 @@ trait Typers { self: Analyzer =>
case OverloadedType(pre, alts) =>
inferPolyAlternatives(fun, args map (_.tpe))
val tparams = fun.symbol.typeParams //@M TODO: fun.symbol.info.typeParams ? (as in typedAppliedTypeTree)
- assert(args.length == tparams.length) //@M: in case TypeApply we can't check the kind-arities
- // of the type arguments as we don't know which alternative to choose... here we do
- val args1 = map2Conserve(args, tparams) {
- //@M! the polytype denotes the expected kind
- (arg, tparam) => typedHigherKindedType(arg, polyType(tparam.typeParams, AnyClass.tpe))
- }
+ val args1 = if(args.length == tparams.length) {
+ //@M: in case TypeApply we can't check the kind-arities of the type arguments,
+ // as we don't know which alternative to choose... here we do
+ map2Conserve(args, tparams) {
+ //@M! the polytype denotes the expected kind
+ (arg, tparam) => typedHigherKindedType(arg, polyType(tparam.typeParams, AnyClass.tpe))
+ }
+ } else // @M: there's probably something wrong when args.length != tparams.length... (triggered by bug #320)
+ // Martin, I'm using fake trees, because, if you use args or arg.map(typedType),
+ // inferPolyAlternatives loops... -- I have no idea why :-(
+ args.map(t => errorTree(tree, "wrong number of type parameters for "+treeSymTypeMsg(fun)))
+
typedTypeApply(fun, args1)
case SingleType(_, _) =>
typedTypeApply(fun setType fun.tpe.widen, args)