diff options
author | Martin Odersky <odersky@gmail.com> | 2003-09-17 19:45:12 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-09-17 19:45:12 +0000 |
commit | 5b9b5356411cbd5e4de94d6c84832f99cd10b5de (patch) | |
tree | fd59c9c23d4aeba05718b2603eb16944b8526d90 | |
parent | d8af1f7d532494c988767ca905592c65250293f0 (diff) | |
download | scala-5b9b5356411cbd5e4de94d6c84832f99cd10b5de.tar.gz scala-5b9b5356411cbd5e4de94d6c84832f99cd10b5de.tar.bz2 scala-5b9b5356411cbd5e4de94d6c84832f99cd10b5de.zip |
*** empty log message ***
-rw-r--r-- | test/files/neg/bug136.check | 9 | ||||
-rw-r--r-- | test/files/neg/bug136.scala | 10 | ||||
-rw-r--r-- | test/files/neg/bug139.check | 5 | ||||
-rw-r--r-- | test/files/neg/bug139.scala | 6 | ||||
-rw-r--r-- | test/files/neg/bug140.check | 4 | ||||
-rw-r--r-- | test/files/neg/bug140.scala | 7 | ||||
-rw-r--r-- | test/files/neg/bug143.check | 4 | ||||
-rw-r--r-- | test/files/neg/bug143.scala | 8 | ||||
-rw-r--r-- | test/files/pos/bug137.scala | 4 | ||||
-rw-r--r-- | test/files/pos/starargs.scala | 17 | ||||
-rw-r--r-- | test/neg/bug136.check | 9 | ||||
-rw-r--r-- | test/neg/bug136.scala | 10 | ||||
-rw-r--r-- | test/neg/bug139.check | 5 | ||||
-rw-r--r-- | test/neg/bug139.scala | 6 | ||||
-rw-r--r-- | test/neg/bug140.check | 4 | ||||
-rw-r--r-- | test/neg/bug140.scala | 7 | ||||
-rw-r--r-- | test/neg/bug143.check | 4 | ||||
-rw-r--r-- | test/neg/bug143.scala | 8 | ||||
-rw-r--r-- | test/pos/bug137.scala | 4 | ||||
-rw-r--r-- | test/pos/starargs.scala | 17 |
20 files changed, 148 insertions, 0 deletions
diff --git a/test/files/neg/bug136.check b/test/files/neg/bug136.check new file mode 100644 index 0000000000..ea23cb313a --- /dev/null +++ b/test/files/neg/bug136.check @@ -0,0 +1,9 @@ +bug136.scala:5: type mismatch; + found : Bar + required: Foo + val foo2: Foo = bar; + ^ +bug136.scala:7: object bar does not implement Foo +object bar: Foo { + ^ +two errors found diff --git a/test/files/neg/bug136.scala b/test/files/neg/bug136.scala new file mode 100644 index 0000000000..205e12d704 --- /dev/null +++ b/test/files/neg/bug136.scala @@ -0,0 +1,10 @@ +class Foo; +class Bar: Foo { + val bar: Bar = null; + val foo1: Foo = this; + val foo2: Foo = bar; +} +object bar: Foo { + val foo1: Foo = this; + val foo2: Foo = bar; +} diff --git a/test/files/neg/bug139.check b/test/files/neg/bug139.check new file mode 100644 index 0000000000..8f8d7421a2 --- /dev/null +++ b/test/files/neg/bug139.check @@ -0,0 +1,5 @@ +bug139.scala:5: error overriding type T in class A; + type T in class B may not be parameterized + type T[A] = Int; + ^ +one error found diff --git a/test/files/neg/bug139.scala b/test/files/neg/bug139.scala new file mode 100644 index 0000000000..433ba7bf6f --- /dev/null +++ b/test/files/neg/bug139.scala @@ -0,0 +1,6 @@ +abstract class A { + type T; +} +class B extends A { + type T[A] = Int; +} diff --git a/test/files/neg/bug140.check b/test/files/neg/bug140.check new file mode 100644 index 0000000000..f8415be2f0 --- /dev/null +++ b/test/files/neg/bug140.check @@ -0,0 +1,4 @@ +bug140.scala:4: object bar does not implement Foo +object bar: Foo { + ^ +one error found diff --git a/test/files/neg/bug140.scala b/test/files/neg/bug140.scala new file mode 100644 index 0000000000..8bdd5f2b6d --- /dev/null +++ b/test/files/neg/bug140.scala @@ -0,0 +1,7 @@ +class Foo { + def foo: Int = 0 +} +object bar: Foo { + bar.foo; + def main(args: Array[String]): Unit = (); +} diff --git a/test/files/neg/bug143.check b/test/files/neg/bug143.check new file mode 100644 index 0000000000..479966107a --- /dev/null +++ b/test/files/neg/bug143.check @@ -0,0 +1,4 @@ +bug143.scala:7: illegal cyclic reference involving type Inner + override type Inner = Alias; + ^ +one error found diff --git a/test/files/neg/bug143.scala b/test/files/neg/bug143.scala new file mode 100644 index 0000000000..9414d426d5 --- /dev/null +++ b/test/files/neg/bug143.scala @@ -0,0 +1,8 @@ +abstract class Foo { + type Inner; + type Alias = Inner; +} + +class Bar extends Foo { + override type Inner = Alias; +} diff --git a/test/files/pos/bug137.scala b/test/files/pos/bug137.scala new file mode 100644 index 0000000000..79eb6e67f8 --- /dev/null +++ b/test/files/pos/bug137.scala @@ -0,0 +1,4 @@ +class A { + type Two[A] = Tuple2[A, A]; + type TwoInt = Two[Int]; +} diff --git a/test/files/pos/starargs.scala b/test/files/pos/starargs.scala new file mode 100644 index 0000000000..40b9124637 --- /dev/null +++ b/test/files/pos/starargs.scala @@ -0,0 +1,17 @@ +case class C[a](x: a*) { + def elems: Seq[a] = x; +} + +object Test with Executable { + def foo(x: int*) = { + C(x: _*); + } + System.out.println(foo(1, 2, 3).elems); + System.out.println(foo(List(1, 2, 3): _*).elems); + System.out.println(new C(1, 2, 3).elems); + val xs = List(1, 2, 3); + System.out.println(new C(xs: _*).elems); +} + + + diff --git a/test/neg/bug136.check b/test/neg/bug136.check new file mode 100644 index 0000000000..ea23cb313a --- /dev/null +++ b/test/neg/bug136.check @@ -0,0 +1,9 @@ +bug136.scala:5: type mismatch; + found : Bar + required: Foo + val foo2: Foo = bar; + ^ +bug136.scala:7: object bar does not implement Foo +object bar: Foo { + ^ +two errors found diff --git a/test/neg/bug136.scala b/test/neg/bug136.scala new file mode 100644 index 0000000000..205e12d704 --- /dev/null +++ b/test/neg/bug136.scala @@ -0,0 +1,10 @@ +class Foo; +class Bar: Foo { + val bar: Bar = null; + val foo1: Foo = this; + val foo2: Foo = bar; +} +object bar: Foo { + val foo1: Foo = this; + val foo2: Foo = bar; +} diff --git a/test/neg/bug139.check b/test/neg/bug139.check new file mode 100644 index 0000000000..8f8d7421a2 --- /dev/null +++ b/test/neg/bug139.check @@ -0,0 +1,5 @@ +bug139.scala:5: error overriding type T in class A; + type T in class B may not be parameterized + type T[A] = Int; + ^ +one error found diff --git a/test/neg/bug139.scala b/test/neg/bug139.scala new file mode 100644 index 0000000000..433ba7bf6f --- /dev/null +++ b/test/neg/bug139.scala @@ -0,0 +1,6 @@ +abstract class A { + type T; +} +class B extends A { + type T[A] = Int; +} diff --git a/test/neg/bug140.check b/test/neg/bug140.check new file mode 100644 index 0000000000..f8415be2f0 --- /dev/null +++ b/test/neg/bug140.check @@ -0,0 +1,4 @@ +bug140.scala:4: object bar does not implement Foo +object bar: Foo { + ^ +one error found diff --git a/test/neg/bug140.scala b/test/neg/bug140.scala new file mode 100644 index 0000000000..8bdd5f2b6d --- /dev/null +++ b/test/neg/bug140.scala @@ -0,0 +1,7 @@ +class Foo { + def foo: Int = 0 +} +object bar: Foo { + bar.foo; + def main(args: Array[String]): Unit = (); +} diff --git a/test/neg/bug143.check b/test/neg/bug143.check new file mode 100644 index 0000000000..479966107a --- /dev/null +++ b/test/neg/bug143.check @@ -0,0 +1,4 @@ +bug143.scala:7: illegal cyclic reference involving type Inner + override type Inner = Alias; + ^ +one error found diff --git a/test/neg/bug143.scala b/test/neg/bug143.scala new file mode 100644 index 0000000000..9414d426d5 --- /dev/null +++ b/test/neg/bug143.scala @@ -0,0 +1,8 @@ +abstract class Foo { + type Inner; + type Alias = Inner; +} + +class Bar extends Foo { + override type Inner = Alias; +} diff --git a/test/pos/bug137.scala b/test/pos/bug137.scala new file mode 100644 index 0000000000..79eb6e67f8 --- /dev/null +++ b/test/pos/bug137.scala @@ -0,0 +1,4 @@ +class A { + type Two[A] = Tuple2[A, A]; + type TwoInt = Two[Int]; +} diff --git a/test/pos/starargs.scala b/test/pos/starargs.scala new file mode 100644 index 0000000000..40b9124637 --- /dev/null +++ b/test/pos/starargs.scala @@ -0,0 +1,17 @@ +case class C[a](x: a*) { + def elems: Seq[a] = x; +} + +object Test with Executable { + def foo(x: int*) = { + C(x: _*); + } + System.out.println(foo(1, 2, 3).elems); + System.out.println(foo(List(1, 2, 3): _*).elems); + System.out.println(new C(1, 2, 3).elems); + val xs = List(1, 2, 3); + System.out.println(new C(xs: _*).elems); +} + + + |