summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-05-08 16:34:57 +0000
committerMartin Odersky <odersky@gmail.com>2006-05-08 16:34:57 +0000
commit00afa24fb6f2621e02e6ecd8ef86db56dd3913b5 (patch)
treef0240f5daed36699de1e928c780fb16744dbc22a /test/files
parentff1c68655acee7faf1227337ce444d2d08ca2a9a (diff)
downloadscala-00afa24fb6f2621e02e6ecd8ef86db56dd3913b5.tar.gz
scala-00afa24fb6f2621e02e6ecd8ef86db56dd3913b5.tar.bz2
scala-00afa24fb6f2621e02e6ecd8ef86db56dd3913b5.zip
Bug fixes
Diffstat (limited to 'test/files')
-rw-r--r--test/files/neg/bug391.check16
-rw-r--r--test/files/neg/bug391.scala6
-rw-r--r--test/files/neg/bug588.check13
-rwxr-xr-xtest/files/neg/bug588.scala15
-rw-r--r--test/files/pos/bug422.scala17
-rw-r--r--test/files/run/bug428.check8
-rw-r--r--test/files/run/bug428.scala37
7 files changed, 112 insertions, 0 deletions
diff --git a/test/files/neg/bug391.check b/test/files/neg/bug391.check
new file mode 100644
index 0000000000..57b3f5d565
--- /dev/null
+++ b/test/files/neg/bug391.check
@@ -0,0 +1,16 @@
+bug391.scala:2 error: identifier expected but 'def' found.
+ def fun1(def x: Int): Int = x; // the "def x" is illegal
+ ^
+bug391.scala:3 error: ':' expected but '}' found.
+ def fun2(val x: Int): Int = x; // the "val x" is illegal
+ ^
+bug391.scala:4 error: illegal start of simple expression
+}
+^
+bug391.scala:6 error: identifier expected but 'def' found.
+class E(def x: Int); // the "def x" is illegal
+ ^
+bug391.scala:6 error: ':' expected but eof found.
+class E(def x: Int); // the "def x" is illegal
+ ^
+5 errors found
diff --git a/test/files/neg/bug391.scala b/test/files/neg/bug391.scala
new file mode 100644
index 0000000000..08c083baa5
--- /dev/null
+++ b/test/files/neg/bug391.scala
@@ -0,0 +1,6 @@
+trait C {
+ def fun1(def x: Int): Int = x; // the "def x" is illegal
+ def fun2(val x: Int): Int = x; // the "val x" is illegal
+}
+
+class E(def x: Int); // the "def x" is illegal
diff --git a/test/files/neg/bug588.check b/test/files/neg/bug588.check
new file mode 100644
index 0000000000..02a9b9c482
--- /dev/null
+++ b/test/files/neg/bug588.check
@@ -0,0 +1,13 @@
+/home/odersky/scala/test/files/pos/bug588.scala:3 error: double definition:
+method visit:((scala.Int) => java.lang.String)scala.Boolean and
+method visit:((scala.Int) => scala.Unit)scala.Boolean at line 2
+have same type after erasure: (scala.Function1)scala.Boolean
+ def visit(f: int => String): boolean
+ ^
+/home/odersky/scala/test/files/pos/bug588.scala:10 error: double definition:
+method f:(Test.this.TypeB)scala.Unit and
+method f:(Test.this.TypeA)scala.Unit at line 9
+have same type after erasure: (Test#TraitA)scala.Unit
+ def f(brac : TypeB) : Unit;
+ ^
+two errors found
diff --git a/test/files/neg/bug588.scala b/test/files/neg/bug588.scala
new file mode 100755
index 0000000000..bbb79ed79e
--- /dev/null
+++ b/test/files/neg/bug588.scala
@@ -0,0 +1,15 @@
+abstract class Test0 {
+ def visit(f: int => unit): boolean
+ def visit(f: int => String): boolean
+}
+trait Test {
+ type TypeA <: TraitA;
+ type TypeB <: TypeA with TraitB;
+
+ def f(node : TypeA) : Unit;
+ def f(brac : TypeB) : Unit;
+
+ trait TraitA;
+ trait TraitB;
+
+}
diff --git a/test/files/pos/bug422.scala b/test/files/pos/bug422.scala
new file mode 100644
index 0000000000..cb3ba279d4
--- /dev/null
+++ b/test/files/pos/bug422.scala
@@ -0,0 +1,17 @@
+import scala.util.regexp.WordExp;
+import scala.util.automata.WordBerrySethi;
+
+object BoolWordExp extends WordExp {
+ type _labelT = MyLabels;
+ type _regexpT = RegExp;
+ abstract class MyLabels extends Label ;
+ case class MyLabel(c:Char) extends MyLabels;
+}
+
+object MyTranslator extends WordBerrySethi {
+ override val lang = BoolWordExp;
+ import lang._;
+ override protected def seenLabel( r:RegExp, i:Int, label: _labelT ): Unit = {
+ super.seenLabel(r,i,label)
+ }
+}
diff --git a/test/files/run/bug428.check b/test/files/run/bug428.check
new file mode 100644
index 0000000000..21bef2f8d3
--- /dev/null
+++ b/test/files/run/bug428.check
@@ -0,0 +1,8 @@
+Foo 1: a = 0, b = 0, x = 0, y = 0
+Foo 2: a = 2, b = 0, x = 0, y = 0
+Foo 3: a = 2, b = 3, x = 0, y = 0
+Foo 4: a = 2, b = 3, x = 0, y = 0
+Foo 5: a = 2, b = 3, x = 0, y = 0
+Bar 1: a = 2, b = 3, x = 0, y = 0
+Bar 2: a = 2, b = 3, x = 5, y = 0
+Bar 3: a = 2, b = 3, x = 5, y = 7
diff --git a/test/files/run/bug428.scala b/test/files/run/bug428.scala
new file mode 100644
index 0000000000..34d99efd1f
--- /dev/null
+++ b/test/files/run/bug428.scala
@@ -0,0 +1,37 @@
+object Test {
+
+ abstract class Foo(_a: Int, _b: Int) {
+
+ Console.println("Foo 1: " + this);
+ val a: Int = _a;
+ Console.println("Foo 2: " + this);
+ val b: Int = { fun(); _b }
+ Console.println("Foo 3: " + this);
+ val x: Int;
+ Console.println("Foo 4: " + this);
+ val y: Int;
+ Console.println("Foo 5: " + this);
+
+
+ def fun(): Unit = ();
+
+ override def toString(): String =
+ "a = " + a + ", b = " + b + ", x = " + x + ", y = " + y;
+
+ }
+
+ class Bar(_a: Int, _b: Int, _x: Int, _y: Int) extends Foo(_a, _b) {
+
+ Console.println("Bar 1: " + this);
+ val x: Int = _x;
+ Console.println("Bar 2: " + this);
+ val y: Int = { fun(); _y }
+ Console.println("Bar 3: " + this);
+
+ }
+
+ def main (args: Array[String]): Unit = {
+ new Bar(2,3,5,7);
+ }
+
+}