summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-03-06 00:12:17 +0000
committerMartin Odersky <odersky@gmail.com>2007-03-06 00:12:17 +0000
commit9c97b8998bb3a1add3b5f7b9a78de553c9bbbd13 (patch)
treeff8675b9f742c86e567ba6e5e8a08fead1604ad0 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent69a8cebb64fddaffe9059126cca0b35718d28bf8 (diff)
downloadscala-9c97b8998bb3a1add3b5f7b9a78de553c9bbbd13.tar.gz
scala-9c97b8998bb3a1add3b5f7b9a78de553c9bbbd13.tar.bz2
scala-9c97b8998bb3a1add3b5f7b9a78de553c9bbbd13.zip
Fixed bug901
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index cbd691ae3d..1ebb6cb451 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1256,10 +1256,14 @@ trait Typers requires Analyzer {
val codeExpected = !forCLDC && !forMSIL && (pt.symbol isNonBottomSubClass CodeClass)
def decompose(pt: Type): (Symbol, List[Type], Type) =
- if (isFunctionType(pt)
- ||
- pt.symbol == PartialFunctionClass &&
- fun.vparams.length == 1 && fun.body.isInstanceOf[Match])
+ if ((isFunctionType(pt)
+ ||
+ pt.symbol == PartialFunctionClass &&
+ fun.vparams.length == 1 && fun.body.isInstanceOf[Match])
+ && // see bug901 for a reason why next conditions are neeed
+ (pt.typeArgs.length - 1 == fun.vparams.length
+ ||
+ fun.vparams.exists(.tpt.isEmpty)))
(pt.symbol, pt.typeArgs.init, pt.typeArgs.last)
else
(FunctionClass(fun.vparams.length), fun.vparams map (x => NoType), WildcardType)