aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-12-09 11:35:02 +0100
committerMartin Odersky <odersky@gmail.com>2014-12-10 18:51:53 +0100
commit63505c28506445216e883309237c84448ce11a7d (patch)
tree6ff8732e409a6cff342a33afbabd82d12ad98daf /src/dotty/tools/dotc/core/Types.scala
parent8336a0ddbe78b363394c48e3407b79c72008d2b3 (diff)
downloaddotty-63505c28506445216e883309237c84448ce11a7d.tar.gz
dotty-63505c28506445216e883309237c84448ce11a7d.tar.bz2
dotty-63505c28506445216e883309237c84448ce11a7d.zip
Add equality method to TypeBounds.
Curiously, was missing before, which meant variance was ignored when hash-consing TypeBounds.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 017b7cadc..d9228a5da 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -2451,6 +2451,13 @@ object Types {
/** If this type and that type have the same variance, this variance, otherwise 0 */
final def commonVariance(that: TypeBounds): Int = (this.variance + that.variance) / 2
+ override def equals(that: Any): Boolean = that match {
+ case that: TypeBounds =>
+ (this.lo eq that.lo) && (this.hi eq that.hi) && this.variance == that.variance
+ case _ =>
+ false
+ }
+
override def toString =
if (lo eq hi) s"TypeAlias($lo)" else s"TypeBounds($lo, $hi)"