aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TypeComparer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-11-20 15:06:12 +0100
committerMartin Odersky <odersky@gmail.com>2013-11-20 15:06:12 +0100
commit5240de72c9cc0beb552dc1fd77510b3d7b19a8c6 (patch)
treefbd652d601f647f6788bb15a02f6d8216a70083c /src/dotty/tools/dotc/core/TypeComparer.scala
parentdb5066bbb4c281bd3b65fe6422314afee115de5e (diff)
downloaddotty-5240de72c9cc0beb552dc1fd77510b3d7b19a8c6.tar.gz
dotty-5240de72c9cc0beb552dc1fd77510b3d7b19a8c6.tar.bz2
dotty-5240de72c9cc0beb552dc1fd77510b3d7b19a8c6.zip
Splitting constraint.appky into at, bounds, contains.
Motivation: Keep usages separate, prepare for larger constraint refactoring.
Diffstat (limited to 'src/dotty/tools/dotc/core/TypeComparer.scala')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index a796d7e43..a517f4b8c 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -72,7 +72,7 @@ class TypeComparer(initctx: Context) extends DotClass {
!frozenConstraint && {
println(s"adding ${param.show} ${if (fromBelow) ">:>" else "<:<"} ${bound.show} to ${constraint.show}")
bound match {
- case bound: PolyParam if constraint(bound).exists =>
+ case bound: PolyParam if constraint contains bound =>
addConstraint1(param, bound, fromBelow) &&
addConstraint1(bound, param, !fromBelow)
case _ =>
@@ -99,7 +99,7 @@ class TypeComparer(initctx: Context) extends DotClass {
}
}
}
- val bounds = constraint(param).asInstanceOf[TypeBounds]
+ val bounds = constraint.bounds(param)
val bound = if (fromBelow) bounds.lo else bounds.hi
val inst = avoidParam(bound)
println(s"approx ${param.show}, from below = $fromBelow, bound = ${bound.show}, inst = ${inst.show}")
@@ -206,7 +206,7 @@ class TypeComparer(initctx: Context) extends DotClass {
case tp2: PolyParam =>
tp2 == tp1 || {
isSubTypeWhenFrozen(tp1, bounds(tp2).lo) || {
- constraint(tp2) match {
+ constraint at tp2 match {
case TypeBounds(lo, _) => addConstraint(tp2, tp1.widen.dealias, fromBelow = true)
case _ => secondTry(tp1, tp2)
}
@@ -245,7 +245,7 @@ class TypeComparer(initctx: Context) extends DotClass {
(tp1 == tp2) || {
isSubTypeWhenFrozen(bounds(tp1).hi, tp2) || {
assert(frozenConstraint || !(tp2 isRef defn.NothingClass)) // !!!DEBUG
- constraint(tp1) match {
+ constraint at tp1 match {
case TypeBounds(_, hi) => addConstraint(tp1, tp2.dealias, fromBelow = false)
case _ => thirdTry(tp1, tp2)
}
@@ -384,14 +384,14 @@ class TypeComparer(initctx: Context) extends DotClass {
}
/** The current bounds of type parameter `param` */
- def bounds(param: PolyParam): TypeBounds = constraint(param) match {
+ def bounds(param: PolyParam): TypeBounds = constraint at param match {
case bounds: TypeBounds => bounds
case _ => param.binder.paramBounds(param.paramNum)
}
/** Defer constraining type variables when comnpared against prototypes */
def isMatchedByProto(proto: ProtoType, tp: Type) = tp.stripTypeVar match {
- case tp: PolyParam if constraint(tp).exists => true
+ case tp: PolyParam if constraint contains tp => true
case _ => proto.isMatchedBy(tp)
}