8000 SI-9331 Fix canEqual for case classes with HK type params by adriaanm · Pull Request #5633 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

SI-9331 Fix canEqual for case classes with HK type params #5633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2017

Conversation

adriaanm
Copy link
Contributor

Time for the courage of our convictions: follow the advice of my
TODO comment from SI-8244 / f62e280 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 <synthetic> def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Stuff.this);
-    <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[Proxy[PP]]]();
+    <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[_ <: [PP]Proxy[PP]]]();
     override <synthetic> def hashCode(): Int = ScalaRunTime.this._hashCode(Stuff.this);
     override <synthetic> def toString(): String = ScalaRunTime.this._toString(Stuff.this);
     override <synthetic> 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.

Time for the courage of our convictions: follow the advice of my
TODO comment from SI-8244 / f62e280 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 <synthetic> def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Stuff.this);
-    <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[Proxy[PP]]]();
+    <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[_ <: [PP]Proxy[PP]]]();
     override <synthetic> def hashCode(): Int = ScalaRunTime.this._hashCode(Stuff.this);
     override <synthetic> def toString(): String = ScalaRunTime.this._toString(Stuff.this);
     override <synthetic> 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0