aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-20 15:59:25 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-20 15:59:25 +0100
commit0e8d0bb1fbe557665f4db9edcd51dc4c49a7ae15 (patch)
tree6c21ae8fd02d8b68b22ec08fc2b695b254f5fba5 /src/dotty/tools
parent608fbca82816c6b43def0b38de5f93133954e8ae (diff)
downloaddotty-0e8d0bb1fbe557665f4db9edcd51dc4c49a7ae15.tar.gz
dotty-0e8d0bb1fbe557665f4db9edcd51dc4c49a7ae15.tar.bz2
dotty-0e8d0bb1fbe557665f4db9edcd51dc4c49a7ae15.zip
Make better use of AndOrTypes.
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/dotc/Main.scala1
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala3
-rw-r--r--src/dotty/tools/dotc/core/Types.scala16
3 files changed, 6 insertions, 14 deletions
diff --git a/src/dotty/tools/dotc/Main.scala b/src/dotty/tools/dotc/Main.scala
index 0222924da..a86422f52 100644
--- a/src/dotty/tools/dotc/Main.scala
+++ b/src/dotty/tools/dotc/Main.scala
@@ -10,7 +10,6 @@ import reporting.Reporter
/* To do:
* - simplify hk types
- * - make use of AndOrType
* - review isSubType
* - have a second look at normalization (leave at method types if pt is method type?)
* - Don't open package objects from class files if they are present in source
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 631363e3e..3a15a50e1 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -481,8 +481,7 @@ class TypeComparer(initctx: Context) extends DotClass {
def isCappable(tp: Type): Boolean = tp match {
case tp: PolyParam => constraint contains tp
case tp: TypeProxy => isCappable(tp.underlying)
- case tp: AndType => isCappable(tp.tp1) || isCappable(tp.tp2)
- case tp: OrType => isCappable(tp.tp1) || isCappable(tp.tp2)
+ case tp: AndOrType => isCappable(tp.tp1) || isCappable(tp.tp2)
case _ => false
}
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index b628d9c50..0325c5460 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -250,7 +250,7 @@ object Types {
val lsym = l.classSymbol
val rsym = r.classSymbol
if (lsym isSubClass rsym) lsym
- else if (rsym.isSubClass(lsym)) rsym
+ else if (rsym isSubClass lsym) rsym
else NoSymbol
case OrType(l, r) =>
val lsym = l.classSymbol
@@ -2177,11 +2177,8 @@ object Types {
val inst = tp.instanceOpt
if (inst.exists) apply(inst) else tp
- case tp: AndType =>
- tp.derivedAndType(this(tp.tp1), this(tp.tp2))
-
- case tp: OrType =>
- tp.derivedOrType(this(tp.tp1), this(tp.tp2))
+ case tp: AndOrType =>
+ tp.derivedAndOrType(this(tp.tp1), this(tp.tp2))
case tp @ AnnotatedType(annot, underlying) =>
val underlying1 = mapOver(underlying)
@@ -2330,11 +2327,8 @@ object Types {
case tp @ ClassInfo(prefix, _, _, _, _) =>
this(x, prefix)
- case AndType(l, r) =>
- this(this(x, l), r)
-
- case OrType(l, r) =>
- this(this(x, l), r)
+ case tp: AndOrType =>
+ this(this(x, tp.tp1), tp.tp2)
case AnnotatedType(annot, underlying) =>
this(this(x, annot), underlying)