summaryrefslogtreecommitdiff
path: root/test/files/run/t6541-option.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2014-09-30 15:02:25 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2014-11-05 08:30:54 +0100
commit3f77202a0167f30454b3cc059a675cc9230ff603 (patch)
tree19c2d4ed3284012fbf22fb66dc59da2a678d31dc /test/files/run/t6541-option.scala
parent10c745ae976f8e488dcde66587d0741890112c13 (diff)
downloadscala-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-option.scala')
-rw-r--r--test/files/run/t6541-option.scala19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/files/run/t6541-option.scala b/test/files/run/t6541-option.scala
new file mode 100644
index 0000000000..2c10c9e09d
--- /dev/null
+++ b/test/files/run/t6541-option.scala
@@ -0,0 +1,19 @@
+import scala.tools.partest.ReplTest
+
+object Test extends ReplTest {
+ def code = """
+:setting -Xsource:2.12
+case class C12(clazz: Class[_])
+val o: Option[Class[T] forSome { type T}] = C12.unapply(C12(classOf[String]))
+
+:setting -Xsource:2.11
+import scala.language.existentials
+case class C11(clazz: Class[_])
+val o: Option[Class[T]] forSome { type T } = C11.unapply(C11(classOf[String]))
+ """
+
+ override def show() = {
+ val r = eval().mkString("\n")
+ assert(!(r.contains("warning") || r.contains("error")), r)
+ }
+}