summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-02 22:43:10 +0000
committerPaul Phillips <paulp@improving.org>2010-10-02 22:43:10 +0000
commit06aa1c9eff49d5190e82a72a876d7b3bd706d6d4 (patch)
tree4c38f2559c839ba297060a48023d69550c5d107e /test/files
parent256aca612204f1316e5281af6d10a14300d58ad1 (diff)
downloadscala-06aa1c9eff49d5190e82a72a876d7b3bd706d6d4.tar.gz
scala-06aa1c9eff49d5190e82a72a876d7b3bd706d6d4.tar.bz2
scala-06aa1c9eff49d5190e82a72a876d7b3bd706d6d4.zip
Sorting through the tests in pending from oldes...
Sorting through the tests in pending from oldest to newest because I don't believe in having useless appendages. The verdict on the oldest fifteen tests is: 15/15 are fixed. Many were already in files under a different name. I moved a few and deleted the rest. Fun fact of the day: apparently there was a time when to call into java varargs with no arguments you might have to write something like: getClass().getMethod("getCount", Array[java.lang.Class[T] forSome { type T }]()) On this basis I retract any complaints I've ever had about anything. There is one question mark outlined in pos/testCoercionThis.scala, a file formerly called pos/moors.scala and therefore... review by moors.
Diffstat (limited to 'test/files')
-rw-r--r--test/files/jvm/backendBugUnapply.check2
-rw-r--r--test/files/jvm/backendBugUnapply.scala20
-rw-r--r--test/files/neg/bug0418.check7
-rw-r--r--test/files/neg/bug0418.scala3
-rw-r--r--test/files/pos/bug0305.scala7
-rw-r--r--test/files/pos/bug573.scala43
-rw-r--r--test/files/pos/bug578.scala7
-rw-r--r--test/files/pos/testCoercionThis.scala19
-rw-r--r--test/files/run/exc.scala10
-rw-r--r--test/files/run/exc1.scala10
-rw-r--r--test/files/run/exc2.scala12
11 files changed, 140 insertions, 0 deletions
diff --git a/test/files/jvm/backendBugUnapply.check b/test/files/jvm/backendBugUnapply.check
new file mode 100644
index 0000000000..9d1e7b29c2
--- /dev/null
+++ b/test/files/jvm/backendBugUnapply.check
@@ -0,0 +1,2 @@
+baz
+null
diff --git a/test/files/jvm/backendBugUnapply.scala b/test/files/jvm/backendBugUnapply.scala
new file mode 100644
index 0000000000..5461b72f91
--- /dev/null
+++ b/test/files/jvm/backendBugUnapply.scala
@@ -0,0 +1,20 @@
+object Test {
+ import scala.xml.{Node,HasKeyValue}
+
+ def domatch(x:Node): Node = {
+ val hasBar = new HasKeyValue("bar")
+
+ x match {
+ case Node("foo", hasBar(z), _*) => z
+ case _ => null
+ }
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(domatch(<foo bar="baz"><hi/></foo>))
+ println(domatch(<foo bingo="donkey"><hi/></foo>))
+ //
+ // assert(domatch(<foo bar="baz"><hi/></foo>).toString == "baz")
+ // assert(domatch(<foo bar="baz2"><hi/></foo>) == null)//, domatch(<foo bar="baz2"><hi/></foo>))
+ }
+}
diff --git a/test/files/neg/bug0418.check b/test/files/neg/bug0418.check
new file mode 100644
index 0000000000..08bd24bf29
--- /dev/null
+++ b/test/files/neg/bug0418.check
@@ -0,0 +1,7 @@
+bug0418.scala:2: error: not found: value Foo12340771
+ null match { case Foo12340771.Bar(x) => x }
+ ^
+bug0418.scala:2: error: not found: value x
+ null match { case Foo12340771.Bar(x) => x }
+ ^
+two errors found
diff --git a/test/files/neg/bug0418.scala b/test/files/neg/bug0418.scala
new file mode 100644
index 0000000000..67007010d4
--- /dev/null
+++ b/test/files/neg/bug0418.scala
@@ -0,0 +1,3 @@
+object Test {
+ null match { case Foo12340771.Bar(x) => x }
+}
diff --git a/test/files/pos/bug0305.scala b/test/files/pos/bug0305.scala
new file mode 100644
index 0000000000..1219c27030
--- /dev/null
+++ b/test/files/pos/bug0305.scala
@@ -0,0 +1,7 @@
+object Test extends Application {
+
+ def foo(is:Int*) = 1;
+ def foo(i:Int) = 2;
+
+ assert(foo( List(3):_* ) == 1)
+}
diff --git a/test/files/pos/bug573.scala b/test/files/pos/bug573.scala
new file mode 100644
index 0000000000..694d001e3c
--- /dev/null
+++ b/test/files/pos/bug573.scala
@@ -0,0 +1,43 @@
+package lampion.collections;
+
+object DirX {
+ abstract class Dir {
+ def reverse : Dir;
+ }
+ object BEFORE extends Dir {
+ def reverse = AFTER;
+ }
+ object AFTER extends Dir {
+ def reverse = BEFORE;
+ }
+}
+
+import DirX._;
+
+abstract class Linked {
+ type Node <: Node0;
+
+ abstract class Node0 {
+ self: Node =>
+
+ var next : Node = _;
+ var prev : Node = _;
+
+ def get(dir : Dir) = if (dir == BEFORE) prev; else next;
+ private def set(dir : Dir, node : Node) =
+ if (dir == BEFORE) prev = node; else next = node;
+
+ def link(dir : Dir, node : Node) = {
+ assert(get(dir) == null);
+ assert(node.get(dir.reverse) == null);
+ set(dir, node);
+ node.set(dir.reverse, self);
+ }
+
+
+ def end(dir : Dir) : Node = {
+ if (get(dir) == null) this;
+ else get(dir).end(dir);
+ }
+ }
+}
diff --git a/test/files/pos/bug578.scala b/test/files/pos/bug578.scala
new file mode 100644
index 0000000000..6f95dd8cea
--- /dev/null
+++ b/test/files/pos/bug578.scala
@@ -0,0 +1,7 @@
+object Test {
+ val x = Nil
+ val x2: Nil.type = x
+ val y = None
+ val y2: None.type = y
+ Console.println("Okay")
+}
diff --git a/test/files/pos/testCoercionThis.scala b/test/files/pos/testCoercionThis.scala
new file mode 100644
index 0000000000..5631b33306
--- /dev/null
+++ b/test/files/pos/testCoercionThis.scala
@@ -0,0 +1,19 @@
+object Test {
+ implicit def foo2bar(foo: Foo): Bar = foo.bar
+
+ class Foo(val bar: Bar) {
+ def testCoercion = {
+ val a: this.type = this
+ a.baz /* here, foo2bar is inferred by the compiler, as expected */
+ }
+ // def testCoercionThis0 = baz
+ // --> error: not found: value baz
+ // PP: is that something we really want to work? Seems like sketchville.
+ //
+ // These work, so I moved this out of pending.
+ def testCoercionThis1 = this.baz
+ def testCoercionThis2 = (this: Foo).baz
+ }
+
+ class Bar { def baz = System.out.println("baz") }
+}
diff --git a/test/files/run/exc.scala b/test/files/run/exc.scala
new file mode 100644
index 0000000000..4c7db29226
--- /dev/null
+++ b/test/files/run/exc.scala
@@ -0,0 +1,10 @@
+object Test extends Application {
+ def foo() = {
+ while (true) {
+ try {
+ } catch {
+ case ex: Exception =>
+ }
+ }
+ }
+}
diff --git a/test/files/run/exc1.scala b/test/files/run/exc1.scala
new file mode 100644
index 0000000000..24856247bf
--- /dev/null
+++ b/test/files/run/exc1.scala
@@ -0,0 +1,10 @@
+object Test extends Application {
+ def foo(): Unit = {
+ while (true) {
+ try {
+ } catch {
+ case ex: Exception =>
+ }
+ }
+ }
+}
diff --git a/test/files/run/exc2.scala b/test/files/run/exc2.scala
new file mode 100644
index 0000000000..00a269a364
--- /dev/null
+++ b/test/files/run/exc2.scala
@@ -0,0 +1,12 @@
+object Test extends Application {
+ def foo() = {
+ while (true) {
+ try {
+ Console.println("foo")
+ } catch {
+ case ex: Exception =>
+ Console.println("bar")
+ }
+ }
+ }
+}