diff options
-rw-r--r-- | test/files/pos/bug082.scala | 18 | ||||
-rw-r--r-- | test/files/pos/bug173.scala | 5 | ||||
-rw-r--r-- | test/pos/bug082.scala | 18 | ||||
-rw-r--r-- | test/pos/bug173.scala | 5 |
4 files changed, 46 insertions, 0 deletions
diff --git a/test/files/pos/bug082.scala b/test/files/pos/bug082.scala new file mode 100644 index 0000000000..594c9fdc86 --- /dev/null +++ b/test/files/pos/bug082.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) 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())); + +} diff --git a/test/files/pos/bug173.scala b/test/files/pos/bug173.scala new file mode 100644 index 0000000000..69f964aa36 --- /dev/null +++ b/test/files/pos/bug173.scala @@ -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"); +} diff --git a/test/pos/bug082.scala b/test/pos/bug082.scala new file mode 100644 index 0000000000..594c9fdc86 --- /dev/null +++ b/test/pos/bug082.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) 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())); + +} diff --git a/test/pos/bug173.scala b/test/pos/bug173.scala new file mode 100644 index 0000000000..69f964aa36 --- /dev/null +++ b/test/pos/bug173.scala @@ -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"); +} |