summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-01-31 23:31:19 -0800
committerPaul Phillips <paulp@improving.org>2013-01-31 23:31:19 -0800
commit309ff57ba62b6a6ec1a9c1b28b8bbabfd1b47b72 (patch)
tree39030b5419c51c89afbc40ede4828f5cebf99810 /test/files/run
parent36f78dd6060ac753c3a7707b3d5ca3afb300f915 (diff)
parentff92610c48ad13c17f0374619faa9c2c6e1dd0e5 (diff)
downloadscala-309ff57ba62b6a6ec1a9c1b28b8bbabfd1b47b72.tar.gz
scala-309ff57ba62b6a6ec1a9c1b28b8bbabfd1b47b72.tar.bz2
scala-309ff57ba62b6a6ec1a9c1b28b8bbabfd1b47b72.zip
Merge pull request #2015 from paulp/rc1-backports
10 backports
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t4729.check4
-rw-r--r--test/files/run/t4729/J_1.java4
-rw-r--r--test/files/run/t4729/S_2.scala29
-rw-r--r--test/files/run/t5604.check8
-rw-r--r--test/files/run/t5604.scala50
-rw-r--r--test/files/run/t6584.check8
-rw-r--r--test/files/run/t6584.scala16
7 files changed, 119 insertions, 0 deletions
diff --git a/test/files/run/t4729.check b/test/files/run/t4729.check
new file mode 100644
index 0000000000..9a2aa56d99
--- /dev/null
+++ b/test/files/run/t4729.check
@@ -0,0 +1,4 @@
+WrappedArray(1, 2)
+WrappedArray(1, 2)
+WrappedArray(1, 2)
+WrappedArray(1, 2)
diff --git a/test/files/run/t4729/J_1.java b/test/files/run/t4729/J_1.java
new file mode 100644
index 0000000000..2ffb5a88d1
--- /dev/null
+++ b/test/files/run/t4729/J_1.java
@@ -0,0 +1,4 @@
+// Java Interface:
+public interface J_1 {
+ public void method(String... s);
+}
diff --git a/test/files/run/t4729/S_2.scala b/test/files/run/t4729/S_2.scala
new file mode 100644
index 0000000000..e34e3d34d4
--- /dev/null
+++ b/test/files/run/t4729/S_2.scala
@@ -0,0 +1,29 @@
+ // Scala class:
+class ScalaVarArgs extends J_1 {
+ // -- no problem on overriding it using ordinary class
+ def method(s: String*) { println(s) }
+}
+
+object Test {
+ def main(args: Array[String]) {
+ //[1] Ok - no problem using inferred type
+ val varArgs = new J_1 {
+ def method(s: String*) { println(s) }
+ }
+ varArgs.method("1", "2")
+
+ //[2] Ok -- no problem when explicit set its type after construction
+ val b: J_1 = varArgs
+ b.method("1", "2")
+
+ //[3] Ok -- no problem on calling its method
+ (new ScalaVarArgs).method("1", "2")
+ (new ScalaVarArgs: J_1).method("1", "2")
+
+ //[4] Not Ok -- error when assigning anonymous class to a explictly typed val
+ // Compiler error: object creation impossible, since method method in trait VarArgs of type (s: <repeated...>[java.lang.String])Unit is not defined
+ val tagged: J_1 = new J_1 {
+ def method(s: String*) { println(s) }
+ }
+ }
+}
diff --git a/test/files/run/t5604.check b/test/files/run/t5604.check
new file mode 100644
index 0000000000..53a2fc8894
--- /dev/null
+++ b/test/files/run/t5604.check
@@ -0,0 +1,8 @@
+long
+double
+long
+double
+long
+double
+long
+double
diff --git a/test/files/run/t5604.scala b/test/files/run/t5604.scala
new file mode 100644
index 0000000000..a06c8aab3e
--- /dev/null
+++ b/test/files/run/t5604.scala
@@ -0,0 +1,50 @@
+// a.scala
+// Fri Jan 13 11:31:47 PST 2012
+
+package foo {
+ object regular extends Duh {
+ def buh(n: Long) = println("long")
+ def buh(n: Double) = println("double")
+ }
+ class regular {
+ import regular._
+
+ duh(33L)
+ duh(3.0d)
+ foo.regular.duh(33L)
+ foo.regular.duh(3.0d)
+ buh(66L)
+ buh(6.0d)
+ foo.regular.buh(66L)
+ foo.regular.buh(6.0d)
+ }
+
+ trait Duh {
+ def duh(n: Long) = println("long")
+ def duh(n: Double) = println("double")
+ }
+ package object bar extends Duh {
+ def buh(n: Long) = println("long")
+ def buh(n: Double) = println("double")
+ }
+ package bar {
+ object Main {
+ def main(args:Array[String]) {
+ duh(33L)
+ duh(3.0d)
+ foo.bar.duh(33L)
+ foo.bar.duh(3.0d)
+ buh(66L)
+ buh(6.0d)
+ foo.bar.buh(66L)
+ foo.bar.buh(6.0d)
+ }
+ }
+ }
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ foo.bar.Main.main(null)
+ }
+}
diff --git a/test/files/run/t6584.check b/test/files/run/t6584.check
new file mode 100644
index 0000000000..35c8688751
--- /dev/null
+++ b/test/files/run/t6584.check
@@ -0,0 +1,8 @@
+Array: 102400
+Vector: 102400
+List: 102400
+Stream: 102400
+Array: 102400
+Vector: 102400
+List: 102400
+Stream: 102400
diff --git a/test/files/run/t6584.scala b/test/files/run/t6584.scala
new file mode 100644
index 0000000000..24c236ef35
--- /dev/null
+++ b/test/files/run/t6584.scala
@@ -0,0 +1,16 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ val size = 100 * 1024
+ val doubled = (1 to size) ++ (1 to size)
+
+ println("Array: " + Array.tabulate(size)(x => x).distinct.size)
+ println("Vector: " + Vector.tabulate(size)(x => x).distinct.size)
+ println("List: " + List.tabulate(size)(x => x).distinct.size)
+ println("Stream: " + Stream.tabulate(size)(x => x).distinct.size)
+
+ println("Array: " + doubled.toArray.distinct.size)
+ println("Vector: " + doubled.toVector.distinct.size)
+ println("List: " + doubled.toList.distinct.size)
+ println("Stream: " + doubled.toStream.distinct.size)
+ }
+}