diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-20 15:59:25 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-20 15:59:25 +0100 |
commit | 0e8d0bb1fbe557665f4db9edcd51dc4c49a7ae15 (patch) | |
tree | 6c21ae8fd02d8b68b22ec08fc2b695b254f5fba5 /src/dotty/tools/dotc/core | |
parent | 608fbca82816c6b43def0b38de5f93133954e8ae (diff) | |
download | dotty-0e8d0bb1fbe557665f4db9edcd51dc4c49a7ae15.tar.gz dotty-0e8d0bb1fbe557665f4db9edcd51dc4c49a7ae15.tar.bz2 dotty-0e8d0bb1fbe557665f4db9edcd51dc4c49a7ae15.zip |
Make better use of AndOrTypes.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r-- | src/dotty/tools/dotc/core/TypeComparer.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 16 |
2 files changed, 6 insertions, 13 deletions
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) |