From f52458dfff38f9b50031f796d09ce02d370b9bd3 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 5 Oct 2009 21:22:06 +0000 Subject: Test cases for some tickets fixed by recent arr... Test cases for some tickets fixed by recent array and implicit activity: #1038, #1005, #1272. --- test/files/neg/bug1038.check | 5 +++++ test/files/neg/bug1038.scala | 8 ++++++++ test/files/pos/bug1272.scala | 9 +++++++++ test/files/run/bug1005.check | 2 ++ test/files/run/bug1005.scala | 19 +++++++++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 test/files/neg/bug1038.check create mode 100644 test/files/neg/bug1038.scala create mode 100644 test/files/pos/bug1272.scala create mode 100644 test/files/run/bug1005.check create mode 100644 test/files/run/bug1005.scala diff --git a/test/files/neg/bug1038.check b/test/files/neg/bug1038.check new file mode 100644 index 0000000000..e09cbbc510 --- /dev/null +++ b/test/files/neg/bug1038.check @@ -0,0 +1,5 @@ +bug1038.scala:4: error: not enough arguments for constructor X: (x: Int)X. +Unspecified value parameter x. + val a = new X + ^ +one error found diff --git a/test/files/neg/bug1038.scala b/test/files/neg/bug1038.scala new file mode 100644 index 0000000000..9fdcae207f --- /dev/null +++ b/test/files/neg/bug1038.scala @@ -0,0 +1,8 @@ +class X(x : Int) + +object Y { + val a = new X + import a._ + implicit val b : Int = 1 + implicit val c = 2 +} \ No newline at end of file diff --git a/test/files/pos/bug1272.scala b/test/files/pos/bug1272.scala new file mode 100644 index 0000000000..d86a909ae5 --- /dev/null +++ b/test/files/pos/bug1272.scala @@ -0,0 +1,9 @@ +object ImplicitTest { + implicit val i : Int = 10 + implicit def a(implicit i : Int) : Array[Byte] = null + implicit def b[T](implicit i : Int) : Array[T] = null + + def fn[T](implicit x : T) = 0 + + val x = fn[Array[Byte]] +} \ No newline at end of file diff --git a/test/files/run/bug1005.check b/test/files/run/bug1005.check new file mode 100644 index 0000000000..6ec0929090 --- /dev/null +++ b/test/files/run/bug1005.check @@ -0,0 +1,2 @@ +Halp! +Halp! diff --git a/test/files/run/bug1005.scala b/test/files/run/bug1005.scala new file mode 100644 index 0000000000..5ccd89dd85 --- /dev/null +++ b/test/files/run/bug1005.scala @@ -0,0 +1,19 @@ +object Test +{ + class Foo[T](x : Array[AnyRef]) { def bar = x.asInstanceOf[Array[T]] } + class Bar[T](x : Array[T]) { def bar = x.asInstanceOf[Array[AnyRef]] } + + object FromMono{ + def main(args : Array[String]) = (new Foo[AnyRef](Array[AnyRef]("Halp!"))).bar + } + + object FromPoly{ + def main(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar + } + + def main(args: Array[String]): Unit = { + println(FromMono main null mkString) + println(FromPoly main null mkString) + } +} + -- cgit v1.2.3