aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeOps.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-06-30 14:27:43 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:35:07 +0200
commit32c0135b59fe02a70ed0b1a693251a0028d479c8 (patch)
tree289c07464da953f9709bf69a1e9658d430575e71 /src/dotty/tools/dotc/core/TypeOps.scala
parentb6a8bc77fe3af4f6f722fdbaed8a0f7c8c6774ac (diff)
downloaddotty-32c0135b59fe02a70ed0b1a693251a0028d479c8.tar.gz
dotty-32c0135b59fe02a70ed0b1a693251a0028d479c8.tar.bz2
dotty-32c0135b59fe02a70ed0b1a693251a0028d479c8.zip
Refactorings of GenericTypes and underlying/upperbound
1. Make genericType a trait instead of a class. 2. Make TypeLambda a type proxy 3. Split underlying in TypeProxy into underlying and superType 4. Cleanups in many other places
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeOps.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeOps.scala9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/TypeOps.scala b/src/dotty/tools/dotc/core/TypeOps.scala
index 3a797cce3..80e0fc6f1 100644
--- a/src/dotty/tools/dotc/core/TypeOps.scala
+++ b/src/dotty/tools/dotc/core/TypeOps.scala
@@ -194,10 +194,7 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
case tp: RefinedType => isClassRef(tp.parent)
case _ => false
}
- def next(tp: TypeProxy) = tp.underlying match {
- case TypeBounds(_, hi) => hi
- case nx => nx
- }
+
/** If `tp1` and `tp2` are typebounds, try to make one fit into the other
* or to make them equal, by instantiating uninstantiated type variables.
*/
@@ -238,13 +235,13 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
case tp1: RecType =>
tp1.rebind(approximateOr(tp1.parent, tp2))
case tp1: TypeProxy if !isClassRef(tp1) =>
- approximateUnion(next(tp1) | tp2)
+ approximateUnion(tp1.superType | tp2)
case _ =>
tp2 match {
case tp2: RecType =>
tp2.rebind(approximateOr(tp1, tp2.parent))
case tp2: TypeProxy if !isClassRef(tp2) =>
- approximateUnion(tp1 | next(tp2))
+ approximateUnion(tp1 | tp2.superType)
case _ =>
val commonBaseClasses = tp.mapReduceOr(_.baseClasses)(intersect)
val doms = dominators(commonBaseClasses, Nil)