*** empty log message ***

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@1549 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
michelou 2003-10-02 12:02:33 +00:00
parent 0d72fec682
commit 02f3a94c80
4 changed files with 46 additions and 0 deletions

View File

@ -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) 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]) =
System.out.println(min(List()));
}

View File

@ -0,0 +1,5 @@
object V with Executable {
def foo[A](x: String) = new Object;
def foo[A](x: Runnable) = new Object;
val code = foo[Int]("test");
}

18
test/pos/bug082.scala Normal file
View File

@ -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) 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]) =
System.out.println(min(List()));
}

5
test/pos/bug173.scala Normal file
View File

@ -0,0 +1,5 @@
object V with Executable {
def foo[A](x: String) = new Object;
def foo[A](x: Runnable) = new Object;
val code = foo[Int]("test");
}