diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-01-26 17:12:01 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-01-26 17:20:27 +0100 |
commit | b8da00ef01d06ff8588813c7f392679f19b0d374 (patch) | |
tree | cdd8d95b3c710a99b371b2cd1e936fc3070090a7 /test/files/pos | |
parent | 2fa859e1b3eb2ac57058feaba87d96adfbac9209 (diff) | |
download | scala-b8da00ef01d06ff8588813c7f392679f19b0d374.tar.gz scala-b8da00ef01d06ff8588813c7f392679f19b0d374.tar.bz2 scala-b8da00ef01d06ff8588813c7f392679f19b0d374.zip |
[backport] SI-3577 BoundedWildcardType handling
commit 3c91b32d699a9e29d685ac20c9805f96c9f2db2c
Author: Jason Zaugg <jzaugg@gmail.com>
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 <jzaugg@gmail.com>
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 <jzaugg@gmail.com>
Date: Fri Aug 24 00:54:59 2012 +0200
SI-3577 Make varianceInType aware of BoundedWildcardType.
(cherry picked from commit 21105654c40ed0c462142bcbb6c8eced77f8b07a)
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t3577.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/files/pos/t3577.scala b/test/files/pos/t3577.scala new file mode 100644 index 0000000000..80a280f67a --- /dev/null +++ b/test/files/pos/t3577.scala @@ -0,0 +1,29 @@ +case class Check[A](val value: A) + +case class C2(checks: Check[_]*); + +object C { + def m(x : C2): Any = (null: Any) match { + case C2(_, rest @ _*) => { + rest.map(_.value) + } + } +} + +/////////////////// + +object Container { + trait Exp[+T] + abstract class FuncExp[-S, +T] + + sealed abstract class FoundNode[T, Repr] { + def optimize[TupleT, U, That](parentNode: FlatMap[T, Repr, U, That]): Any + def optimize2[TupleT, U, That](parentNode: Any): Any + } + + class FlatMap[T, Repr, U, That] + + val Seq(fn: FoundNode[t, repr]) = Seq[FoundNode[_, _]]() + fn.optimize(null) // was: scala.MatchError: ? (of class BoundedWildcardType) @ Variances#varianceInType + fn.optimize2(null) // was: fatal error: bad type: ?(class scala.reflect.internal.Types$BoundedWildcardType) @ Pickle.putType +} |