summaryrefslogtreecommitdiff
path: root/test/files/run/virtpatmat_partial.scala
blob: c408b31983e9ae9f9d04a7e8aed44af0fa175f8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
object Test extends App {
  val a = Map("a" -> Some(1), "b" -> None)
  println(a)

  val res = a collect {case (p, Some(a)) => (p, a)}

  // should uncurry to:
  // val res: Map[String,Int] = a.collect[(String, Int), Map[String,Int]](
  //   new PartialFunction[(String, Option[Int]),(String, Int)]  {
  //     def apply(x0_1: (String, Option[Int])): (String, Int) = MatchingStrategy.OptionMatchingStrategy.runOrElse[(String, Option[Int]), (String, Int)](x0_1)(
  //       (x1: (String, Option[Int])) => {
  //           val o9: Option[(String, Int)] = ({
  //             val o8: Option[(String, Option[Int])] = Tuple2.unapply[String, Option[Int]](x1);
  //             if (o8.isEmpty)
  //               MatchingStrategy.OptionMatchingStrategy.zero
  //             else
  //               {
  //                 val o7: Option[Some[Int]] = if (o8.get._2.isInstanceOf[Some[Int]])
  //                   MatchingStrategy.OptionMatchingStrategy.one[Some[Int]](o8.get._2.asInstanceOf[Some[Int]])
  //                 else
  //                   MatchingStrategy.OptionMatchingStrategy.zero;
  //                 if (o7.isEmpty)
  //                   MatchingStrategy.OptionMatchingStrategy.zero
  //                 else
  //                   {
  //                     val o6: Option[Int] = Some.unapply[Int](o7.get);
  //                     if (o6.isEmpty)
  //                       MatchingStrategy.OptionMatchingStrategy.zero
  //                     else
  //                       MatchingStrategy.OptionMatchingStrategy.one[(String, Int)]((o8.get._1, o6.get).asInstanceOf[(String, Int)])
  //                   }
  //               }
  //           }: Option[(String, Int)]);
  //           if (o9.isEmpty)
  //             (MatchingStrategy.OptionMatchingStrategy.zero: Option[(String, Int)])
  //           else
  //             o9
  //         })
  //     
  //       def isDefinedAt(x_1: (String, Option[Int])): Boolean = MatchingStrategy.OptionMatchingStrategy.isSuccess[(String, Option[Int]), (String, Int)](x_1)(
  //         (x1: (String, Option[Int])) => {
  //           val o9: Option[(String, Int)] = ({
  //             val o8: Option[(String, Option[Int])] = scala.Tuple2.unapply[String, Option[Int]](x1);
  //             if (o8.isEmpty)
  //               MatchingStrategy.OptionMatchingStrategy.zero
  //             else
  //               {
  //                 val o7: Option[Some[Int]] = if (o8.get._2.isInstanceOf[Some[Int]])
  //                   MatchingStrategy.OptionMatchingStrategy.one[Some[Int]](o8.get._2.asInstanceOf[Some[Int]]) // XXX
  //                 else
  //                   MatchingStrategy.OptionMatchingStrategy.zero;
  //                 if (o7.isEmpty)
  //                   MatchingStrategy.OptionMatchingStrategy.zero
  //                 else
  //                   {
  //                     val o6: Option[Int] = scala.Some.unapply[Int](o7.get);
  //                     if (o6.isEmpty)
  //                       MatchingStrategy.OptionMatchingStrategy.zero
  //                     else
  //                       MatchingStrategy.OptionMatchingStrategy.one[(String, Int)](null.asInstanceOf[(String, Int)])
  //                   }
  //               }
  //           }: Option[(String, Int)]);
  //           if (o9.isEmpty)
  //             (MatchingStrategy.OptionMatchingStrategy.zero: Option[(String, Int)])
  //           else
  //             o9
  //     })
  //   }
  // )

  println(res)
}