summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-12 17:17:46 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-26 20:17:57 +0200
commit552ee9cc54e7045c066c4b915874b9d4de3b0b24 (patch)
tree10a3714231135d44d6f2e81c91b1ce92ddc5aab1 /src
parent21814b53e963d0e762efb808a664dd2c8b6e67a1 (diff)
downloadscala-552ee9cc54e7045c066c4b915874b9d4de3b0b24.tar.gz
scala-552ee9cc54e7045c066c4b915874b9d4de3b0b24.tar.bz2
scala-552ee9cc54e7045c066c4b915874b9d4de3b0b24.zip
better fix for SI-5189 pt1
the fix in 0cffdf38d9 was brain dead (only looking at the first argument of the ctor, rather than the first argument list) the reasoning was that we should not look at the MethodType of the constructor, but at the argument types directly (since going through the method type would flip variance, though the ctor arguments are conceptually in covariant positions here)
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 688dcd91ac..e99c31374e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1104,7 +1104,9 @@ trait Infer {
try {
// debuglog("TVARS "+ (tvars map (_.constr)))
// look at the argument types of the primary constructor corresponding to the pattern
- val variances = undetparams map varianceInType(ctorTp.paramTypes.headOption getOrElse ctorTp)
+ val variances =
+ if (ctorTp.paramTypes.isEmpty) undetparams map varianceInType(ctorTp)
+ else undetparams map varianceInTypes(ctorTp.paramTypes)
val targs = solvedTypes(tvars, undetparams, variances, true, lubDepth(List(resTp, pt)))
// checkBounds(tree, NoPrefix, NoSymbol, undetparams, targs, "inferred ")
// no checkBounds here. If we enable it, test bug602 fails.