aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeComparer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-04-21 15:35:43 +0200
committerMartin Odersky <odersky@gmail.com>2016-04-21 15:35:43 +0200
commit3c38a6baccc5343f55985347c0f58d184d6becee (patch)
tree9900b6221c2f2967dad2f121146c59d83cd657b6 /src/dotty/tools/dotc/core/TypeComparer.scala
parent2460f9603b0f0ed1d73dfea99edcee9ba6261d36 (diff)
downloaddotty-3c38a6baccc5343f55985347c0f58d184d6becee.tar.gz
dotty-3c38a6baccc5343f55985347c0f58d184d6becee.tar.bz2
dotty-3c38a6baccc5343f55985347c0f58d184d6becee.zip
Fix constraint handling in eitherIsSubtype
The logic in typeComparer#eitherIsSubtype was flawed. In the case of A & B <: C, if A <: C but not B <: C we need to return with the constraint of A <: C, but we returned with the initial constraint instead.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 3010e6fc7..dbee86549 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -678,7 +678,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
isSubType(tp11, tp21) && {
val leftConstraint = constraint
constraint = preConstraint
- if (isSubType(tp12, tp22) && !subsumes(leftConstraint, constraint, preConstraint))
+ if (!(isSubType(tp12, tp22) && subsumes(leftConstraint, constraint, preConstraint)))
constraint = leftConstraint
true
} || isSubType(tp12, tp22)