aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-31 19:09:36 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-31 19:09:36 +0100
commit95c5a5dc4f940d63a8b4884524d82105c9dced6f (patch)
treeb0479c262b32f3574805d0b0e8943520ea888198 /src/dotty/tools/dotc/core/Types.scala
parente7d8c90b3817871a067f9ea7dd83f4efec83b5a1 (diff)
downloaddotty-95c5a5dc4f940d63a8b4884524d82105c9dced6f.tar.gz
dotty-95c5a5dc4f940d63a8b4884524d82105c9dced6f.tar.bz2
dotty-95c5a5dc4f940d63a8b4884524d82105c9dced6f.zip
Combining AndType, OrType into common Trait.
Still need to explore where we can use this (one usage will be in TypeComparers).
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 9d3cf898d..2fd6ef6b7 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1378,7 +1378,12 @@ object Types {
// --- AndType/OrType ---------------------------------------------------------------
- abstract case class AndType(tp1: Type, tp2: Type) extends CachedGroundType with ValueType {
+ trait AndOrType extends ValueType { // todo: check where we can simplify using AndOrType
+ def tp1: Type
+ def tp2: Type
+ }
+
+ abstract case class AndType(tp1: Type, tp2: Type) extends CachedGroundType with AndOrType {
assert(tp1.isInstanceOf[ValueType] && tp2.isInstanceOf[ValueType], s"$tp1 & $tp2")
def derivedAndType(tp1: Type, tp2: Type)(implicit ctx: Context) =
@@ -1395,7 +1400,7 @@ object Types {
unique(new CachedAndType(tp1, tp2))
}
- abstract case class OrType(tp1: Type, tp2: Type) extends CachedGroundType with ValueType {
+ abstract case class OrType(tp1: Type, tp2: Type) extends CachedGroundType with AndOrType {
assert(tp1.isInstanceOf[ValueType] && tp2.isInstanceOf[ValueType], s"$tp1 | $tp2")
def derivedOrType(tp1: Type, tp2: Type)(implicit ctx: Context) =