summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2011-04-26 08:44:22 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2011-04-26 08:44:22 +0000
commit15d477697395ff93c3065b7f2c7db06160662851 (patch)
tree0000b0c73bbf5a9541135364f92bb62c10e007c2 /test
parentf5faa91d3d6ed21a2849f090c40082f95e7dc121 (diff)
downloadscala-15d477697395ff93c3065b7f2c7db06160662851.tar.gz
scala-15d477697395ff93c3065b7f2c7db06160662851.tar.bz2
scala-15d477697395ff93c3065b7f2c7db06160662851.zip
Merged revisions 24803-24820 via svnmerge from
https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r24803 | odersky | 2011-04-21 19:21:28 +0200 (Thu, 21 Apr 2011) | 1 line Added bridge method capability to compiler. Some tweaks to reflect generic. No review (yet). ........ r24804 | odersky | 2011-04-22 00:41:20 +0200 (Fri, 22 Apr 2011) | 1 line Some more tweaks to the bridge scheme. ........ r24805 | extempore | 2011-04-22 03:47:32 +0200 (Fri, 22 Apr 2011) | 1 line New starr based on r24804, no review. ........ r24806 | odersky | 2011-04-22 11:21:28 +0200 (Fri, 22 Apr 2011) | 1 line Fixed spurious qualification of types that are locally quantified. Review by extempore. ........ r24807 | extempore | 2011-04-23 00:01:22 +0200 (Sat, 23 Apr 2011) | 2 lines Fixing a BaseBerrySethi bug I introduced in r19842. Patch by buraq, no review. ........ r24808 | eugenevigdorchik | 2011-04-23 14:18:53 +0200 (Sat, 23 Apr 2011) | 1 line Introduce new request for informing the presentation compiler of files deletion. Review by odersky. ........ r24809 | extempore | 2011-04-23 17:14:59 +0200 (Sat, 23 Apr 2011) | 2 lines Strip unused pattern variable bindings out before performing match translation. Closes #4269, no review. ........ r24810 | extempore | 2011-04-23 18:56:32 +0200 (Sat, 23 Apr 2011) | 1 line Reverted a jline commit which had broken history search, no review. ........ r24811 | pedrofurla | 2011-04-23 23:11:32 +0200 (Sat, 23 Apr 2011) | 1 line Shows migration and it's message. Contributed by Simon Ochsenreither (soc). Review by malayeri. ........ r24812 | extempore | 2011-04-24 00:04:36 +0200 (Sun, 24 Apr 2011) | 5 lines Working my way through pattern matcher sequence issues mostly caused by the special handling of Lists. Also deleting all kinds of useless or almost useless code which is presently only clutter. Closes #2756, #2800, #3050, #3530, #3972, no review. ........ r24813 | odersky | 2011-04-24 12:18:44 +0200 (Sun, 24 Apr 2011) | 1 line Refined handling fo @bridge methods. Review by extempore. ........ r24814 | extempore | 2011-04-24 18:19:21 +0200 (Sun, 24 Apr 2011) | 1 line Updated a bunch of @deprecated annotations to have a version, no review. ........ r24815 | extempore | 2011-04-24 19:10:26 +0200 (Sun, 24 Apr 2011) | 1 line New starr based on r24814, no review. ........ r24816 | extempore | 2011-04-24 21:15:19 +0200 (Sun, 24 Apr 2011) | 1 line Enclosed the out of bounds index with some IOOB exceptions, no review. ........ r24817 | extempore | 2011-04-24 21:15:46 +0200 (Sun, 24 Apr 2011) | 2 lines Removed restriction on case classes having only two parameter lists. Closes #1333, no review. ........ r24818 | extempore | 2011-04-24 21:16:10 +0200 (Sun, 24 Apr 2011) | 2 lines Added warning when someone tries to return a non-Unit value from a Unit method, no review. ........ r24819 | odersky | 2011-04-24 22:13:40 +0200 (Sun, 24 Apr 2011) | 1 line Added a bunch of bridges to make ameliorate binary compatibility of new collections. Review by prokopec. Review by extempore. ........ r24820 | odersky | 2011-04-25 12:37:48 +0200 (Mon, 25 Apr 2011) | 1 line Temporarily moving interpreter.scala to pending. We need a more robust solution wrt heap size before we can bring it back. (interpreter scala randomly fails with OutOfMemoryError because it starts a new java process with default heap size. Depending on the configuration, default heap size is sometimes not enough.) ........
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/bug1333.check4
-rw-r--r--test/files/neg/bug1333.scala1
-rw-r--r--test/files/neg/unit-returns-value.check4
-rw-r--r--test/files/neg/unit-returns-value.flags1
-rw-r--r--test/files/neg/unit-returns-value.scala11
-rw-r--r--test/files/pos/bug3972.scala11
-rw-r--r--test/files/pos/bug4269.scala5
-rw-r--r--test/files/run/bug1333.check3
-rw-r--r--test/files/run/bug1333.scala14
-rw-r--r--test/files/run/bug2800.check14
-rw-r--r--test/files/run/bug2800.scala36
-rw-r--r--test/files/run/bug3050.scala (renamed from test/pending/run/bug3050.scala)2
-rw-r--r--test/files/run/bug3530.check13
-rw-r--r--test/files/run/bug3530.scala36
-rw-r--r--test/pending/jvm/interpreter.scala (renamed from test/files/jvm/interpreter.scala)0
15 files changed, 143 insertions, 12 deletions
diff --git a/test/files/neg/bug1333.check b/test/files/neg/bug1333.check
deleted file mode 100644
index 11ba633194..0000000000
--- a/test/files/neg/bug1333.check
+++ /dev/null
@@ -1,4 +0,0 @@
-bug1333.scala:1: error: case classes limited by implementation: maximum of 2 constructor parameter lists.
-case class A(a: Int)(b: Int)(c: Int)
- ^
-one error found
diff --git a/test/files/neg/bug1333.scala b/test/files/neg/bug1333.scala
deleted file mode 100644
index e16b38cefc..0000000000
--- a/test/files/neg/bug1333.scala
+++ /dev/null
@@ -1 +0,0 @@
-case class A(a: Int)(b: Int)(c: Int)
diff --git a/test/files/neg/unit-returns-value.check b/test/files/neg/unit-returns-value.check
new file mode 100644
index 0000000000..18368f45ab
--- /dev/null
+++ b/test/files/neg/unit-returns-value.check
@@ -0,0 +1,4 @@
+unit-returns-value.scala:4: error: enclosing method f has result type Unit: return value discarded
+ if (b) return 5
+ ^
+one error found
diff --git a/test/files/neg/unit-returns-value.flags b/test/files/neg/unit-returns-value.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/unit-returns-value.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/unit-returns-value.scala b/test/files/neg/unit-returns-value.scala
new file mode 100644
index 0000000000..27a1111c5b
--- /dev/null
+++ b/test/files/neg/unit-returns-value.scala
@@ -0,0 +1,11 @@
+object Test {
+ def f {
+ var b = false
+ if (b) return 5
+ }
+
+ // no warning
+ def g {
+ return println("hello")
+ }
+}
diff --git a/test/files/pos/bug3972.scala b/test/files/pos/bug3972.scala
new file mode 100644
index 0000000000..5dfc10fcef
--- /dev/null
+++ b/test/files/pos/bug3972.scala
@@ -0,0 +1,11 @@
+object CompilerCrash {
+ def main(args: Array[String]) {
+ args match {
+ case Array("a", a @ _*) => { } // The code compiles fine if this line is commented out or "@ _*" is deleted or this line is swapped for the next line
+ case Array("b") => { } // The code compiles fine if this line is commented out
+ case Array("c", c) => {
+ 0 // The code compiles fine if this line is commented out
+ }
+ }
+ }
+}
diff --git a/test/files/pos/bug4269.scala b/test/files/pos/bug4269.scala
new file mode 100644
index 0000000000..99a30785b4
--- /dev/null
+++ b/test/files/pos/bug4269.scala
@@ -0,0 +1,5 @@
+class A {
+ PartialFunction.condOpt(Nil) {
+ case items@List(_*) if true =>
+ }
+}
diff --git a/test/files/run/bug1333.check b/test/files/run/bug1333.check
new file mode 100644
index 0000000000..6303af7f1c
--- /dev/null
+++ b/test/files/run/bug1333.check
@@ -0,0 +1,3 @@
+10
+-10
+-1
diff --git a/test/files/run/bug1333.scala b/test/files/run/bug1333.scala
new file mode 100644
index 0000000000..1696629cbb
--- /dev/null
+++ b/test/files/run/bug1333.scala
@@ -0,0 +1,14 @@
+object Test {
+ case class A(x: Int)(y: Int)(z: String)
+
+ def f(x: Any) = x match {
+ case A(x) => x
+ case _ => -1
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f(A(10)(20)("abc")))
+ println(f(A(-10)(20)("abc")))
+ println(f(List(1)))
+ }
+}
diff --git a/test/files/run/bug2800.check b/test/files/run/bug2800.check
new file mode 100644
index 0000000000..546ee52413
--- /dev/null
+++ b/test/files/run/bug2800.check
@@ -0,0 +1,14 @@
+false
+false
+List()
+false
+false
+false
+false
+Vector(1)
+false
+false
+true
+false
+false
+false
diff --git a/test/files/run/bug2800.scala b/test/files/run/bug2800.scala
new file mode 100644
index 0000000000..84d1de0507
--- /dev/null
+++ b/test/files/run/bug2800.scala
@@ -0,0 +1,36 @@
+object Test {
+ def f1 = ("": Any) match { case List(x @ _*) => x ; case _ => false }
+ def f2 = (5: Any) match { case List(x @ _*) => x ; case _ => false }
+ def f3 = (Nil: Any) match { case List(x @ _*) => x ; case _ => false }
+ def f4 = (Array(1): Any) match { case List(x @ _*) => x ; case _ => false }
+
+ def f5 = ("": Any) match { case Array(x @ _*) => x ; case _ => false }
+ def f6 = (5: Any) match { case Array(x @ _*) => x ; case _ => false }
+ def f7 = (Nil: Any) match { case Array(x @ _*) => x ; case _ => false }
+ def f8 = (Array(1): Any) match { case Array(x @ _*) => x ; case _ => false }
+
+ def f9 = ("": Any) match { case x @ List(_*) => x ; case _ => false }
+ def f10 = ("": Any) match { case List(_*) => true ; case _ => false }
+ def f11 = (Nil: Any) match { case List(_*) => true ; case _ => false }
+ def f12 = ("": Any) match { case x @ Array(_*) => x ; case _ => false }
+ def f13 = ("": Any) match { case Array(_*) => true ; case _ => false }
+ def f14 = (Nil: Any) match { case Array(_*) => true ; case _ => false }
+
+
+ def main(args: Array[String]): Unit = {
+ println(f1)
+ println(f2)
+ println(f3)
+ println(f4)
+ println(f5)
+ println(f6)
+ println(f7)
+ println(f8)
+ println(f9)
+ println(f10)
+ println(f11)
+ println(f12)
+ println(f13)
+ println(f14)
+ }
+}
diff --git a/test/pending/run/bug3050.scala b/test/files/run/bug3050.scala
index aaec99ec14..d1f3f13bec 100644
--- a/test/pending/run/bug3050.scala
+++ b/test/files/run/bug3050.scala
@@ -4,6 +4,6 @@ object Test {
try { ("": Any) match { case List(_*) => true } }
catch { case _ => false }
- assert(x == false)
+ assert(!x)
}
}
diff --git a/test/files/run/bug3530.check b/test/files/run/bug3530.check
index 633c15d9d7..1f906680e9 100644
--- a/test/files/run/bug3530.check
+++ b/test/files/run/bug3530.check
@@ -1 +1,12 @@
-Some List
+two
+three
+list: 4
+list: 0
+list: 5
+not a list
+
+two
+three
+list: 4
+list: 0
+list: 5
diff --git a/test/files/run/bug3530.scala b/test/files/run/bug3530.scala
index f2c0034691..f6f7fb4229 100644
--- a/test/files/run/bug3530.scala
+++ b/test/files/run/bug3530.scala
@@ -1,9 +1,35 @@
object Test {
+ def f(x: Any) = println(x match {
+ case List(_, _) => "two"
+ case List(_, _, _) => "three"
+ case xs @ List(_*) => "list: " + xs.length
+ case _ => "not a list"
+ })
+
+ def f2[T](x: List[T]) = println(x match {
+ case List(_, _) => "two"
+ case List(_, _, _) => "three"
+ case List(xs @ _*) => "list: " + xs.length
+ // bug: the default case is marked unreachable
+ // case _ => "not a list"
+ })
+
def main(args: Array[String]) {
- val list = List(1,2,3)
- list match {
- case List(_, _) => println("List with two elements")
- case List(_*) => println("Some List")
- }
+ f(List(1, 2))
+ f(List('a', 'b', 'c'))
+ f(List('a', 'b', 'c', 'd'))
+ f(Nil)
+ f(List(1,2,3,4,5))
+ f(null)
+
+ println
+
+ f2(List(1, 2))
+ f2(List('a', 'b', 'c'))
+ f2(List('a', 'b', 'c', 'd'))
+ f2(Nil)
+ f2(List(1,2,3,4,5))
+ // bug: this NPEs on xs.length
+ // f2(null)
}
} \ No newline at end of file
diff --git a/test/files/jvm/interpreter.scala b/test/pending/jvm/interpreter.scala
index 752a129950..752a129950 100644
--- a/test/files/jvm/interpreter.scala
+++ b/test/pending/jvm/interpreter.scala