Skip to content

Commit

Permalink
Fix constraint handling in eitherIsSubtype
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
odersky committed Apr 21, 2016
1 parent 2460f96 commit 3c38a6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3c38a6b

Please sign in to comment.