diff options
author | Martin Odersky <odersky@gmail.com> | 2009-11-24 15:50:06 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2009-11-24 15:50:06 +0000 |
commit | 4a1b22e19fcca892917868beb355daef27dc7b8f (patch) | |
tree | a089be4378af8d48fd1a4d2e6ae1e11b75666bff /test/files | |
parent | d6b43c4b48dceb4ba6682c4a17dae02a0bc7f138 (diff) | |
download | scala-4a1b22e19fcca892917868beb355daef27dc7b8f.tar.gz scala-4a1b22e19fcca892917868beb355daef27dc7b8f.tar.bz2 scala-4a1b22e19fcca892917868beb355daef27dc7b8f.zip |
Closed #2629 #2639 #2669
Diffstat (limited to 'test/files')
-rwxr-xr-x | test/files/pos/t1545.scala | 16 | ||||
-rw-r--r-- | test/files/pos/t2669.scala | 28 |
2 files changed, 44 insertions, 0 deletions
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 +} |