summaryrefslogtreecommitdiff
path: root/test/files/pos/virtpatmat_exist1.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2011-10-20 22:29:20 +0000
committerAdriaan Moors <adriaan.moors@epfl.ch>2011-10-20 22:29:20 +0000
commit8a9fd64129926eea35f7dca181242855f14e153f (patch)
tree4defd18749999b6e14d9fba1ccc5e1507b453a64 /test/files/pos/virtpatmat_exist1.scala
parent891a6e466b1b22b93c091d590178f7e5410f608e (diff)
downloadscala-8a9fd64129926eea35f7dca181242855f14e153f.tar.gz
scala-8a9fd64129926eea35f7dca181242855f14e153f.tar.bz2
scala-8a9fd64129926eea35f7dca181242855f14e153f.zip
virtpatmat, hidden behind -Yvirtpatmat
at least one imminent TODO: undo hardwired generation of if/then/else, and decide based on type whether to call flatMap/orElse or inline those methods from Option review by extempore
Diffstat (limited to 'test/files/pos/virtpatmat_exist1.scala')
-rw-r--r--test/files/pos/virtpatmat_exist1.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/files/pos/virtpatmat_exist1.scala b/test/files/pos/virtpatmat_exist1.scala
new file mode 100644
index 0000000000..6cad017b0b
--- /dev/null
+++ b/test/files/pos/virtpatmat_exist1.scala
@@ -0,0 +1,24 @@
+import annotation.unchecked.{ uncheckedVariance=> uV }
+import scala.collection.immutable.{ListMap, HashMap, ListSet, HashSet}
+
+object Test {
+ class HashMapCollision1[A, +B](var hash: Int, var kvs: ListMap[A, B @uV]) extends HashMap[A, B @uV]
+ class HashSetCollision1[A](var hash: Int, var ks: ListSet[A]) extends HashSet[A]
+
+ def splitArray[T](ad: Array[Iterable[T]]): Any =
+ ad(0) match {
+ case _: HashMapCollision1[_, _] | _: HashSetCollision1[_] => null
+ }
+
+ // without type ascription for the one in the body of the last flatmap of each alternative, type inference borks on the existentials
+ // def splitArray[T >: Nothing <: Any](ad: Array[Iterable[T]]): Any = { import OptionMatching._
+ // runOrElse(ad.apply(0))(((x1: Iterable[T]) => (
+ // or(((x4: Iterable[T]) => one(null)),
+ // guard(x1.isInstanceOf[Iterable[T] with Test.HashMapCollision1[_,_]], x1.asInstanceOf[Iterable[T] with Test.HashMapCollision1[_,_]]).flatMap(((x2: Iterable[T] with Test.HashMapCollision1[_,_]) => one(x2))),
+ // guard(x1.isInstanceOf[Test.HashSetCollision1[_]], x1.asInstanceOf[Iterable[T] with Test.HashSetCollision1[_]]).flatMap(((x3: Iterable[T] with Test.HashSetCollision1[_]) => one(x3)))): Option[Any]).orElse(
+ // (zero: Option[Any])))
+ // )
+ // }
+
+}
+