aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeComparer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-14 16:07:59 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-14 16:07:59 +0200
commitf19250b1a123aa63cf8f14096bfd8e29e7e548b2 (patch)
treea676a2d5c8e3dc494c4736c9d1454294b9b10341 /src/dotty/tools/dotc/core/TypeComparer.scala
parentc6f0c00790c996bea57ea905a830dedcb4f2bb44 (diff)
downloaddotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.tar.gz
dotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.tar.bz2
dotty-f19250b1a123aa63cf8f14096bfd8e29e7e548b2.zip
Integrated parser/typer into compiler
Some initial bug fixes. Added -explaintypes diagnostics.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index a4cbdfe25..2940f949a 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -3,6 +3,7 @@ package dotc
package core
import Types._, Contexts._, Symbols._, Flags._
+import StdNames.nme
import collection.mutable
import util.SimpleMap
@@ -181,8 +182,9 @@ class TypeComparer(implicit val ctx: Context) extends DotClass {
case tp2: NamedType =>
thirdTryNamed(tp1, tp2)
case tp2: RefinedType =>
- isSubType(tp1, tp2.parent) &&
- isSubType(tp1.member(tp2.refinedName).info, tp2.refinedInfo)
+ isSubType(tp1, tp2.parent) && (
+ tp2.refinedName == nme.WILDCARD ||
+ isSubType(tp1.member(tp2.refinedName).info, tp2.refinedInfo))
case AndType(tp21, tp22) =>
isSubType(tp1, tp21) && isSubType(tp1, tp22)
case OrType(tp21, tp22) =>
@@ -357,4 +359,10 @@ class TypeComparer(implicit val ctx: Context) extends DotClass {
if (tp1 == NoType || tp2 == NoType) false
else if (tp1 eq tp2) true
else isSubType(tp1, tp2) && isSubType(tp2, tp1)
+}
+
+class ExplainingTypeComparer(implicit ctx: Context) extends TypeComparer {
+ override def isSubType(tp1: Type, tp2: Type) = {
+ ctx.traceIndented(s"${tp1.show} <:< ${tp2.show}")(super.isSubType(tp1, tp2))
+ }
} \ No newline at end of file