-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Revert #5664 because the binary incompatible change leaks via erasure #5821
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
Conversation
I'll do that, will write something. |
PR #5664 added a number of optimzied implementations for certain collection operations on a specific type. For example, package test.collection.immutable
trait TraversableLike[+A, +Self] {
def filter(p: A => Boolean): Self = ???
}
class List[+A] extends TraversableLike[A, List[A]] Due to type erasure, method We cannot add an overriding implementation of class List[+A] extends TraversableLike[A, List[A]] {
override def filter(p: A => Boolean): List[A] = ???
} The new method would have return type To prevent this issue, an intermediate class was added. This class was supposed to be completely internal and never appear in user code. private[immutable] trait FilteredTraversableInternal[+A, +Repr] extends TraversableLike[A, Repr] {
override def filter(p: A => Boolean): Repr = ???
}
class List[+A] extends TraversableLike[A, List[A]] with FilteredTraversableInternal[A, List[A]] The new trait is private to package Assume we have the following user code: class C {
def m(o: Option[List[String]]): Unit = o.get.filter(_ => true)
} Compiling this with the original collections code and de-compiling public void m(Option<List<String>> o) {
((TraversableLike)o.get()).filter(...);
} Due to erasure, the method If we re-compile the same example with the |
we also need a short version of that.. :) |
FTR, I don't think there is any part of this that can be salvaged. Everything relies on injecting a private superclass and is therefore not binary compatible. |
This reverts commit 01406aa. scala/scala#5821
This reverts commit 0bcbc2f. scala/scala#5821
This reverts commit 9076d24. scala/scala#5821
This reverts commit 261d395. scala/scala#5821
This reverts commit e4f0f5a. scala/scala#5821
This reverts commit bdb9b98. scala/scala#5821
This reverts commit 5f9f633. scala/scala#5821
This reverts commit b8c5917. scala/scala#5821
This reverts #5664 because the binary incompatible change leaks via erasure. We'll need to cut 2.11.10 and declare 2.11.9 a dud.
Originally discovered and reported in detail by @xuwei-k and @sjrd at scala-js/scala-js#2847 (comment) (see also the 2.11.9 release issue)