diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2007-04-12 14:31:22 +0000 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2007-04-12 14:31:22 +0000 |
commit | b519e9c79252770e9b923b6a08744f7864ae277f (patch) | |
tree | a1e6bcf6bcec2cf488818db6e995cd5f28b8958b /src/compiler | |
parent | 5bb26aa18d774162828693bb8c4fcc246359ecf5 (diff) | |
download | scala-b519e9c79252770e9b923b6a08744f7864ae277f.tar.gz scala-b519e9c79252770e9b923b6a08744f7864ae277f.tar.bz2 scala-b519e9c79252770e9b923b6a08744f7864ae277f.zip |
fixed bug 1039
The assert in `case TypeApply' in `typed1' was too strict (only allowed
`args.length != tparams.length' for unresolved overloaded type)
apparently also necessary when the type is an error.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 13d21c9fa6..5d1b3e6310 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -598,7 +598,9 @@ trait Typers requires Analyzer { tree setType tree.tpe } else if (tree.hasSymbol && ((mode & (POLYmode | TAPPmode)) == (POLYmode | TAPPmode)) && // (7.1) @M: check kind-arity (full checks are done in checkKindBounds in Infer) tree.symbol.typeParams.length != pt.typeParams.length && - !(tree.symbol==AnyClass || tree.symbol==AllClass || pt == WildcardType )) { //@M Any and Nothing are kind-polymorphic -- WildcardType is only used when typing type arguments to an overloaded method, before the overload is resolved + !(tree.symbol==AnyClass || tree.symbol==AllClass || pt == WildcardType )) { //@M Any and Nothing are kind-polymorphic + // WildcardType is only used when typing type arguments to an overloaded method, before the overload is resolved + // (or in the case of an error type) -- see case TypeApply in typed1 errorTree(tree, tree.symbol+" takes "+reporter.countElementsAsString(tree.symbol.typeParams.length, "type parameter")+ ", expected: "+reporter.countAsString(pt.typeParams.length)) tree setType tree.tpe @@ -2334,7 +2336,7 @@ trait Typers requires Analyzer { //@M! the polytype denotes the expected kind (arg, tparam) => typedHigherKindedType(arg, makePolyType(tparam.typeParams, AnyClass.tpe)) } else { - assert(fun1.symbol.info.isInstanceOf[OverloadedType]) + assert(fun1.symbol.info.isInstanceOf[OverloadedType] || fun1.symbol.isError) // @M this branch is hit for an overloaded polymorphic type. // Until the right alternative is known, be very liberal, // typedTypeApply will find the right alternative and then do the same check as |