summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-07-14 17:42:54 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-07-14 17:42:54 +0000
commit173a8a1a06b5736678c189284a2976448e4de139 (patch)
tree292f78ecd329ad29a13d81298eb925ffeaed6bda /test/files
parent376085286486500c39d563e3b5d91befe2453f34 (diff)
downloadscala-173a8a1a06b5736678c189284a2976448e4de139.tar.gz
scala-173a8a1a06b5736678c189284a2976448e4de139.tar.bz2
scala-173a8a1a06b5736678c189284a2976448e4de139.zip
Merged revisions 22108,22114,22121,22130-22131,...
Merged revisions 22108,22114,22121,22130-22131,22137,22140-22142,22147-22149,22167-22168, 22174,22176-22177,22182,22186,22188-22189,22194-22199,22211,22215,22234, 22248-22249,22260-22261,22276 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r22108 | odersky | 2010-05-31 19:23:38 +0200 (Mon, 31 May 2010) | 1 line made hashset more robust for concurrent access to reduce eclipse race conditions. ........ r22114 | prokopec | 2010-06-01 18:15:40 +0200 (Tue, 01 Jun 2010) | 1 line Fixes #3496. No review. ........ r22121 | rytz | 2010-06-02 11:57:41 +0200 (Wed, 02 Jun 2010) | 1 line some tests. no review ........ r22130 | dubochet | 2010-06-02 15:11:24 +0200 (Wed, 02 Jun 2010) | 1 line Removed unnecessary files containing code with an uncertain copyright status. ........ r22131 | dubochet | 2010-06-02 15:41:19 +0200 (Wed, 02 Jun 2010) | 1 line Added mandatory copyright notices for some libraries shipped with Scala. ........ r22137 | dubochet | 2010-06-02 16:04:52 +0200 (Wed, 02 Jun 2010) | 1 line Added more license notices for things shipped with Scala. ........ r22140 | dubochet | 2010-06-02 18:23:43 +0200 (Wed, 02 Jun 2010) | 1 line [scaladoc] Updated man page for Scaladoc 2. ........ r22141 | prokopec | 2010-06-02 18:31:56 +0200 (Wed, 02 Jun 2010) | 4 lines Partially solves the problem for #3502. review by extempore This commit reimplements filter for Streams, but does not reimplement map in StreamWithFilter. The problem is that GC can't collect instances of Streams residing on the stack if there are multiple references to the Stream (more than a single one on the stack on which a Stream method is invoked). In the case of a StreamWithFilter, being an inner class, there is always an `$outer` reference to the outer object, so there is little GC can do. Possible solution - change the return type of WithFilter to something else (in TraversableLike) to allow it to return objects that don't have to subclass TraversableLike.WithFilter, and reimplement the withFilter method in Stream to simply call `filter` method - in the case of Streams, `withFilter` has little sense in either case... ........ r22142 | prokopec | 2010-06-02 19:09:39 +0200 (Wed, 02 Jun 2010) | 1 line Fixes #3508. No review is necessary. ........ r22147 | prokopec | 2010-06-03 10:52:01 +0200 (Thu, 03 Jun 2010) | 3 lines Fixes #3511 by adding a custom StreamView. review by extempore - please advise if we should keep this or not ........ r22148 | prokopec | 2010-06-03 10:55:14 +0200 (Thu, 03 Jun 2010) | 1 line Forgot to add stream view classes for #3511. review by extempore. ........ r22149 | dubochet | 2010-06-03 11:22:57 +0200 (Thu, 03 Jun 2010) | 1 line [scaladoc] Fixed typo in Scaladoc man page (thanks Stéphane). No review. ........ r22167 | extempore | 2010-06-04 20:34:02 +0200 (Fri, 04 Jun 2010) | 4 lines Fix for init-order caused NPE in NumericRange. While I was in there ran across some tortured logic trying to accomodate the long abandoned idea of having 5 != 5L, so simplified the contains method. Closes #3518, no review. ........ r22168 | extempore | 2010-06-04 21:15:10 +0200 (Fri, 04 Jun 2010) | 3 lines Tracked down why the jvm/natives.scala fails for me and apparently not anyone else. Rebuilt libnatives.jnlib to accomodate x86-64, and it seems to pass. No review. ........ r22174 | michelou | 2010-06-05 21:25:28 +0200 (Sat, 05 Jun 2010) | 2 lines added/updated Android examples ........ r22176 | odersky | 2010-06-06 09:46:43 +0200 (Sun, 06 Jun 2010) | 2 lines Overwrote copyToArray for efficiency. ........ r22177 | odersky | 2010-06-06 09:47:21 +0200 (Sun, 06 Jun 2010) | 2 lines Fixed a typo in a use case ........ r22182 | prokopec | 2010-06-07 12:15:32 +0200 (Mon, 07 Jun 2010) | 2 lines Adding parallel collections to trunk. sabbus also edited to add parallel collections to the library jar - review by phaller ........ r22186 | extempore | 2010-06-07 23:00:46 +0200 (Mon, 07 Jun 2010) | 2 lines Made scripts wait for all non-daemon threads to exit before calling System.exit. Closes #1955, #2006, #3408. Review by community. ........ r22188 | extempore | 2010-06-08 01:43:14 +0200 (Tue, 08 Jun 2010) | 4 lines Most of the iterate implementations were calling the given function one too many times, leading to tragic failure if the function could not handle this (such as repeatedly applying tail.) Closes #3540, review by prokopec. ........ r22189 | extempore | 2010-06-08 04:15:50 +0200 (Tue, 08 Jun 2010) | 4 lines Taking another shot at negative constants as annotation arguments since r22175 didn't quite get there. I call into the constant folder with the unfolded tree at the last point before it's going to fail the compile anyway. Closes #3521, review by odersky. ........ r22194 | michelou | 2010-06-08 13:13:04 +0200 (Tue, 08 Jun 2010) | 2 lines added/updated Android examples (cnt'd) ........ r22195 | extempore | 2010-06-08 16:35:16 +0200 (Tue, 08 Jun 2010) | 2 lines Fixed a regrettable oversight which was leaving temp files stacking up in templand, and a partial fix for #3519. No review. ........ r22196 | prokopec | 2010-06-08 18:17:58 +0200 (Tue, 08 Jun 2010) | 1 line Fixes #3461. No review.p ........ r22197 | michelou | 2010-06-08 18:52:51 +0200 (Tue, 08 Jun 2010) | 2 lines fixed setenv task (Android examples) ........ r22198 | extempore | 2010-06-08 21:03:56 +0200 (Tue, 08 Jun 2010) | 3 lines Put in some long overdue soft padding around repl completion so when it pokes around the compiler in a way which surprises something, we don't lose the repl. Closes #3548, no review. ........ r22199 | prokopec | 2010-06-09 09:56:13 +0200 (Wed, 09 Jun 2010) | 5 lines Added `combine` and `split` to immutable.HashMap. Under test/benchmarks there is a `bench` script to run benchmarks - it can be invoked after running building the library. Review by rompf. ........ r22211 | prokopec | 2010-06-10 10:58:07 +0200 (Thu, 10 Jun 2010) | 1 line HashMap merge bug fixed. No review ........ r22215 | prokopec | 2010-06-10 19:47:18 +0200 (Thu, 10 Jun 2010) | 1 line Continued working on hash trie map combine - work in progress. No review yet. ........ r22234 | prokopec | 2010-06-11 17:15:55 +0200 (Fri, 11 Jun 2010) | 2 lines Further improved combine for hash tries, cutting of another 30ms (160 downto 130). Review by rompf. ........ r22248 | michelou | 2010-06-12 20:53:45 +0200 (Sat, 12 Jun 2010) | 2 lines updated build scripts (Android examples) ........ r22249 | michelou | 2010-06-12 21:30:16 +0200 (Sat, 12 Jun 2010) | 2 lines moved README file (Android examples) ........ r22260 | extempore | 2010-06-13 18:16:47 +0200 (Sun, 13 Jun 2010) | 1 line Changed groupBy to return immutable.Map. Closes #3550, review by odersky. ........ r22261 | extempore | 2010-06-13 18:17:05 +0200 (Sun, 13 Jun 2010) | 2 lines Made getters treated more like private members when debating whether to inline. Closes #3420, review by dragos. ........ r22276 | dragos | 2010-06-14 14:18:13 +0200 (Mon, 14 Jun 2010) | 1 line Closes #3420, typo in scaladoc for BigInt. No review. ........
Diffstat (limited to 'test/files')
-rwxr-xr-x[-rw-r--r--]test/files/jvm/libnatives.jnilibbin8456 -> 4248 bytes
-rwxr-xr-xtest/files/jvm/mkLibNatives.sh2
-rw-r--r--test/files/pos/bug3420.flags1
-rw-r--r--test/files/pos/bug3420.scala5
-rw-r--r--test/files/pos/bug3521/DoubleValue.java7
-rw-r--r--test/files/pos/bug3521/a.scala4
-rw-r--r--test/files/run/bitsets-msil.check32
-rw-r--r--test/files/run/bug3518.scala16
-rw-r--r--test/files/run/bug3540.scala7
-rw-r--r--test/files/run/exceptions-nest.check12
-rw-r--r--test/files/run/exceptions-nest.scala139
-rw-r--r--test/files/run/t3496.scala15
-rw-r--r--test/files/run/t3502.scala24
-rw-r--r--test/files/run/t3508.scala11
-rw-r--r--test/files/run/t3511.scala36
15 files changed, 294 insertions, 17 deletions
diff --git a/test/files/jvm/libnatives.jnilib b/test/files/jvm/libnatives.jnilib
index daac50e3df..1fc104883a 100644..100755
--- a/test/files/jvm/libnatives.jnilib
+++ b/test/files/jvm/libnatives.jnilib
Binary files differ
diff --git a/test/files/jvm/mkLibNatives.sh b/test/files/jvm/mkLibNatives.sh
index ed80c24c3e..537187eedd 100755
--- a/test/files/jvm/mkLibNatives.sh
+++ b/test/files/jvm/mkLibNatives.sh
@@ -37,7 +37,7 @@ JAVAH_OPTIONS="-jni -force -classpath ${CLASS_DIR} -o ${OBJ_NAME}.h"
CC=gcc
if $darwin; then
- CC_OPTIONS="-c -arch ppc -arch i386"
+ CC_OPTIONS="-c -arch ppc -arch i386 -arch x86_64"
CC_INCLUDES="-I/System/Library/Frameworks/JavaVM.framework/Headers"
LNK_OPTIONS="-dynamiclib -framework JavaVM"
FULL_LIB_NAME=${LIB_NAME}.jnilib
diff --git a/test/files/pos/bug3420.flags b/test/files/pos/bug3420.flags
new file mode 100644
index 0000000000..ea03113c66
--- /dev/null
+++ b/test/files/pos/bug3420.flags
@@ -0,0 +1 @@
+-optimise -Xfatal-warnings \ No newline at end of file
diff --git a/test/files/pos/bug3420.scala b/test/files/pos/bug3420.scala
new file mode 100644
index 0000000000..0fc56ed67b
--- /dev/null
+++ b/test/files/pos/bug3420.scala
@@ -0,0 +1,5 @@
+class C {
+ val cv = Map[Int, Int](1 -> 2)
+ lazy val cl = Map[Int, Int](1 -> 2)
+ def cd = Map[Int, Int](1 -> 2)
+}
diff --git a/test/files/pos/bug3521/DoubleValue.java b/test/files/pos/bug3521/DoubleValue.java
new file mode 100644
index 0000000000..e8c093890b
--- /dev/null
+++ b/test/files/pos/bug3521/DoubleValue.java
@@ -0,0 +1,7 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface DoubleValue {
+ double value();
+} \ No newline at end of file
diff --git a/test/files/pos/bug3521/a.scala b/test/files/pos/bug3521/a.scala
new file mode 100644
index 0000000000..94bb451fc3
--- /dev/null
+++ b/test/files/pos/bug3521/a.scala
@@ -0,0 +1,4 @@
+class Test {
+ @DoubleValue(-0.05)
+ var a = 0
+} \ No newline at end of file
diff --git a/test/files/run/bitsets-msil.check b/test/files/run/bitsets-msil.check
index 9fefa3125e..b187571bff 100644
--- a/test/files/run/bitsets-msil.check
+++ b/test/files/run/bitsets-msil.check
@@ -1,23 +1,23 @@
-ms0 = Set(2)
-ms1 = Set(2)
-ms2 = Set(2)
+ms0 = BitSet(2)
+ms1 = BitSet(2)
+ms2 = BitSet(2)
mb0 = False
mb1 = True
mb2 = False
xs0 = List(2)
xs1 = List(2)
xs2 = List(2)
-ma0 = List(4)
-ma1 = List(4)
-ma2 = List(4)
-mi0 = Set(2)
-mi1 = Set(2)
-mi2 = Set(2)
+ma0 = List(2)
+ma1 = List(2)
+ma2 = List(2)
+mi0 = BitSet(2)
+mi1 = BitSet(2)
+mi2 = BitSet(2)
-is0 = Set()
-is1 = Set()
-is2 = Set(2)
-is3 = Set()
+is0 = BitSet()
+is1 = BitSet()
+is2 = BitSet(2)
+is3 = BitSet()
ib0 = False
ib1 = False
ib2 = True
@@ -26,8 +26,8 @@ ys0 = List()
ys1 = List()
ys2 = List(2)
ys3 = List()
-ia0 = List(0)
-ia1 = List(0)
-ia2 = List(4)
+ia0 = List()
+ia1 = List()
+ia2 = List(2)
ia3 = List()
diff --git a/test/files/run/bug3518.scala b/test/files/run/bug3518.scala
new file mode 100644
index 0000000000..033cc19548
--- /dev/null
+++ b/test/files/run/bug3518.scala
@@ -0,0 +1,16 @@
+object Test {
+ val r1 = 1.0 to 10.0 by 0.5
+ val r2 = 1.0 to 1.0 by 1.0
+ val r3 = 10.0 to 1.0 by -0.5
+ val r4 = 1.0 until 1.0 by 1.0
+ val r5 = 1 to 100 by 2
+
+ def main(args: Array[String]): Unit = {
+ assert(r3 forall (r1 contains _))
+ assert(r1 forall (r3 contains _))
+ assert(r2.size == 1)
+ assert(r4.isEmpty)
+ assert(List(1,3,5,97,99) forall (r5 contains _))
+ assert(List(2,4,6,98,100) forall (x => !r5.contains(x)))
+ }
+}
diff --git a/test/files/run/bug3540.scala b/test/files/run/bug3540.scala
new file mode 100644
index 0000000000..5ffacb5dff
--- /dev/null
+++ b/test/files/run/bug3540.scala
@@ -0,0 +1,7 @@
+object Test {
+ def main(args: Array[String]): Unit = {
+ assert(List.iterate(List(1,2,3), 4)(_.tail).last.isEmpty)
+ assert(Stream.iterate(Stream(1,2,3), 4)(_.tail).last.isEmpty)
+ assert(Array.iterate(Array(1,2,3), 4)(_.tail).last.isEmpty)
+ }
+}
diff --git a/test/files/run/exceptions-nest.check b/test/files/run/exceptions-nest.check
new file mode 100644
index 0000000000..ae66da0a99
--- /dev/null
+++ b/test/files/run/exceptions-nest.check
@@ -0,0 +1,12 @@
+2
+23
+2
+5
+2
+4
+OK
+4
+OK
+10
+1
+()
diff --git a/test/files/run/exceptions-nest.scala b/test/files/run/exceptions-nest.scala
new file mode 100644
index 0000000000..40b00988e4
--- /dev/null
+++ b/test/files/run/exceptions-nest.scala
@@ -0,0 +1,139 @@
+object Test extends Application {
+
+ println(test1)
+ println(test2)
+ println(test3)
+ println(test4)
+ println(test5)
+ try { println(test6) } catch { case _ => println("OK") }
+ println(test7)
+ try { println(test8) } catch { case _ => println("OK") }
+ println(test9)
+ println(test10)
+ println(test11)
+
+ def test1 = {
+ var x = 1
+ try {
+ x = 2
+ } catch {
+ case _: NullPointerException => x = 3
+ case _ => x = 4
+ }
+ x
+ }
+
+ def test2 = {
+ var x = 1
+ try {
+ x = 2
+ try {
+ x = 21
+ } catch {
+ case _ => x = 22
+ }
+ x = 23
+ } catch {
+ case _: NullPointerException => x = 3
+ case _ => x = 4
+ }
+ x
+ }
+
+ def test3 = {
+ var x = 1
+ try {
+ try{x = 2} catch { case _ => x = 4 }
+ } catch {
+ case _: NullPointerException => x = 3
+ case _ => x = 4
+ }
+ x
+ }
+
+ def test4 = {
+ var x = 1
+ try {
+ x = 2
+ } catch {
+ case _: NullPointerException => x = 3
+ case _ => x = 4
+ }
+ try {
+ x = 5
+ } catch {
+ case _: NullPointerException => x = 6
+ }
+ x
+ }
+
+ def test5 = {
+ var x = 1
+ try {
+ x = 2
+ } catch {
+ case _: NullPointerException => try { x = 3 } catch { case f => throw f }
+ case _ => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43
+ }
+ x
+ }
+
+ def test6: Int = {
+ var x = 1
+ try {
+ x = 2
+ (null: String).toString
+ } catch {
+ case e: NullPointerException =>
+ throw e
+ case _ =>
+ x = 3
+ return 1000
+ } finally {
+ x = 4
+ println(x)
+ }
+ x
+ }
+
+ def test7 = {
+ var x = 1
+ try {
+ x = 2
+ } finally {
+ try {
+ x = 4
+ } catch {
+ case _ => x = 5
+ }
+ }
+ x
+ }
+
+ def test8 = {
+ var x = 1
+ try {
+ throw new NullPointerException
+ } catch {
+ case e => throw e
+ }
+ x
+ }
+
+ def test9 = {
+ try { "" match {
+ case s: String => 10
+ }} catch { case _ => 20 }
+ }
+
+ var x10 = 1
+ def test10: Int = {
+ try { 1 }
+ catch { case e if (x10 == 1) => 1 }
+ }
+
+ def test11 {
+ try { () }
+ catch { case e => () }
+ }
+}
diff --git a/test/files/run/t3496.scala b/test/files/run/t3496.scala
new file mode 100644
index 0000000000..e1aa032ab1
--- /dev/null
+++ b/test/files/run/t3496.scala
@@ -0,0 +1,15 @@
+
+
+
+
+// ticket #3496
+object Test {
+
+ def main(args: Array[String]) {
+ val s = Stream.from(1)
+ s.take(5)
+ s.drop(5)
+ s.splitAt(5)
+ }
+
+}
diff --git a/test/files/run/t3502.scala b/test/files/run/t3502.scala
new file mode 100644
index 0000000000..cc78e54c86
--- /dev/null
+++ b/test/files/run/t3502.scala
@@ -0,0 +1,24 @@
+
+
+
+
+
+// ticket #3502
+object Test {
+
+ object GeneratePrimeFactorsLazy extends (Int => List[Int]) {
+ override def apply(n:Int) = {
+ val s = Stream.range(2, n / 2).filter(n % _ == 0)
+ //val s = for (i <- Stream.range(2, n / 2); if n % i == 0) yield i
+ s.headOption.map(x => x :: apply(n / x)).getOrElse(List(n))
+ }
+ }
+
+ def main(args:Array[String]) {
+ // a prime number
+ //val num = 623456789
+ val num = 2796203
+ assert(GeneratePrimeFactorsLazy(num) == List(num))
+ }
+
+}
diff --git a/test/files/run/t3508.scala b/test/files/run/t3508.scala
new file mode 100644
index 0000000000..01d976ba0d
--- /dev/null
+++ b/test/files/run/t3508.scala
@@ -0,0 +1,11 @@
+
+
+import collection.immutable._
+
+
+// ticket #3508
+object Test {
+ def main(args: Array[String]) {
+ assert(Stream.tabulate(123)(_ + 1).toList == List.tabulate(123)(_ + 1))
+ }
+}
diff --git a/test/files/run/t3511.scala b/test/files/run/t3511.scala
new file mode 100644
index 0000000000..30757b1a66
--- /dev/null
+++ b/test/files/run/t3511.scala
@@ -0,0 +1,36 @@
+
+
+
+import scala.collection.immutable._
+
+
+// ticket #3511
+object Test {
+
+ def main(args: Array[String]) {
+ assert(Stream.from(0).view.force.take(5) == List(0, 1, 2, 3, 4))
+
+ val s = Stream.from(0)
+ val smap = s.view.map(_ * 2).force.take(5)
+ assert(smap == List(0, 2, 4, 6, 8))
+
+ val sfilter = s.view.filter(_ % 2 == 0).force.take(5)
+ assert(sfilter == List(0, 2, 4, 6, 8))
+
+ val sflatmap = s.view.flatMap(n => List(n, n * 2)).force.take(6)
+ assert(sflatmap == List(0, 0, 1, 2, 2, 4))
+
+ val stakewhile = s.view.takeWhile(_ < 10).force
+ assert(stakewhile == List.range(0, 10))
+
+ val szip = s.view.zip(s.map(_ / 2)).force.take(5)
+ assert(szip == List((0, 0), (1, 0), (2, 1), (3, 1), (4, 2)))
+
+ val szipall = s.view.zipAll(List(0, 1, 2), 0, 0).force.take(5)
+ assert(szipall == List((0, 0), (1, 1), (2, 2), (3, 0), (4, 0)))
+
+ val spatch = s.view.patch(1, List(5, 5, 5), 5).force.take(5)
+ assert(spatch == List(0, 5, 5, 5, 6))
+ }
+
+}