aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-01-09 14:39:36 +0100
committerMartin Odersky <odersky@gmail.com>2015-01-09 14:39:36 +0100
commitee191f38efc9cd0ca05823499c1a8abf7883ff5e (patch)
treecfbd2ffbbf48952177fdaf98c26d873af4adb6eb
parentf11a0a533dd628684f9d255df97c2af54664b103 (diff)
downloaddotty-ee191f38efc9cd0ca05823499c1a8abf7883ff5e.tar.gz
dotty-ee191f38efc9cd0ca05823499c1a8abf7883ff5e.tar.bz2
dotty-ee191f38efc9cd0ca05823499c1a8abf7883ff5e.zip
Made fast path for refined subtype checking configurable.
A configuratin now decides whether fast path is taken or not. That way we can more easily test either way if something goes wrong.
-rw-r--r--src/dotty/tools/dotc/config/Config.scala4
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/config/Config.scala b/src/dotty/tools/dotc/config/Config.scala
index 61f8bc99e..29d5f7922 100644
--- a/src/dotty/tools/dotc/config/Config.scala
+++ b/src/dotty/tools/dotc/config/Config.scala
@@ -43,7 +43,11 @@ object Config {
/** Show subtype traces for all deep subtype recursions */
final val traceDeepSubTypeRecursions = false
+ /** When explaining subtypes and this flag is set, also show the classes of the compared types. */
final val verboseExplainSubtype = true
+
+ /** If this flag is set, take the fast path when comparing same-named type-aliases and types */
+ final val fastPathForRefinedSubtype = true
/** When set, use new signature-based matching.
* Advantantage of doing so: It's supposed to be faster
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 2b0391538..1d27f29a2 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -340,7 +340,7 @@ class TypeComparer(initctx: Context) extends DotClass with Skolemization {
s"${tp1.show} <:< ${tp2.show}" +
(if (ctx.settings.verbose.value) s" ${tp1.getClass} ${tp2.getClass}${if (frozenConstraint) " frozen" else ""}" else "")
- def isSubType(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubType ${traceInfo(tp1, tp2)}, class1 = ${tp1.getClass}, class2 = ${tp2.getClass}", subtyping) /*<|<*/ {
+ def isSubType(tp1: Type, tp2: Type): Boolean = ctx.traceIndented(s"isSubType ${traceInfo(tp1, tp2)} ${if (Config.verboseExplainSubtype) s" ${tp1.getClass}, ${tp2.getClass}" else ""}", subtyping) /*<|<*/ {
if (tp2 eq NoType) false
else if (tp1 eq tp2) true
else {
@@ -622,7 +622,7 @@ class TypeComparer(initctx: Context) extends DotClass with Skolemization {
def compareRefined: Boolean = {
val tp1w = tp1.widen
val skipped2 = skipMatching(tp1w, tp2)
- if (skipped2 eq tp2) {
+ if ((skipped2 eq tp2) || !Config.fastPathForRefinedSubtype) {
val name2 = tp2.refinedName
val normalPath =
isSubType(tp1, tp2.parent) &&