aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-01-10 18:50:48 +0700
committerMartin Odersky <odersky@gmail.com>2017-01-10 18:50:48 +0700
commit2144462b39a6d92d7c3653e9bb242d116a60caba (patch)
treebd196752348fbab68892644af3f3bdb3fd0e97b3 /compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
parentbe6464366fdbccc12623970445d8d5e8deff3f3f (diff)
downloaddotty-2144462b39a6d92d7c3653e9bb242d116a60caba.tar.gz
dotty-2144462b39a6d92d7c3653e9bb242d116a60caba.tar.bz2
dotty-2144462b39a6d92d7c3653e9bb242d116a60caba.zip
Fix #1891: Don't add redundant constraint
Before adding a constraint, make sure there is no way the two types are already in a subtype relation. Adding redundant constraints is problematic because we might introduce cycles. See i1891.scala for a test.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
index 0e155b9e1..42df53fed 100644
--- a/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
+++ b/compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala
@@ -57,6 +57,7 @@ trait ConstraintHandling {
b match {
case b: AndOrType => occursIn(b.tp1) || occursIn(b.tp2)
case b: TypeVar => occursIn(b.origin)
+ case b: TermRef => occursIn(b.underlying)
case _ => false
}
}