From 4a1b22e19fcca892917868beb355daef27dc7b8f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 24 Nov 2009 15:50:06 +0000 Subject: Closed #2629 #2639 #2669 --- test/files/pos/t1545.scala | 16 ++++++++++++++++ test/files/pos/t2669.scala | 28 ++++++++++++++++++++++++++++ test/pending/neg/t1545.scala | 16 ---------------- 3 files changed, 44 insertions(+), 16 deletions(-) create mode 100755 test/files/pos/t1545.scala create mode 100644 test/files/pos/t2669.scala delete mode 100755 test/pending/neg/t1545.scala (limited to 'test') diff --git a/test/files/pos/t1545.scala b/test/files/pos/t1545.scala new file mode 100755 index 0000000000..d7c0245725 --- /dev/null +++ b/test/files/pos/t1545.scala @@ -0,0 +1,16 @@ +object Main extends Application { + + case class Foo (field : Option[String]) + + val x : PartialFunction[Foo,Int] = + { + c => c.field match { + case Some (s) => 42 + case None => 99 + } + } + + println (x (Foo (None))) // prints 99 + println (x (Foo (Some ("foo")))) // prints 42 + +} diff --git a/test/files/pos/t2669.scala b/test/files/pos/t2669.scala new file mode 100644 index 0000000000..72e931178c --- /dev/null +++ b/test/files/pos/t2669.scala @@ -0,0 +1,28 @@ +// #2629, #2639, #2669 +object Test2669 { + + def test[T](l: java.util.ArrayList[_ <: T]) = 1 + test(new java.util.ArrayList[String]()) + +} + +import java.util.ArrayList + +object Test2629 { + def main(args: Array[String]): Unit = { + val l = new ArrayList[String](1) + val m = new ArrayList(l) + + println(l.size) + println(m.size) + } +} + + +import java.util.Vector + +// scalac cannot detect lack of type params, but then throws AssertionError later: +class TVector2639 { + val b = new Vector // this line passed without error detected + val a = new Vector(1) // this line caused throwing AssertionError when scalac +} diff --git a/test/pending/neg/t1545.scala b/test/pending/neg/t1545.scala deleted file mode 100755 index d7c0245725..0000000000 --- a/test/pending/neg/t1545.scala +++ /dev/null @@ -1,16 +0,0 @@ -object Main extends Application { - - case class Foo (field : Option[String]) - - val x : PartialFunction[Foo,Int] = - { - c => c.field match { - case Some (s) => 42 - case None => 99 - } - } - - println (x (Foo (None))) // prints 99 - println (x (Foo (Some ("foo")))) // prints 42 - -} -- cgit v1.2.3