From 718cc9060ce80af502040d426e67bf2f333ff482 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 9 Mar 2006 15:32:43 +0000 Subject: --- test/files/neg/bug85.check | 7 +------ test/files/neg/constrs.check | 18 ++++++++++++++++++ test/files/neg/constrs.scala | 19 +++++++++++++++++++ test/files/pos/bug342.scala | 1 - test/files/pos/kinzer.scala | 8 ++++++++ test/files/run/caseclasses.check | 1 + test/files/run/caseclasses.scala | 13 +++++++++++++ 7 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 test/files/neg/constrs.check create mode 100644 test/files/neg/constrs.scala create mode 100755 test/files/pos/kinzer.scala create mode 100644 test/files/run/caseclasses.check create mode 100644 test/files/run/caseclasses.scala (limited to 'test') diff --git a/test/files/neg/bug85.check b/test/files/neg/bug85.check index 2e48792d5a..d4d56d3295 100644 --- a/test/files/neg/bug85.check +++ b/test/files/neg/bug85.check @@ -1,11 +1,6 @@ -bug85.scala:6 error: type mismatch; - found : A.this.C - required: A.this.B#C - val b: B = new B(new C()); - ^ bug85.scala:7 error: type mismatch; found : A.this.b.C required: A.this.C val c: C = b.c; ^ -two errors found +one error found diff --git a/test/files/neg/constrs.check b/test/files/neg/constrs.check new file mode 100644 index 0000000000..7b7365ea00 --- /dev/null +++ b/test/files/neg/constrs.check @@ -0,0 +1,18 @@ +constrs.scala:6 error: type T is not a member of test + def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); System.out.println(x) } + ^ +constrs.scala:6 error: value u is not a member of test + def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); System.out.println(x) } + ^ +constrs.scala:10 error: called constructor must precede calling constructor + def this() = this("abc") + ^ +constrs.scala:12 error: called constructor must precede calling constructor + def this(x: boolean) = this(x) + ^ +constrs.scala:16 error: type mismatch; + found : scala.Int(1) + required: a + def this() = this(1) + ^ +5 errors found diff --git a/test/files/neg/constrs.scala b/test/files/neg/constrs.scala new file mode 100644 index 0000000000..5c4ac071e8 --- /dev/null +++ b/test/files/neg/constrs.scala @@ -0,0 +1,19 @@ +object test { + + abstract class Test(x: int) { + type T; + val u = x; + def this(y: int)(z: int)(t: this.T) = { this(this.u + y + z); System.out.println(x) } + } + + class Foo(x: int) { + def this() = this("abc") + def this(x: String) = this(1) + def this(x: boolean) = this(x) + } + + class Bar[a](x: a) { + def this() = this(1) + } + +} diff --git a/test/files/pos/bug342.scala b/test/files/pos/bug342.scala index 2e72ef220b..29e36415f9 100644 --- a/test/files/pos/bug342.scala +++ b/test/files/pos/bug342.scala @@ -1,6 +1,5 @@ object Main extends Application { -//object Foo extends Enumeration { // 1: OK ! object Foo extends Enumeration(0, "Bar") { // 2 val Bar = Value } diff --git a/test/files/pos/kinzer.scala b/test/files/pos/kinzer.scala new file mode 100755 index 0000000000..a80bd425c6 --- /dev/null +++ b/test/files/pos/kinzer.scala @@ -0,0 +1,8 @@ +// ScalaMenuTest.scala +object ScalaMenuTest { + def main(args: Array[String]): Unit = { + val v = new javax.swing.JMenu() + v.add(new javax.swing.JMenuItem()) + //v.add(new java.awt.PopupMenu()); + } +} diff --git a/test/files/run/caseclasses.check b/test/files/run/caseclasses.check new file mode 100644 index 0000000000..d86bac9de5 --- /dev/null +++ b/test/files/run/caseclasses.check @@ -0,0 +1 @@ +OK diff --git a/test/files/run/caseclasses.scala b/test/files/run/caseclasses.scala new file mode 100644 index 0000000000..18455768ce --- /dev/null +++ b/test/files/run/caseclasses.scala @@ -0,0 +1,13 @@ +case class Foo(x: int)(y: int); + +case class Bar; + +object Test extends Application { + def fn[a,b](x: a => b) = x; + val f = fn(Foo(1)) + (f(2): AnyRef) match { + case Foo(1) => System.out.println("OK") + case Bar() => System.out.println("NO") + } +} + -- cgit v1.2.3