summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-10-01 07:47:45 -0700
committerPaul Phillips <paulp@improving.org>2012-10-01 07:47:45 -0700
commit1ddf34d0dcba266d4dbfa12a2b00c9699049299e (patch)
tree53dacb4001bf6375ba4bdfdc0f957842219abf99 /src
parent884b0828b3ddbcdb73416548fd0acccccd72b314 (diff)
parent6ea54efa60b54016daa339b1e13c5241a7d5feec (diff)
downloadscala-1ddf34d0dcba266d4dbfa12a2b00c9699049299e.tar.gz
scala-1ddf34d0dcba266d4dbfa12a2b00c9699049299e.tar.bz2
scala-1ddf34d0dcba266d4dbfa12a2b00c9699049299e.zip
Merge pull request #1428 from paulp/issue/6311
Issue/6311
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index 0c3dcb9342..cb5fc8df5a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -517,7 +517,7 @@ trait Infer extends Checkable {
val tvars = tparams map freshVar
if (isConservativelyCompatible(restpe.instantiateTypeParams(tparams, tvars), pt))
map2(tparams, tvars)((tparam, tvar) =>
- instantiateToBound(tvar, inferVariance(formals, restpe)(tparam)))
+ instantiateToBound(tvar, varianceInTypes(formals)(tparam)))
else
tvars map (tvar => WildcardType)
}
@@ -647,24 +647,13 @@ trait Infer extends Checkable {
"argument expression's type is not compatible with formal parameter type" + foundReqMsg(tp1, pt1))
}
}
-
val targs = solvedTypes(
- tvars, tparams, tparams map inferVariance(formals, restpe),
+ tvars, tparams, tparams map varianceInTypes(formals),
false, lubDepth(formals) max lubDepth(argtpes)
)
adjustTypeArgs(tparams, tvars, targs, restpe)
}
- /** Determine which variance to assume for the type paraneter. We first chose the variance
- * that minimizes any formal parameters. If that is still undetermined, because the type parameter
- * does not appear as a formal parameter type, then we pick the variance so that it minimizes the
- * method's result type instead.
- */
- private def inferVariance(formals: List[Type], restpe: Type)(tparam: Symbol): Int = {
- val v = varianceInTypes(formals)(tparam)
- if (v != VarianceFlags) v else varianceInType(restpe)(tparam)
- }
-
private[typechecker] def followApply(tp: Type): Type = tp match {
case NullaryMethodType(restp) =>
val restp1 = followApply(restp)