diff options
author | Martin Odersky <odersky@gmail.com> | 2006-05-30 10:47:58 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-05-30 10:47:58 +0000 |
commit | f7a989f23a40541d6f2b6de88dca3c55e6d7376f (patch) | |
tree | 4c86eb89b85ebfebc0f458b3efbb68df668b68d7 /test/files | |
parent | 335de89b823ac04008aab6a05569d1097068e6cf (diff) | |
download | scala-f7a989f23a40541d6f2b6de88dca3c55e6d7376f.tar.gz scala-f7a989f23a40541d6f2b6de88dca3c55e6d7376f.tar.bz2 scala-f7a989f23a40541d6f2b6de88dca3c55e6d7376f.zip |
fixed bugs615 and 617
Diffstat (limited to 'test/files')
-rwxr-xr-x | test/files/neg/bug421.scala | 8 | ||||
-rwxr-xr-x | test/files/pos/bug319.scala | 21 | ||||
-rw-r--r-- | test/files/pos/bug607.scala | 11 | ||||
-rw-r--r-- | test/files/pos/bug615.scala | 11 | ||||
-rwxr-xr-x | test/files/run/bug429.scala | 15 | ||||
-rwxr-xr-x | test/files/run/bug441.scala | 12 |
6 files changed, 78 insertions, 0 deletions
diff --git a/test/files/neg/bug421.scala b/test/files/neg/bug421.scala new file mode 100755 index 0000000000..3e014b7500 --- /dev/null +++ b/test/files/neg/bug421.scala @@ -0,0 +1,8 @@ +object foo { + case class Bar(a:String, b:Object, c:String*); + + Bar("foo","meets","bar") match { + case Bar("foo",_*) => error("huh?"); + } + +} diff --git a/test/files/pos/bug319.scala b/test/files/pos/bug319.scala new file mode 100755 index 0000000000..eed25eb84c --- /dev/null +++ b/test/files/pos/bug319.scala @@ -0,0 +1,21 @@ +object test { + + trait A { type T; } + + trait B { type T; } + + /** def functor(x: A): B { type T = x.T } */ + abstract class functor() { + val arg: A; + val res: B { type T = arg.T } = + new B { type T = arg.T; }; + } + + val a = new A { type T = String }; + /** val b: B { type T = String } = functor(a) */ + val b: B { type T = String } = { + val tmp = new functor() { val arg = a }; + tmp.res + } + +} diff --git a/test/files/pos/bug607.scala b/test/files/pos/bug607.scala new file mode 100644 index 0000000000..42c3a15a85 --- /dev/null +++ b/test/files/pos/bug607.scala @@ -0,0 +1,11 @@ +object Test +{ + trait Foo { type T } + object FooX extends Foo { type T = X; trait X } + + def test(x : Foo { type T = FooX.X }) = {} + + def main(argv : Array[String]) : Unit = { + test(FooX) + } +} diff --git a/test/files/pos/bug615.scala b/test/files/pos/bug615.scala new file mode 100644 index 0000000000..8fefc952e0 --- /dev/null +++ b/test/files/pos/bug615.scala @@ -0,0 +1,11 @@ +object test { + abstract class Bar { + type T + def bar: Unit + } + new Bar { + type T = Int + def bar = () + }.bar +} + diff --git a/test/files/run/bug429.scala b/test/files/run/bug429.scala new file mode 100755 index 0000000000..b2cc8128c0 --- /dev/null +++ b/test/files/run/bug429.scala @@ -0,0 +1,15 @@ +object Test { + abstract class A { + Console.print("A"); + val x: Int; + val y: Int = {Console.print("y"); x + 1} + } + class B extends A { + Console.print("B"); + val z = 0; + val x = 4 + z + } + def main (args: Array[String]): Unit = { + Console.print((new B).y); + } +} diff --git a/test/files/run/bug441.scala b/test/files/run/bug441.scala new file mode 100755 index 0000000000..d90e872baa --- /dev/null +++ b/test/files/run/bug441.scala @@ -0,0 +1,12 @@ +object Test extends Application { + + def bug() = { + val foo: Array[String] = Array("1","2","3"); + if( foo.length == null ) // == 0 makes more sense, but still + Console.println("plante"); // this code leads to runtime crash + else + Console.println("plante pas"); + } + + bug() +} |