From fedbced652b533da4baeea37c39c058d2cd2afd8 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 8 Jul 2003 13:19:33 +0000 Subject: *** empty log message *** --- test/pos/bug30.scala | 9 +++++++++ test/pos/bug31.scala | 29 +++++++++++++++++++++++++++++ test/pos/bug36.scala | 8 ++++++++ test/pos/bug39.scala | 6 ++++++ test/pos/refine.scala | 6 ++++++ test/pos/seqtest2.scala | 13 +++++++++++++ 6 files changed, 71 insertions(+) create mode 100644 test/pos/bug30.scala create mode 100644 test/pos/bug31.scala create mode 100644 test/pos/bug36.scala create mode 100644 test/pos/bug39.scala create mode 100644 test/pos/refine.scala create mode 100644 test/pos/seqtest2.scala (limited to 'test/pos') diff --git a/test/pos/bug30.scala b/test/pos/bug30.scala new file mode 100644 index 0000000000..6d28e18c0d --- /dev/null +++ b/test/pos/bug30.scala @@ -0,0 +1,9 @@ +trait A { + def f(x: int): unit; + def f(x: String): unit; +} + +class B extends A { + def f(x: int): unit = (); + def f(x: String): unit = (); +} diff --git a/test/pos/bug31.scala b/test/pos/bug31.scala new file mode 100644 index 0000000000..607dd4ce4f --- /dev/null +++ b/test/pos/bug31.scala @@ -0,0 +1,29 @@ +object Main { + + trait Ensure[a] { + def ensure(postcondition: a => Boolean): a + } + + def require[a](def precondition: Boolean)(def command: a): Ensure[a] = + if (precondition) + new Ensure[a] { + def ensure(postcondition: a => Boolean): a = { + val result = command; + if (postcondition(result)) result + else error("Assertion error") + } + } + else + error("Assertion error"); + + def arb[a](s: List[a]) = + require (! s.isEmpty) { + s.head + } ensure (result => s contains result); + + def main(args: Array[String]) = { + val s = List(1, 2); + System.out.println(arb(s)) + } + +} diff --git a/test/pos/bug36.scala b/test/pos/bug36.scala new file mode 100644 index 0000000000..1d923b0017 --- /dev/null +++ b/test/pos/bug36.scala @@ -0,0 +1,8 @@ +object m { + + val xs: List[int] = Nil; + def f(i: int) = 0; + val v = xs map f; + + def m() = {} +} diff --git a/test/pos/bug39.scala b/test/pos/bug39.scala new file mode 100644 index 0000000000..a131bc0450 --- /dev/null +++ b/test/pos/bug39.scala @@ -0,0 +1,6 @@ +abstract class Extensible[A, This <: Extensible[A, This]](x: A, xs: This): This { + def mkObj(x: A, xs: This): This; +} +class Fixed[A](x: A, xs: Fixed[A]) extends Extensible[A, Fixed[A]](x, xs) { + def mkObj(x: A, xs: Fixed[A]) = new Fixed(x, xs); +} diff --git a/test/pos/refine.scala b/test/pos/refine.scala new file mode 100644 index 0000000000..255621ad43 --- /dev/null +++ b/test/pos/refine.scala @@ -0,0 +1,6 @@ +object test { + + val x: Object { def toString(): String } = new Object { + override def toString(): String = "1"; + } +} diff --git a/test/pos/seqtest2.scala b/test/pos/seqtest2.scala new file mode 100644 index 0000000000..903b270c95 --- /dev/null +++ b/test/pos/seqtest2.scala @@ -0,0 +1,13 @@ +object test { + + val b = List(1, 2, 3); + + def main(args: Array[String]) = + System.out.println( + b match { + case List(1, 2, 3) => true; + case _ => false; + } + ) + +} -- cgit v1.2.3