summaryrefslogtreecommitdiff
path: root/test/files/pos/virtpatmat_exist2.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_exist2.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_exist2.scala')
-rw-r--r--test/files/pos/virtpatmat_exist2.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/pos/virtpatmat_exist2.scala b/test/files/pos/virtpatmat_exist2.scala
new file mode 100644
index 0000000000..ee186074ab
--- /dev/null
+++ b/test/files/pos/virtpatmat_exist2.scala
@@ -0,0 +1,20 @@
+class ParseResult[+T]
+case class MemoEntry[+T](var r: Either[Nothing,ParseResult[_]])
+
+object Test {
+ def grow[T]: ParseResult[T] = (null: MemoEntry[T]) match {
+ case MemoEntry(Right(x: ParseResult[_])) => x.asInstanceOf[ParseResult[T]]
+ }
+
+ // what's the _$1 doing there?
+ // def grow[T >: Nothing <: Any]: ParseResult[T] = {
+ // import OptionMatching._
+ // runOrElse[MemoEntry[T], ParseResult[T]]((null: MemoEntry[T]))(((x1: MemoEntry[T]) =>
+ // (MemoEntry.unapply[T](x1).flatMap[ParseResult[T]](((x4: Either[Nothing,ParseResult[_]]) =>
+ // guard[Right[Nothing,ParseResult[_]]](x4.isInstanceOf[Right[Nothing,ParseResult[_]]], x4.asInstanceOf[Right[Nothing,ParseResult[_]]]).flatMap[ParseResult[T]](((cp3: Right[Nothing,ParseResult[_]]) =>
+ // scala.Right.unapply[Nothing, ParseResult[_]](cp3).flatMap[ParseResult[T]](((x5: ParseResult[_]) =>
+ // guard[ParseResult[_$1]](x5.ne(null), x5.asInstanceOf[ParseResult[_]]).flatMap[ParseResult[T]](((x6: ParseResult[_]) =>
+ // one[ParseResult[T]](x6.asInstanceOf[ParseResult[T]]))))))))): Option[ParseResult[T]]
+ // ).orElse[ParseResult[T]]((zero: Option[ParseResult[T]]))))
+ // }
+} \ No newline at end of file