summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-02-09 16:26:09 +0000
committerMartin Odersky <odersky@gmail.com>2006-02-09 16:26:09 +0000
commit8adbe6a58562d6dd5c893b88b395ac46c2425e42 (patch)
tree5b9623f7d6ce2d2a61054f4d1b4b86baba376fe9 /test
parent7fc1dcd161f34f9ce8edd34bfc1bf1c97294dd5f (diff)
downloadscala-8adbe6a58562d6dd5c893b88b395ac46c2425e42.tar.gz
scala-8adbe6a58562d6dd5c893b88b395ac46c2425e42.tar.bz2
scala-8adbe6a58562d6dd5c893b88b395ac46c2425e42.zip
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/bug500.check4
-rw-r--r--test/files/neg/bug500.scala22
-rw-r--r--test/files/neg/bug501.check4
-rw-r--r--test/files/neg/bug501.scala18
-rw-r--r--test/files/neg/bug520.check4
-rw-r--r--test/files/neg/bug520.scala9
-rw-r--r--test/files/neg/bug521.check15
-rwxr-xr-xtest/files/neg/bug521.scala25
-rw-r--r--test/files/neg/mixins.check6
-rw-r--r--test/files/neg/mixins.scala9
-rw-r--r--test/files/run/bridges.scala16
-rw-r--r--test/files/run/bugs.scala2
12 files changed, 125 insertions, 9 deletions
diff --git a/test/files/neg/bug500.check b/test/files/neg/bug500.check
new file mode 100644
index 0000000000..245945fbc9
--- /dev/null
+++ b/test/files/neg/bug500.check
@@ -0,0 +1,4 @@
+bug500.scala:3 error: lower bound X does not conform to upper bound Y
+ type T >: X <: Y;
+ ^
+one error found
diff --git a/test/files/neg/bug500.scala b/test/files/neg/bug500.scala
new file mode 100644
index 0000000000..d572cd8b80
--- /dev/null
+++ b/test/files/neg/bug500.scala
@@ -0,0 +1,22 @@
+object Magic {
+ abstract class O[X,Y] {
+ type T >: X <: Y;
+ class I { def magic(v: T): T = v; }
+ }
+ def magic[X,Y](v: X): Y = {
+ val o: O[X,Y] = null;
+ val i: o.I = new o.I();
+ i.magic(v);
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ try {
+ val i: Int = Magic.magic("42");
+ System.out.println(i);
+ } catch {
+ case ex: Throwable => ex.printStackTrace()
+ }
+ }
+}
diff --git a/test/files/neg/bug501.check b/test/files/neg/bug501.check
new file mode 100644
index 0000000000..7b00a39034
--- /dev/null
+++ b/test/files/neg/bug501.check
@@ -0,0 +1,4 @@
+bug501.scala:3 error: lower bound X does not conform to upper bound Y
+ abstract class I { type T >: X <: Y; }
+ ^
+one error found
diff --git a/test/files/neg/bug501.scala b/test/files/neg/bug501.scala
new file mode 100644
index 0000000000..454344974a
--- /dev/null
+++ b/test/files/neg/bug501.scala
@@ -0,0 +1,18 @@
+object Magic {
+ class O[X,Y] {
+ abstract class I { type T >: X <: Y; }
+ val i: I = null;
+ def magic(v: i.T): i.T = v;
+ }
+ def magic[X,Y](v: X): Y = {
+ val o: O[X,Y] = new O();
+ o.magic(v);
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ val i: Int = Magic.magic("42");
+ System.out.println(i);
+ }
+}
diff --git a/test/files/neg/bug520.check b/test/files/neg/bug520.check
new file mode 100644
index 0000000000..4fb56d90f0
--- /dev/null
+++ b/test/files/neg/bug520.check
@@ -0,0 +1,4 @@
+bug520.scala:8 error: overloaded method verifyKeyword needs result type
+ verifyKeyword("", source, pos);
+ ^
+one error found
diff --git a/test/files/neg/bug520.scala b/test/files/neg/bug520.scala
new file mode 100644
index 0000000000..076aca3122
--- /dev/null
+++ b/test/files/neg/bug520.scala
@@ -0,0 +1,9 @@
+object test {
+
+ def verifyKeyword(keyword : String, source : java.io.File, pos : Int) = {
+ assert(keyword != null);
+ }
+
+ def verifyKeyword(source : java.io.File, pos : Int) =
+ verifyKeyword("", source, pos);
+}
diff --git a/test/files/neg/bug521.check b/test/files/neg/bug521.check
new file mode 100644
index 0000000000..818f80052e
--- /dev/null
+++ b/test/files/neg/bug521.check
@@ -0,0 +1,15 @@
+bug521.scala:12 error: class PlainFile needs to be abstract, since method path in class AbstractFile of type => java.lang.String is not defined
+class PlainFile(val file : File) extends AbstractFile {}
+^
+bug521.scala:21 error: error overriding value file in class PlainFile of type => java.io.File;
+ value file needs `override' modifier
+final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
+ ^
+bug521.scala:21 error: class ZipArchive needs to be abstract, since method path in class AbstractFile of type => java.lang.String is not defined
+final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
+ ^
+bug521.scala:23 error: error overriding value path in class VirtualFile of type => java.lang.String;
+ method path needs to be an immutable value
+ override def path = "";
+ ^
+four errors found
diff --git a/test/files/neg/bug521.scala b/test/files/neg/bug521.scala
new file mode 100755
index 0000000000..065f65557c
--- /dev/null
+++ b/test/files/neg/bug521.scala
@@ -0,0 +1,25 @@
+
+// AbstractFile.scala
+package test;
+import java.io._;
+abstract class AbstractFile {
+ def path : String;
+}
+
+// PlainFile.scala
+//package scala.tools.nsc.io;
+//import java.io._;
+class PlainFile(val file : File) extends AbstractFile {}
+// VirtualFile.scala
+//package scala.tools.nsc.io;
+class VirtualFile(val name : String, val path : String) extends AbstractFile {
+}
+// ZipArchive.scala
+//package scala.tools.nsc.io;
+//import java.io._;
+import java.util.zip._;
+final class ZipArchive(val file : File, archive : ZipFile) extends PlainFile(file) {
+ class Entry(name : String, path : String) extends VirtualFile(name, path) {
+ override def path = "";
+ }
+}
diff --git a/test/files/neg/mixins.check b/test/files/neg/mixins.check
new file mode 100644
index 0000000000..805f9c4246
--- /dev/null
+++ b/test/files/neg/mixins.check
@@ -0,0 +1,6 @@
+mixins.scala:9 error: illegal inheritance; superclass C
+ is not a subclass of the superclass B
+ of the mixin class M
+class D extends C with M
+ ^
+one error found
diff --git a/test/files/neg/mixins.scala b/test/files/neg/mixins.scala
new file mode 100644
index 0000000000..dd0ec23329
--- /dev/null
+++ b/test/files/neg/mixins.scala
@@ -0,0 +1,9 @@
+class A;
+
+class B extends A
+
+class C extends A
+
+mixin class M extends B
+
+class D extends C with M
diff --git a/test/files/run/bridges.scala b/test/files/run/bridges.scala
index bf3781fde0..65ba2f13cc 100644
--- a/test/files/run/bridges.scala
+++ b/test/files/run/bridges.scala
@@ -39,21 +39,21 @@ import Help.bar;
import Help.mix;
import Help.sub;
-abstract class Foo___ { type I<:AnyRef; def f: I ; f; }
-abstract class Foo__f { type I<:AnyRef; def f: I = {foo; null}; f; }
+abstract class Foo___ { type I>:AllRef<:AnyRef; def f: I ; f; }
+abstract class Foo__f { type I>:AllRef<:AnyRef; def f: I = {foo; null}; f; }
abstract class Foo_I_ { class I ; def f: I ; f; }
abstract class Foo_If { class I ; def f: I = {foo; null}; f; }
-abstract class FooX__[X] { type I<:AnyRef; def f: I ; f; }
-abstract class FooX_f[X] { type I<:AnyRef; def f: I = {foo; null}; f; }
+abstract class FooX__[X] { type I>:AllRef<:AnyRef; def f: I ; f; }
+abstract class FooX_f[X] { type I>:AllRef<:AnyRef; def f: I = {foo; null}; f; }
abstract class FooXI_[X] { class I ; def f: I ; f; }
abstract class FooXIf[X] { class I ; def f: I = {foo; null}; f; }
-trait Bar___ { type I<:AnyRef; def f: I ; f; }
-trait Bar__f { type I<:AnyRef; def f: I = {bar; null}; f; }
+trait Bar___ { type I>:AllRef<:AnyRef; def f: I ; f; }
+trait Bar__f { type I>:AllRef<:AnyRef; def f: I = {bar; null}; f; }
trait Bar_I_ { class I ; def f: I ; f; }
trait Bar_If { class I ; def f: I = {bar; null}; f; }
-trait BarY__[Y] { type I<:AnyRef; def f: I ; f; }
-trait BarY_f[Y] { type I<:AnyRef; def f: I = {bar; null}; f; }
+trait BarY__[Y] { type I>:AllRef<:AnyRef; def f: I ; f; }
+trait BarY_f[Y] { type I>:AllRef<:AnyRef; def f: I = {bar; null}; f; }
trait BarYI_[Y] { class I ; def f: I ; f; }
trait BarYIf[Y] { class I ; def f: I = {bar; null}; f; }
diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala
index 8d611dae6a..6c24a198de 100644
--- a/test/files/run/bugs.scala
+++ b/test/files/run/bugs.scala
@@ -335,7 +335,7 @@ object Bug257Test {
// version - A
abstract class Bug266AFoo {
- type T <: AnyRef;
+ type T >: AllRef <: AnyRef;
abstract class I0 { def f(x: T): Unit; f(null); }
}