summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t1785.scala7
-rw-r--r--test/files/run/t4216.check34
-rw-r--r--test/files/run/t4216.scala18
3 files changed, 59 insertions, 0 deletions
diff --git a/test/files/pos/t1785.scala b/test/files/pos/t1785.scala
new file mode 100644
index 0000000000..0b1fafb27c
--- /dev/null
+++ b/test/files/pos/t1785.scala
@@ -0,0 +1,7 @@
+class t1785 {
+ def apply[T](x: Int) = 1
+}
+
+object test {
+ (new t1785)[Int](1)
+}
diff --git a/test/files/run/t4216.check b/test/files/run/t4216.check
new file mode 100644
index 0000000000..ac19a98315
--- /dev/null
+++ b/test/files/run/t4216.check
@@ -0,0 +1,34 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*)
+f: [A](a: A)(implicit evidence$1: ArrayTag[A])java.util.List[A]
+
+scala> f(".")
+res0: java.util.List[String] = [.]
+
+scala> f(0)
+res1: java.util.List[Int] = [0]
+
+scala> def i(a: Int) = java.util.Arrays.asList(Array(a): _*)
+i: (a: Int)java.util.List[Int]
+
+scala> i(0)
+res2: java.util.List[Int] = [0]
+
+scala> def o(a: Any) = java.util.Arrays.asList(Array(a): _*)
+o: (a: Any)java.util.List[Any]
+
+scala> o(".")
+res3: java.util.List[Any] = [.]
+
+scala> class V(val a: Int) extends AnyVal
+defined class V
+
+scala> f(new V(0))
+res4: java.util.List[V] = [V@0]
+
+scala> o(new V(0))
+res5: java.util.List[Any] = [V@0]
+
+scala>
diff --git a/test/files/run/t4216.scala b/test/files/run/t4216.scala
new file mode 100644
index 0000000000..4ada8f48aa
--- /dev/null
+++ b/test/files/run/t4216.scala
@@ -0,0 +1,18 @@
+import scala.tools.partest.ReplTest
+
+// t4216
+object Test extends ReplTest {
+ def code =
+ """
+ |def f[A: ArrayTag](a: A) = java.util.Arrays.asList(Array(a): _*)
+ |f(".")
+ |f(0)
+ |def i(a: Int) = java.util.Arrays.asList(Array(a): _*)
+ |i(0)
+ |def o(a: Any) = java.util.Arrays.asList(Array(a): _*)
+ |o(".")
+ |class V(val a: Int) extends AnyVal
+ |f(new V(0))
+ |o(new V(0))
+ |""".stripMargin.trim
+}