diff options
author | Martin Odersky <odersky@gmail.com> | 2015-01-18 18:43:59 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-01-18 18:43:59 +0100 |
commit | 179a1bbd2bb40d1c40823d1d3a1f30f8ecdf5c56 (patch) | |
tree | b3be6a55f443b2dbebf87eebecaf445a8ead4e4d /src/dotty/tools/dotc/core/ConstraintHandling.scala | |
parent | fbe4171404ac56a0fe8e6d54fa06bbd53e85bd97 (diff) | |
download | dotty-179a1bbd2bb40d1c40823d1d3a1f30f8ecdf5c56.tar.gz dotty-179a1bbd2bb40d1c40823d1d3a1f30f8ecdf5c56.tar.bz2 dotty-179a1bbd2bb40d1c40823d1d3a1f30f8ecdf5c56.zip |
Removed check from addConstraint
addConstraint contained a special case where a situation like
P { ... } <: P
was short-pathed to `return true`. But the same was not done
if the constraint was added indirectly by propagation. It's not clear
whether a special treatement of this is needed for correctness. If
it is needed, then it would be needed eberywhere. So wince we do
not want to implement it everywhere wihtout proof of necessity,
it is better to fail fast and drop the special treatment entirely.
Diffstat (limited to 'src/dotty/tools/dotc/core/ConstraintHandling.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/ConstraintHandling.scala | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/dotty/tools/dotc/core/ConstraintHandling.scala b/src/dotty/tools/dotc/core/ConstraintHandling.scala index 530bbfce4..2e771faf2 100644 --- a/src/dotty/tools/dotc/core/ConstraintHandling.scala +++ b/src/dotty/tools/dotc/core/ConstraintHandling.scala @@ -245,24 +245,12 @@ trait ConstraintHandling { case bound: ErrorType => true case _ => - if (occursAtToplevel(param, bound)) fromBelow - else if (fromBelow) addLowerBound(param, bound) + if (fromBelow) addLowerBound(param, bound) else addUpperBound(param, bound) } finally addConstraintInvocations -= 1 } } - - private def occursAtToplevel(param: Type, tp: Type): Boolean = tp match { - case tp: PolyParam => - param == tp - case bound: TypeProxy => - occursAtToplevel(param, bound.underlying) - case bound: AndOrType => - occursAtToplevel(param, bound.tp1) || occursAtToplevel(param, bound.tp2) - case _ => - false - } def checkPropagated(msg: => String)(result: Boolean): Boolean = { if (result && addConstraintInvocations == 0) { |