I spent hours analyzing my variance-related patch, unable to see how I'd caused 15 compile errors in the build.
And... and... why don't I think of this earlier. I'd unwittingly fixed variance checking, and revealed the 15 unsound constructs which were already there.
Here's an example, adapted from the first compilation error. CCE in 2.10 and trunk.
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsJava.scala:102: error: type mismatch;
[scalacfork] found : java.util.List[?A5] where type ?A5 <: A (this is a GADT skolem)
[scalacfork] required: java.util.List[A]
[scalacfork] Note: ?A5 <: A, but Java-defined trait List is invariant in type E.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] case JListWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsJava.scala:120: error: type mismatch;
[scalacfork] found : java.util.List[?A6] where type ?A6 <: A (this is a GADT skolem)
[scalacfork] required: java.util.List[A]
[scalacfork] Note: ?A6 <: A, but Java-defined trait List is invariant in type E.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] case JListWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsJava.scala:156: error: type mismatch;
[scalacfork] found : java.util.Set[?A8] where type ?A8 <: A (this is a GADT skolem)
[scalacfork] required: java.util.Set[A]
[scalacfork] Note: ?A8 <: A, but Java-defined trait Set is invariant in type E.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] case JSetWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsJava.scala:174: error: type mismatch;
[scalacfork] found : java.util.Set[?A9] where type ?A9 <: A (this is a GADT skolem)
[scalacfork] required: java.util.Set[A]
[scalacfork] Note: ?A9 <: A, but Java-defined trait Set is invariant in type E.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] case JSetWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsJava.scala:193: error: type mismatch;
[scalacfork] found : java.util.Map[?A10,?B1] where type ?B1 <: B (this is a GADT skolem), type ?A10 <: A (this is a GADT skolem)
[scalacfork] required: java.util.Map[A,B]
[scalacfork] Note: ?A10 <: A, but Java-defined trait Map is invariant in type K.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] Note: ?B1 <: B, but Java-defined trait Map is invariant in type V.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: B`. (SLS 3.2.10)
[scalacfork] case JMapWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsJava.scala:213: error: type mismatch;
[scalacfork] found : java.util.Dictionary[?A11,?B2] where type ?B2 <: B (this is a GADT skolem), type ?A11 <: A (this is a GADT skolem)
[scalacfork] required: java.util.Dictionary[A,B]
[scalacfork] Note: ?A11 <: A, but Java-defined class Dictionary is invariant in type K.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] Note: ?B2 <: B, but Java-defined class Dictionary is invariant in type V.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: B`. (SLS 3.2.10)
[scalacfork] case JDictionaryWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsJava.scala:254: error: type mismatch;
[scalacfork] found : java.util.concurrent.ConcurrentMap[?A13,?B4] where type ?B4 <: B (this is a GADT skolem), type ?A13 <: A (this is a GADT skolem)
[scalacfork] required: java.util.concurrent.ConcurrentMap[A,B]
[scalacfork] Note: ?A13 <: A, but Java-defined trait ConcurrentMap is invariant in type K.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] Note: ?B4 <: B, but Java-defined trait ConcurrentMap is invariant in type V.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: B`. (SLS 3.2.10)
[scalacfork] case JConcurrentMapDeprecatedWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsJava.scala:274: error: type mismatch;
[scalacfork] found : java.util.concurrent.ConcurrentMap[?A14,?B5] where type ?B5 <: B (this is a GADT skolem), type ?A14 <: A (this is a GADT skolem)
[scalacfork] required: java.util.concurrent.ConcurrentMap[A,B]
[scalacfork] Note: ?A14 <: A, but Java-defined trait ConcurrentMap is invariant in type K.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] Note: ?B5 <: B, but Java-defined trait ConcurrentMap is invariant in type V.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: B`. (SLS 3.2.10)
[scalacfork] case JConcurrentMapWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsScala.scala:126: error: type mismatch;
[scalacfork] found : scala.collection.mutable.Buffer[?A5] where type ?A5 <: A (this is a GADT skolem)
[scalacfork] required: scala.collection.mutable.Buffer[A]
[scalacfork] Note: ?A5 <: A, but trait Buffer is invariant in type A.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] case MutableBufferWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsScala.scala:144: error: type mismatch;
[scalacfork] found : scala.collection.mutable.Set[?A6] where type ?A6 <: A (this is a GADT skolem)
[scalacfork] required: scala.collection.mutable.Set[A]
[scalacfork] Note: ?A6 <: A, but trait Set is invariant in type A.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] case MutableSetWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsScala.scala:164: error: type mismatch;
[scalacfork] found : scala.collection.mutable.Map[?A7,?B1] where type ?B1 <: B (this is a GADT skolem), type ?A7 <: A (this is a GADT skolem)
[scalacfork] required: scala.collection.mutable.Map[A,B]
[scalacfork] Note: ?A7 <: A, but trait Map is invariant in type A.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] Note: ?B1 <: B, but trait Map is invariant in type B.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: B`. (SLS 3.2.10)
[scalacfork] case MutableMapWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/convert/WrapAsScala.scala:217: error: type mismatch;
[scalacfork] found : scala.collection.mutable.Map[?A8,?B2] where type ?B2 <: B (this is a GADT skolem), type ?A8 <: A (this is a GADT skolem)
[scalacfork] required: scala.collection.mutable.Map[A,B]
[scalacfork] Note: ?A8 <: A, but trait Map is invariant in type A.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: A`. (SLS 3.2.10)
[scalacfork] Note: ?B2 <: B, but trait Map is invariant in type B.
[scalacfork] You may wish to investigate a wildcard type such as `_ <: B`. (SLS 3.2.10)
[scalacfork] case DictionaryWrapper(wrapped) => wrapped
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/immutable/RedBlackTree.scala:353: error: type mismatch;
[scalacfork] found : List[scala.collection.immutable.RedBlackTree.Tree[?A13,B]] where type ?A13 <: A (this is a GADT skolem)
[scalacfork] required: List[scala.collection.immutable.RedBlackTree.Tree[A,B]]
[scalacfork] if (depth == 1) zipper else findDepth(tail, depth - 1)
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/collection/immutable/RedBlackTree.scala:354: error: type mismatch;
[scalacfork] found : List[scala.collection.immutable.RedBlackTree.Tree[?A14,B]] where type ?A14 <: A (this is a GADT skolem)
[scalacfork] required: List[scala.collection.immutable.RedBlackTree.Tree[A,B]]
[scalacfork] case _ :: tail => findDepth(tail, depth)
[scalacfork] ^
[scalacfork] /scratch/trunk6/src/library/scala/io/Codec.scala:73: error: type mismatch;
[scalacfork] found : x.type (with underlying type T)
[scalacfork] required: ?T1 where type ?T1 <: T (this is a GADT skolem)
[scalacfork] case (f, cond) => if (cond) f(x) else x
[scalacfork] ^
[scalacfork] one warning found