scala/scala — pull request #1981 by retronym (2013-01-26 16:22:49+00:00)
Title: [backport] SI-3577 BoundedWildcardType handling

commit 3c91b32d699a9e29d685ac20c9805f96c9f2db2c
Author: Jason Zaugg
Date: Fri Aug 24 01:16:47 2012 +0200

Mention BoundedWildcardType in "a standard type pattern match".
(cherry picked from commit 00e46b3dbcea2b72fd3941b7ffc2efba382871e9)

commit 0664be2b69b1ce013e937bc93f4e84b891676f1f
Author: Jason Zaugg
Date: Fri Aug 24 01:05:07 2012 +0200

Make RefChecks#validateVariance aware of BoundedWildcardType.

The only test case that I know for this will be neutered
by the imminent fix for SI-6258; so I haven't been able to
test this.

But trying this manually, you can see that this patch defers the
the SI-6258 to the erasure phase.

Original:

scala.MatchError: ? (of class scala.reflect.internal.Types$BoundedWildcardType)
at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anon$3.scala$tools$nsc$typechecker$RefChecks$RefCheckTransformer$$anon$$validateVariance$1(RefChecks.scala:894)
at scala.tools.nsc.typechecker.RefChecks$RefCheckTransformer$$anon$3.validateVariance(RefChecks.scala:965)

Modified:

java.lang.ClassCastException: scala.reflect.internal.Types$TypeRef$$anon$6 cannot be cast to scala.reflect.internal.Types$TypeBounds
at scala.reflect.internal.Types$TypeMap.mapOver(Types.scala:4160)
at scala.reflect.internal.transform.Erasure$ErasureMap.apply(Erasure.scala:156)
(cherry picked from commit 2b4e7183fd24113cca5e868456668fd05c848168)

commit 6ad651c94faf463133c742feb2aee59ef782ea1f
Author: Jason Zaugg
Date: Fri Aug 24 00:54:59 2012 +0200

SI-3577 Make varianceInType aware of BoundedWildcardType.
(cherry picked from commit 21105654c40ed0c462142bcbb6c8eced77f8b07a)

Review by @adriaanm