From 8138e24bbdccacdfee9873c5a0e21afaf78c6369 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 27 May 2015 14:29:51 +1000 Subject: SI-9331 Fix canEqual for case classes with HK type params Time for the courage of our convictions: follow the advice of my TODO comment from SI-8244 / f62e280825 and fix `classExistentialType` once and for all. This is the change in the generated `canEquals` method in the test case; we no longer get a kind conformance error. ``` --- sandbox/old.log 2015-05-27 14:31:27.000000000 +1000 +++ sandbox/new.log 2015-05-27 14:31:29.000000000 +1000 @@ -15,7 +15,7 @@ case _ => throw new IndexOutOfBoundsException(x$1.toString()) }; override def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Stuff.this); - def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[Proxy[PP]]](); + def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[_ <: [PP]Proxy[PP]]](); override def hashCode(): Int = ScalaRunTime.this._hashCode(Stuff.this); override def toString(): String = ScalaRunTime.this._toString(Stuff.this); override def equals(x$1: Any): Boolean = x$1 match { @@ -38,9 +38,3 @@ } } ``` I also heeded my own advice to pass in a prefix to this method. --- test/files/pos/t9331.scala | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 test/files/pos/t9331.scala (limited to 'test/files/pos/t9331.scala') diff --git a/test/files/pos/t9331.scala b/test/files/pos/t9331.scala new file mode 100644 index 0000000000..00a667886f --- /dev/null +++ b/test/files/pos/t9331.scala @@ -0,0 +1,6 @@ +import scala.language.higherKinds + +trait Proxy[+T] +case class Stuff[+P[PP] <: Proxy[PP]]() { + // canEqual was incorrectly synthetized and started reporting a kind error. +} -- cgit v1.2.3