diff options
author | Martin Odersky <odersky@gmail.com> | 2016-02-05 11:03:12 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-02-05 11:03:12 +0100 |
commit | c24ece505e53570566b499b817342a4dfa4087ff (patch) | |
tree | 28b75004bd1568b8e80ca1410e58d15b52d7f092 /src/dotty/tools/dotc/core/TypeComparer.scala | |
parent | 9d8c92d1d52fcfa95d57ce88d91dbb84c8ecfbd1 (diff) | |
download | dotty-c24ece505e53570566b499b817342a4dfa4087ff.tar.gz dotty-c24ece505e53570566b499b817342a4dfa4087ff.tar.bz2 dotty-c24ece505e53570566b499b817342a4dfa4087ff.zip |
Prune constraints that could turn into cycles
Fixes #864. Review by @smarter.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala index f468a573f..eeac56519 100644 --- a/src/dotty/tools/dotc/core/TypeComparer.scala +++ b/src/dotty/tools/dotc/core/TypeComparer.scala @@ -124,7 +124,10 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { pendingSubTypes = new mutable.HashSet[(Type, Type)] ctx.log(s"!!! deep subtype recursion involving ${tp1.show} <:< ${tp2.show}, constraint = ${state.constraint.show}") ctx.log(s"!!! constraint = ${constraint.show}") - assert(!ctx.settings.YnoDeepSubtypes.value) //throw new Error("deep subtype") + //if (ctx.settings.YnoDeepSubtypes.value) { + // new Error("deep subtype").printStackTrace() + //} + assert(!ctx.settings.YnoDeepSubtypes.value) if (Config.traceDeepSubTypeRecursions && !this.isInstanceOf[ExplainingTypeComparer]) ctx.log(TypeComparer.explained(implicit ctx => ctx.typeComparer.isSubType(tp1, tp2))) } @@ -1047,7 +1050,9 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling { else hkCombine(tp1, tp2, tparams1, tparams2, op) } - /** Try to distribute `&` inside type, detect and handle conflicts */ + /** Try to distribute `&` inside type, detect and handle conflicts + * @pre !(tp1 <: tp2) && !(tp2 <:< tp1) -- these cases were handled before + */ private def distributeAnd(tp1: Type, tp2: Type): Type = tp1 match { // opportunistically merge same-named refinements // this does not change anything semantically (i.e. merging or not merging |