From f9394a4d472887c4563e768467170a9b1677d5c1 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 11 Sep 2009 17:08:43 +0000 Subject: Made canEqual abstract in Product and only inse... Made canEqual abstract in Product and only inserted into case classes if no concrete implementation is inherited. Restored the disabled canEquals usages in collections. --- test/files/pos/unapplyComplex.scala | 4 +++- test/files/pos/unapplyGeneric.scala | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/files/pos/unapplyComplex.scala b/test/files/pos/unapplyComplex.scala index 886e265978..70158348c3 100644 --- a/test/files/pos/unapplyComplex.scala +++ b/test/files/pos/unapplyComplex.scala @@ -1,4 +1,6 @@ -trait Complex extends Product2[Double, Double] +trait Complex extends Product2[Double, Double] { + def canEqual(other: Any) = other.isInstanceOf[Complex] +} class ComplexRect(val _1: Double, val _2: Double) extends Complex { override def toString = "ComplexRect("+_1+","+_2+")" diff --git a/test/files/pos/unapplyGeneric.scala b/test/files/pos/unapplyGeneric.scala index bf88816885..987efdd956 100644 --- a/test/files/pos/unapplyGeneric.scala +++ b/test/files/pos/unapplyGeneric.scala @@ -2,7 +2,9 @@ object Bar { def unapply[A,B](bar:Bar[A,B]) = Some(bar) } -class Bar[A,B](val _1:A, val _2:B) extends Product2[A,B] +class Bar[A,B](val _1:A, val _2:B) extends Product2[A,B] { + def canEqual(other: Any) = other.isInstanceOf[Bar[_,_]] +} object Test { new Bar(2, 'a') match { -- cgit v1.2.3