diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-03-12 17:58:34 +0100 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-03-19 17:06:51 +0100 |
commit | 910a701fcc93e0663f0a6a15ac11499beb1ca6a9 (patch) | |
tree | 77e246101fc16226237b5a22a2b904908e1d7287 /test/files/neg/t5189b.scala | |
parent | 78c15103d54e58b0ecd193b90e2d56b967967d6c (diff) | |
download | scala-910a701fcc93e0663f0a6a15ac11499beb1ca6a9.tar.gz scala-910a701fcc93e0663f0a6a15ac11499beb1ca6a9.tar.bz2 scala-910a701fcc93e0663f0a6a15ac11499beb1ca6a9.zip |
SI-5189: refined GADT soundness fix
extrapolate GADT skolems: only complicate types when needed
make sure we only deskolemize GADT skolems after typedCase
Diffstat (limited to 'test/files/neg/t5189b.scala')
-rw-r--r-- | test/files/neg/t5189b.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/neg/t5189b.scala b/test/files/neg/t5189b.scala index 1750f14084..7c1871dc97 100644 --- a/test/files/neg/t5189b.scala +++ b/test/files/neg/t5189b.scala @@ -5,8 +5,21 @@ class TestPos { def unwrap[T](x: AbsWrapperCov[T]): T = x match { case Wrapper/*[_ <: T ]*/(x) => x // _ <: T, which is a subtype of T } + + def unwrapOption[T](x: Option[T]): T = x match { + case Some(xs) => xs + } + + + case class Down[+T](x: T) + case class Up[-T](f: T => Unit) + + def f1[T](x1: Down[T])(x2: Up[T]) = ((x1, x2)) match { + case (Down(x), Up(f)) => f(x) + } } + object TestNeg extends App { class AbsWrapperCov[+A] case class Wrapper[B](x: Wrapped[B]) extends AbsWrapperCov[B] @@ -33,6 +46,11 @@ object TestNeg extends App { // val w = new Wrapped(new A) // unwrap[Any](Wrapper(w)).cell = new B // w.cell.imNotAB + + def unwrapOption[T](x: Option[T]): T = x match { + case Some(xs) => xs.foo // the error message should not refer to a skolem (testing extrapolation) + } + } // class TestPos1 { |