diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-30 15:02:25 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-11-05 08:30:54 +0100 |
commit | 3f77202a0167f30454b3cc059a675cc9230ff603 (patch) | |
tree | 19c2d4ed3284012fbf22fb66dc59da2a678d31dc /test/files/run/t6541.scala | |
parent | 10c745ae976f8e488dcde66587d0741890112c13 (diff) | |
download | scala-3f77202a0167f30454b3cc059a675cc9230ff603.tar.gz scala-3f77202a0167f30454b3cc059a675cc9230ff603.tar.bz2 scala-3f77202a0167f30454b3cc059a675cc9230ff603.zip |
SI-6541 valid wildcard existentials for case-module-unapply
Instead of letting the compiler infer the return type of case module
unapply methods, provide them explicitly.
This is enabled only under -Xsource:2.12, because the change is not
source compatible.
Diffstat (limited to 'test/files/run/t6541.scala')
-rw-r--r-- | test/files/run/t6541.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/run/t6541.scala b/test/files/run/t6541.scala new file mode 100644 index 0000000000..f127143691 --- /dev/null +++ b/test/files/run/t6541.scala @@ -0,0 +1,25 @@ +class A +class B[T](x: T) +case class C(a: A, b: B[_]) + +case class D(a: A, b: B[_]*) + +case class E(c: Class[_]) + +object Test extends App { + def f1(c: C) = c match { + case C(a, b) => () + } + + def f2(d: D) = d match { + case D(a, b1, b2) => () + } + + def f3(e: E) = e match { + case E(c) => () + } + + f1(C(new A, new B(1))) + f2(D(new A, new B(1), new B(2))) + f3(E(classOf[E])) +} |