aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/ConstraintHandling.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-10-09 22:47:26 +0200
committerGuillaume Martres <smarter@ubuntu.com>2016-10-12 16:13:49 +0200
commitdf2187e51e7a38a6ca8260ab4a415a7cd5efdcfc (patch)
treee3251acde037800e843853f08d18e9e1481da292 /src/dotty/tools/dotc/core/ConstraintHandling.scala
parent6807b4454529b70d2d8a6819c51db850d06078a1 (diff)
downloaddotty-df2187e51e7a38a6ca8260ab4a415a7cd5efdcfc.tar.gz
dotty-df2187e51e7a38a6ca8260ab4a415a7cd5efdcfc.tar.bz2
dotty-df2187e51e7a38a6ca8260ab4a415a7cd5efdcfc.zip
Merge GenericType, TypeLambda and PolyType
Diffstat (limited to 'src/dotty/tools/dotc/core/ConstraintHandling.scala')
-rw-r--r--src/dotty/tools/dotc/core/ConstraintHandling.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/ConstraintHandling.scala b/src/dotty/tools/dotc/core/ConstraintHandling.scala
index 84f531385..3835d553c 100644
--- a/src/dotty/tools/dotc/core/ConstraintHandling.scala
+++ b/src/dotty/tools/dotc/core/ConstraintHandling.scala
@@ -44,10 +44,10 @@ trait ConstraintHandling {
try op finally alwaysFluid = saved
}
- /** We are currently comparing lambdas. Used as a flag for
+ /** We are currently comparing polytypes. Used as a flag for
* optimization: when `false`, no need to do an expensive `pruneLambdaParams`
*/
- protected var comparingLambdas = false
+ protected var comparedPolyTypes: Set[PolyType] = Set.empty
private def addOneBound(param: PolyParam, bound: Type, isUpper: Boolean): Boolean =
!constraint.contains(param) || {
@@ -316,12 +316,12 @@ trait ConstraintHandling {
* missing.
*/
def pruneLambdaParams(tp: Type) =
- if (comparingLambdas && param.binder.isInstanceOf[PolyType]) {
+ if (comparedPolyTypes.nonEmpty) {
val approx = new ApproximatingTypeMap {
def apply(t: Type): Type = t match {
- case t @ PolyParam(tl: TypeLambda, n) =>
+ case t @ PolyParam(pt: PolyType, n) if comparedPolyTypes contains pt =>
val effectiveVariance = if (fromBelow) -variance else variance
- val bounds = tl.paramBounds(n)
+ val bounds = pt.paramBounds(n)
if (effectiveVariance > 0) bounds.lo
else if (effectiveVariance < 0) bounds.hi
else NoType