~ubuntu-branches/debian/sid/scala/sid

« back to all changes in this revision

Viewing changes to test/files/run/virtpatmat_unapply.scala

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Mehdi Dogguy, Lucas Satabin, Frank S. Thomas, Emmanuel Bourg
  • Date: 2015-06-05 23:52:59 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150605235259-wk00vgk83dh8o19g
Tags: 2.10.5-1
* Team upload.

[ Mehdi Dogguy ]
* New upstream release (Closes: #744278).

[ Lucas Satabin ]
* Update patches
* Update the clean target
* Update paths of elements to install
* Update watch file

[ Frank S. Thomas ]
* Remove myself from Uploaders.

[ Emmanuel Bourg ]
* The package has been adopted by the Java Team (Closes: #754935)
* Patched the build to avoid downloading libraries from the Internet
* Replaced the minified JavaScript files with unobfuscated ones
* No longer build scala-partest.jar until diffutils is packaged or replaced
* debian/watch: Fixed the versions matched (x.y.z instead of x.y.z..z)
* debian/rules:
  - Added the missing get-orig-source target (Closes: #724704)
  - Improved the clean target
* debian/control:
  - Build depend on scala (>= 2.10) and bnd
  - Use canonical URLs for the Vcs-* fields
  - Standards-Version updated to 3.9.6 (no changes)
* Switch to debhelper level 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
class IntList(val hd: Int, val tl: IntList)
 
2
object NilIL extends IntList(0, null)
 
3
object IntList {
 
4
  def unapply(il: IntList): Option[(Int, IntList)] = if(il eq NilIL) None else Some(il.hd, il.tl)
 
5
  def apply(x: Int, xs: IntList) = new IntList(x, xs)
 
6
}
 
7
 
 
8
object Test extends App {
 
9
  IntList(1, IntList(2, NilIL)) match { 
 
10
    case IntList(a1, IntList(a2, IntList(a3, y))) => println(a1 + a2 + a3)
 
11
    case IntList(x, y) => println(x)
 
12
  }
 
13
 
 
14
  IntList(1, IntList(2, IntList(3, NilIL))) match { 
 
15
    case IntList(a1, IntList(a2, IntList(a3, y))) => println(a1 + a2 + a3)
 
16
    case IntList(x, y) => println(x)
 
17
  }
 
18
}
 
19
 
 
20
// ((x1: IntList) => IntList.unapply(x1).flatMap(((x4: (Int, IntList)) => IntList.unapply(x4._2).flatMap(((x5: (Int, IntList)) => IntList.unapply(x5._2).flatMap(((x6: (Int, IntList)) => implicitly[Predef.MatchingStrategy[Option]].success(Predef.println(x4._1.+(x5._1).+(x6._1))))))))).orElse(IntList.unapply(x1).flatMap(((x7: (Int, IntList)) => implicitly[scala.Predef.MatchingStrategy[Option]].success(Predef.println(x7._1))))).orElse(implicitly[scala.Predef.MatchingStrategy[Option]].fail))(IntList.apply(1, IntList.apply(2, IntList.apply(3, null))))
 
21
 
 
22
/*
 
23
  ((x1: IntList) => 
 
24
    IntList.this.unapply(x1).flatMap[Int](((x4: (Int, IntList)) => 
 
25
      IntList.this.unapply(x4._2).flatMap[Int](((x5: (Int, IntList)) => 
 
26
        IntList.this.unapply(x5._2).flatMap[Int](((x6: (Int, IntList)) => 
 
27
          Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).success[Int](x6._1))))))).orElse[Int](
 
28
    IntList.this.unapply(x1).flatMap[Int](((x7: (Int, IntList)) => 
 
29
      Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).success[Int](x7._1)))).orElse[Int](
 
30
    Predef.this.implicitly[scala.Predef.MatchingStrategy[Option]](scala.this.Predef.OptionMatching).fail)
 
31
  ).apply(IntList.apply(1, null))
 
32
*/
 
 
b'\\ No newline at end of file'