summaryrefslogtreecommitdiff
path: root/test/files/pos/bug0082.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-04-05 12:59:40 +0000
committermichelou <michelou@epfl.ch>2007-04-05 12:59:40 +0000
commitb5b3ce4df69c6dd19506cd332a97c1ad6660e4a5 (patch)
treedd28bb694890839d94974e7c0ba52c9d3f7e12e0 /test/files/pos/bug0082.scala
parent7674f974c372ab1949a19490b48e5734711ded84 (diff)
downloadscala-b5b3ce4df69c6dd19506cd332a97c1ad6660e4a5.tar.gz
scala-b5b3ce4df69c6dd19506cd332a97c1ad6660e4a5.tar.bz2
scala-b5b3ce4df69c6dd19506cd332a97c1ad6660e4a5.zip
4-digits numbering
Diffstat (limited to 'test/files/pos/bug0082.scala')
-rw-r--r--test/files/pos/bug0082.scala18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/pos/bug0082.scala b/test/files/pos/bug0082.scala
new file mode 100644
index 0000000000..2b365ca333
--- /dev/null
+++ b/test/files/pos/bug0082.scala
@@ -0,0 +1,18 @@
+
+object Main {
+
+ def min0[A](less: (A, A) => Boolean, xs: List[A]): Option[A] = xs match {
+ case List() => None
+ case List(x) => Some(x)
+// case x :: Nil => Some(x)
+ case y :: ys => (min0(less, ys): @unchecked) match {
+ case Some(m) => if (less(y, m)) Some(y) else Some(m)
+ }
+ }
+
+ def min(xs: List[Int]) = min0((x: Int, y: Int) => x < y, xs);
+
+ def main(args: Array[String]) =
+ Console.println(min(List()));
+
+}