aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-07-23 17:42:55 +0200
committerMartin Odersky <odersky@gmail.com>2015-10-01 19:33:25 +0200
commitfe714ed2b6aaca41f1e6681b217022b301f3049d (patch)
tree07984582b64af2709b40e10a967da532ae6d0255 /src/dotty
parent78239daf86cf6d45fec46f259e55e1fdbd963046 (diff)
downloaddotty-fe714ed2b6aaca41f1e6681b217022b301f3049d.tar.gz
dotty-fe714ed2b6aaca41f1e6681b217022b301f3049d.tar.bz2
dotty-fe714ed2b6aaca41f1e6681b217022b301f3049d.zip
Change some occurrences of <:< to frozen_<:<
Some subtype tests should not instantiate type variables, in particular those having to do with & and |.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala4
-rw-r--r--src/dotty/tools/dotc/core/TypeApplications.scala4
-rw-r--r--src/dotty/tools/dotc/core/Types.scala17
3 files changed, 15 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala
index fff447803..b223a8086 100644
--- a/src/dotty/tools/dotc/core/Denotations.scala
+++ b/src/dotty/tools/dotc/core/Denotations.scala
@@ -339,8 +339,8 @@ object Denotations {
val info1 = denot1.info
val info2 = denot2.info
val sameSym = sym1 eq sym2
- if (sameSym && info1 <:< info2) denot2
- else if (sameSym && info2 <:< info1) denot1
+ if (sameSym && (info1 frozen_<:< info2)) denot2
+ else if (sameSym && (info2 frozen_<:< info1)) denot1
else {
val jointSym =
if (sameSym) sym1
diff --git a/src/dotty/tools/dotc/core/TypeApplications.scala b/src/dotty/tools/dotc/core/TypeApplications.scala
index 927c4fcc5..47935f79e 100644
--- a/src/dotty/tools/dotc/core/TypeApplications.scala
+++ b/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -497,7 +497,7 @@ class TypeApplications(val self: Type) extends AnyVal {
val boundss = new mutable.ListBuffer[TypeBounds]
for (sym <- boundSyms) {
val bounds = sym.info.bounds
- if (!(TypeBounds.empty <:< bounds)) {
+ if (!(TypeBounds.empty frozen_<:< bounds)) {
boundNames += sym.name
boundss += bounds
}
@@ -574,7 +574,7 @@ class TypeApplications(val self: Type) extends AnyVal {
// we have a binding T = Lambda$XYZ{...}.this.hk$i where hk$i names the current `tparam`.
val pcore = etaCore(tp.parent, otherParams)
val hkBounds = self.member(rname).info.bounds
- if (TypeBounds.empty <:< hkBounds) pcore
+ if (TypeBounds.empty frozen_<:< hkBounds) pcore
else tp.derivedRefinedType(pcore, tp.refinedName, hkBounds)
case _ =>
val pcore = etaCore(tp.parent, tparams)
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index bce57ae23..8ad694ea2 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -595,6 +595,11 @@ object Types {
ctx.typeComparer.topLevelSubType(this, that)
}
+ /** Is this type a subtype of that type? */
+ final def frozen_<:<(that: Type)(implicit ctx: Context): Boolean = track("frozen_<:<") {
+ ctx.typeComparer.isSubTypeWhenFrozen(this, that)
+ }
+
/** Is this type the same as that type?
* This is the case iff `this <:< that` and `that <:< this`.
*/
@@ -625,9 +630,9 @@ object Types {
case ExprType(_) | MethodType(Nil, _) => tp.resultType
case _ => tp
}
- this <:< that || {
+ (this frozen_<:< that) || {
val rthat = result(that)
- (rthat ne that) && result(this) <:< rthat
+ (rthat ne that) && (result(this) frozen_<:< rthat)
}
}
@@ -2652,13 +2657,13 @@ object Types {
}
def & (that: TypeBounds)(implicit ctx: Context): TypeBounds =
- if (this.lo <:< that.lo && that.hi <:< this.hi) that
- else if (that.lo <:< this.lo && this.hi <:< that.hi) this
+ if ((this.lo frozen_<:< that.lo) && (that.hi frozen_<:< this.hi)) that
+ else if ((that.lo frozen_<:< this.lo) && (this.hi frozen_<:< that.hi)) this
else TypeBounds(this.lo | that.lo, this.hi & that.hi)
def | (that: TypeBounds)(implicit ctx: Context): TypeBounds =
- if (this.lo <:< that.lo && that.hi <:< this.hi) this
- else if (that.lo <:< this.lo && this.hi <:< that.hi) that
+ if ((this.lo frozen_<:< that.lo) && (that.hi frozen_<:< this.hi)) this
+ else if ((that.lo frozen_<:< this.lo) && (this.hi frozen_<:< that.hi)) that
else TypeBounds(this.lo & that.lo, this.hi | that.hi)
override def & (that: Type)(implicit ctx: Context) = that match {