summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/concurrent-map-conversions.scala36
-rw-r--r--test/files/run/ctries/concmap.scala24
-rw-r--r--test/files/run/ctries/iterator.scala20
-rw-r--r--test/files/run/ctries/lnode.scala14
-rw-r--r--test/files/run/ctries/snapshot.scala26
-rw-r--r--test/files/run/finalvar.check6
-rw-r--r--test/files/run/finalvar.flags1
-rw-r--r--test/files/run/finalvar.scala37
-rw-r--r--test/files/run/is-valid-num.scala77
-rw-r--r--test/files/run/lift-and-unlift.scala6
-rw-r--r--test/files/run/numbereq.scala35
-rw-r--r--test/files/run/option-fold.check5
-rw-r--r--test/files/run/option-fold.scala19
-rw-r--r--test/files/run/t5614.check3
-rw-r--r--test/files/run/t5614.flags1
-rw-r--r--test/files/run/t5614.scala5
16 files changed, 268 insertions, 47 deletions
diff --git a/test/files/run/concurrent-map-conversions.scala b/test/files/run/concurrent-map-conversions.scala
new file mode 100644
index 0000000000..0350b69642
--- /dev/null
+++ b/test/files/run/concurrent-map-conversions.scala
@@ -0,0 +1,36 @@
+
+
+
+
+
+object Test {
+
+ def main(args: Array[String]) {
+ testConversions()
+ testConverters()
+ }
+
+ def needPackageConcurrentMap(map: collection.concurrent.Map[Int, Int]) {
+ }
+ def needJavaConcurrent(map: java.util.concurrent.ConcurrentMap[Int, Int]) {
+ }
+
+ def testConversions() {
+ import collection.JavaConversions._
+ val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int]
+ val ctrie = new collection.concurrent.TrieMap[Int, Int]
+
+ needPackageConcurrentMap(skiplist)
+ needJavaConcurrent(ctrie)
+ }
+
+ def testConverters() {
+ import collection.JavaConverters._
+ val skiplist = new java.util.concurrent.ConcurrentSkipListMap[Int, Int]
+ val ctrie = new collection.concurrent.TrieMap[Int, Int]
+
+ needPackageConcurrentMap(skiplist.asScala)
+ needJavaConcurrent(ctrie.asJava)
+ }
+
+}
diff --git a/test/files/run/ctries/concmap.scala b/test/files/run/ctries/concmap.scala
index bf8cc9d12f..3ec0256afb 100644
--- a/test/files/run/ctries/concmap.scala
+++ b/test/files/run/ctries/concmap.scala
@@ -1,7 +1,7 @@
-import collection.mutable.ConcurrentTrieMap
+import collection.concurrent.TrieMap
object ConcurrentMapSpec extends Spec {
@@ -11,13 +11,13 @@ object ConcurrentMapSpec extends Spec {
def test() {
"support put" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) assert(ct.put(new Wrap(i), i) == None)
for (i <- 0 until initsz) assert(ct.put(new Wrap(i), -i) == Some(i))
}
"support put if absent" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
for (i <- 0 until initsz) assert(ct.putIfAbsent(new Wrap(i), -i) == Some(i))
for (i <- 0 until initsz) assert(ct.putIfAbsent(new Wrap(i), -i) == Some(i))
@@ -26,7 +26,7 @@ object ConcurrentMapSpec extends Spec {
}
"support remove if mapped to a specific value" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), -i - 1) == false)
for (i <- 0 until initsz) assert(ct.remove(new Wrap(i), i) == true)
@@ -34,7 +34,7 @@ object ConcurrentMapSpec extends Spec {
}
"support replace if mapped to a specific value" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), -i - 1, -i - 2) == false)
for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i, -i - 2) == true)
@@ -43,7 +43,7 @@ object ConcurrentMapSpec extends Spec {
}
"support replace if present" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until initsz) ct.update(new Wrap(i), i)
for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), -i) == Some(i))
for (i <- 0 until initsz) assert(ct.replace(new Wrap(i), i) == Some(-i))
@@ -56,7 +56,7 @@ object ConcurrentMapSpec extends Spec {
}
"support replace if mapped to a specific value, using several threads" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
val sz = 55000
for (i <- 0 until sz) ct.update(new Wrap(i), i)
@@ -89,7 +89,7 @@ object ConcurrentMapSpec extends Spec {
}
"support put if absent, several threads" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
val sz = 110000
class Updater(offs: Int) extends Thread {
@@ -110,7 +110,7 @@ object ConcurrentMapSpec extends Spec {
}
"support remove if mapped to a specific value, several threads" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
val sz = 55000
for (i <- 0 until sz) ct.update(new Wrap(i), i)
@@ -132,7 +132,7 @@ object ConcurrentMapSpec extends Spec {
}
"have all or none of the elements depending on the oddity" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
val sz = 65000
for (i <- 0 until sz) ct(new Wrap(i)) = i
@@ -165,7 +165,7 @@ object ConcurrentMapSpec extends Spec {
}
"compute size correctly" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
val sz = 36450
for (i <- 0 until sz) ct(new Wrap(i)) = i
@@ -174,7 +174,7 @@ object ConcurrentMapSpec extends Spec {
}
"compute size correctly in parallel" in {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
val sz = 36450
for (i <- 0 until sz) ct(new Wrap(i)) = i
val pct = ct.par
diff --git a/test/files/run/ctries/iterator.scala b/test/files/run/ctries/iterator.scala
index dbfab6b8a9..b953a40e00 100644
--- a/test/files/run/ctries/iterator.scala
+++ b/test/files/run/ctries/iterator.scala
@@ -3,7 +3,7 @@
import collection._
-import collection.mutable.ConcurrentTrieMap
+import collection.concurrent.TrieMap
@@ -11,7 +11,7 @@ object IteratorSpec extends Spec {
def test() {
"work for an empty trie" in {
- val ct = new ConcurrentTrieMap
+ val ct = new TrieMap
val it = ct.iterator
it.hasNext shouldEqual (false)
@@ -19,7 +19,7 @@ object IteratorSpec extends Spec {
}
def nonEmptyIteratorCheck(sz: Int) {
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
val it = ct.iterator
@@ -84,7 +84,7 @@ object IteratorSpec extends Spec {
}
def nonEmptyCollideCheck(sz: Int) {
- val ct = new ConcurrentTrieMap[DumbHash, Int]
+ val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until sz) ct.put(new DumbHash(i), i)
val it = ct.iterator
@@ -144,7 +144,7 @@ object IteratorSpec extends Spec {
val W = 15
val S = 5
val checks = 5
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
class Modifier extends Thread {
@@ -156,7 +156,7 @@ object IteratorSpec extends Spec {
}
}
- def consistentIteration(ct: ConcurrentTrieMap[Wrap, Int], checks: Int) {
+ def consistentIteration(ct: TrieMap[Wrap, Int], checks: Int) {
class Iter extends Thread {
override def run() {
val snap = ct.readOnlySnapshot()
@@ -185,7 +185,7 @@ object IteratorSpec extends Spec {
val sgroupsize = 10
val sgroupnum = 5
val removerslowdown = 50
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
class Remover extends Thread {
@@ -227,7 +227,7 @@ object IteratorSpec extends Spec {
val sgroupsize = 10
val sgroupnum = 10
val inserterslowdown = 50
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
class Inserter extends Thread {
override def run() {
@@ -265,7 +265,7 @@ object IteratorSpec extends Spec {
"work on a yet unevaluated snapshot" in {
val sz = 50000
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.update(new Wrap(i), i)
val snap = ct.snapshot()
@@ -276,7 +276,7 @@ object IteratorSpec extends Spec {
"be duplicated" in {
val sz = 50
- val ct = collection.parallel.mutable.ParConcurrentTrieMap((0 until sz) zip (0 until sz): _*)
+ val ct = collection.parallel.mutable.ParTrieMap((0 until sz) zip (0 until sz): _*)
val it = ct.splitter
for (_ <- 0 until (sz / 2)) it.next()
val dupit = it.dup
diff --git a/test/files/run/ctries/lnode.scala b/test/files/run/ctries/lnode.scala
index e480795956..92a31088e5 100644
--- a/test/files/run/ctries/lnode.scala
+++ b/test/files/run/ctries/lnode.scala
@@ -1,7 +1,7 @@
-import collection.mutable.ConcurrentTrieMap
+import collection.concurrent.TrieMap
object LNodeSpec extends Spec {
@@ -11,19 +11,19 @@ object LNodeSpec extends Spec {
def test() {
"accept elements with the same hash codes" in {
- val ct = new ConcurrentTrieMap[DumbHash, Int]
+ val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
}
"lookup elements with the same hash codes" in {
- val ct = new ConcurrentTrieMap[DumbHash, Int]
+ val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
for (i <- 0 until initsz) assert(ct.get(new DumbHash(i)) == Some(i))
for (i <- initsz until secondsz) assert(ct.get(new DumbHash(i)) == None)
}
"remove elements with the same hash codes" in {
- val ct = new ConcurrentTrieMap[DumbHash, Int]
+ val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.update(new DumbHash(i), i)
for (i <- 0 until initsz) {
val remelem = ct.remove(new DumbHash(i))
@@ -33,7 +33,7 @@ object LNodeSpec extends Spec {
}
"put elements with the same hash codes if absent" in {
- val ct = new ConcurrentTrieMap[DumbHash, Int]
+ val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) ct.put(new DumbHash(i), i)
for (i <- 0 until initsz) assert(ct.lookup(new DumbHash(i)) == i)
for (i <- 0 until initsz) assert(ct.putIfAbsent(new DumbHash(i), i) == Some(i))
@@ -42,7 +42,7 @@ object LNodeSpec extends Spec {
}
"replace elements with the same hash codes" in {
- val ct = new ConcurrentTrieMap[DumbHash, Int]
+ val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None)
for (i <- 0 until initsz) assert(ct.lookup(new DumbHash(i)) == i)
for (i <- 0 until initsz) assert(ct.replace(new DumbHash(i), -i) == Some(i))
@@ -51,7 +51,7 @@ object LNodeSpec extends Spec {
}
"remove elements with the same hash codes if mapped to a specific value" in {
- val ct = new ConcurrentTrieMap[DumbHash, Int]
+ val ct = new TrieMap[DumbHash, Int]
for (i <- 0 until initsz) assert(ct.put(new DumbHash(i), i) == None)
for (i <- 0 until initsz) assert(ct.remove(new DumbHash(i), i) == true)
}
diff --git a/test/files/run/ctries/snapshot.scala b/test/files/run/ctries/snapshot.scala
index 3c816130b3..5fe77d445b 100644
--- a/test/files/run/ctries/snapshot.scala
+++ b/test/files/run/ctries/snapshot.scala
@@ -3,7 +3,7 @@
import collection._
-import collection.mutable.ConcurrentTrieMap
+import collection.concurrent.TrieMap
@@ -11,11 +11,11 @@ object SnapshotSpec extends Spec {
def test() {
"support snapshots" in {
- val ctn = new ConcurrentTrieMap
+ val ctn = new TrieMap
ctn.snapshot()
ctn.readOnlySnapshot()
- val ct = new ConcurrentTrieMap[Int, Int]
+ val ct = new TrieMap[Int, Int]
for (i <- 0 until 100) ct.put(i, i)
ct.snapshot()
ct.readOnlySnapshot()
@@ -24,7 +24,7 @@ object SnapshotSpec extends Spec {
"empty 2 quiescent snapshots in isolation" in {
val sz = 4000
- class Worker(trie: ConcurrentTrieMap[Wrap, Int]) extends Thread {
+ class Worker(trie: TrieMap[Wrap, Int]) extends Thread {
override def run() {
for (i <- 0 until sz) {
assert(trie.remove(new Wrap(i)) == Some(i))
@@ -35,7 +35,7 @@ object SnapshotSpec extends Spec {
}
}
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct.put(new Wrap(i), i)
val snapt = ct.snapshot()
@@ -96,7 +96,7 @@ object SnapshotSpec extends Spec {
}
// traverses the trie `rep` times and modifies each entry
- class Modifier(trie: ConcurrentTrieMap[Wrap, Int], index: Int, rep: Int, sz: Int) extends Thread {
+ class Modifier(trie: TrieMap[Wrap, Int], index: Int, rep: Int, sz: Int) extends Thread {
setName("Modifier %d".format(index))
override def run() {
@@ -110,7 +110,7 @@ object SnapshotSpec extends Spec {
}
// removes all the elements from the trie
- class Remover(trie: ConcurrentTrieMap[Wrap, Int], index: Int, totremovers: Int, sz: Int) extends Thread {
+ class Remover(trie: TrieMap[Wrap, Int], index: Int, totremovers: Int, sz: Int) extends Thread {
setName("Remover %d".format(index))
override def run() {
@@ -123,7 +123,7 @@ object SnapshotSpec extends Spec {
val N = 100
val W = 10
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val readonly = ct.readOnlySnapshot()
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
@@ -141,7 +141,7 @@ object SnapshotSpec extends Spec {
val W = 100
val S = 5000
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Remover(ct, i, W, sz)
@@ -156,7 +156,7 @@ object SnapshotSpec extends Spec {
val W = 10
val S = 7000
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
@@ -165,7 +165,7 @@ object SnapshotSpec extends Spec {
threads.foreach(_.join())
}
- def consistentNonReadOnly(name: String, trie: ConcurrentTrieMap[Wrap, Int], sz: Int, N: Int) {
+ def consistentNonReadOnly(name: String, trie: TrieMap[Wrap, Int], sz: Int, N: Int) {
@volatile var e: Exception = null
// reads possible entries once and stores them
@@ -223,7 +223,7 @@ object SnapshotSpec extends Spec {
val W = 10
val S = 400
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
val threads = for (i <- 0 until W) yield new Modifier(ct, i, N, sz)
@@ -241,7 +241,7 @@ object SnapshotSpec extends Spec {
val S = 10
val modifytimes = 1200
val snaptimes = 600
- val ct = new ConcurrentTrieMap[Wrap, Int]
+ val ct = new TrieMap[Wrap, Int]
for (i <- 0 until sz) ct(new Wrap(i)) = i
class Snapshooter extends Thread {
diff --git a/test/files/run/finalvar.check b/test/files/run/finalvar.check
new file mode 100644
index 0000000000..2496293972
--- /dev/null
+++ b/test/files/run/finalvar.check
@@ -0,0 +1,6 @@
+(2,2,2,2,1)
+(2,2,2,2)
+(2,2,2,2,1001)
+(2,2,2,2)
+2
+10
diff --git a/test/files/run/finalvar.flags b/test/files/run/finalvar.flags
new file mode 100644
index 0000000000..aee3039bec
--- /dev/null
+++ b/test/files/run/finalvar.flags
@@ -0,0 +1 @@
+-Yoverride-vars -Yinline \ No newline at end of file
diff --git a/test/files/run/finalvar.scala b/test/files/run/finalvar.scala
new file mode 100644
index 0000000000..010813e520
--- /dev/null
+++ b/test/files/run/finalvar.scala
@@ -0,0 +1,37 @@
+object Final {
+ class X(final var x: Int) { }
+ def f = new X(0).x += 1
+}
+
+class A {
+ var x = 1
+ def y0 = x
+ def y1 = this.x
+ def y2 = (this: A).x
+}
+
+class B extends A {
+ override def x = 2
+ def z = super.x
+}
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ Final.f
+ val a = new B
+ println((a.x, a.y0, a.y1, a.y2, a.z))
+ val a0: A = a
+ println((a0.x, a0.y0, a0.y1, a0.y2))
+ a.x = 1001
+ println((a.x, a.y0, a.y1, a.y2, a.z))
+ println((a0.x, a0.y0, a0.y1, a0.y2))
+
+ val d = new D
+ println(d.w)
+ d.ten
+ println(d.w)
+ }
+}
+
+class C { var w = 1 ; def ten = this.w = 10 }
+class D extends C { override var w = 2 } \ No newline at end of file
diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala
index f919a21dee..9c43e98911 100644
--- a/test/files/run/is-valid-num.scala
+++ b/test/files/run/is-valid-num.scala
@@ -1,11 +1,15 @@
object Test {
def x = BigInt("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
def y = BigDecimal("" + (Short.MaxValue + 1) + ".0")
+ def y1 = BigDecimal("0.1")
+ def y2 = BigDecimal("0.5")
def l1 = Int.MaxValue.toLong + 1
def l2 = Int.MinValue.toLong - 1
def main(args: Array[String]): Unit = {
+ assert(!x.isValidDouble, x)
+ assert(!x.isValidFloat, x)
assert(!x.isValidLong, x)
assert(!x.isValidInt, x)
assert(!x.isValidChar, x)
@@ -13,8 +17,81 @@ object Test {
assert(!y.isValidShort, y)
assert(y.isValidChar, y)
assert(y.isValidInt, y)
+ assert(y.isValidFloat, y)
+ assert(y.isValidDouble, y)
+ assert(!y1.isValidLong, y1)
+ assert(!y1.isValidFloat, y1)
+ assert(!y1.isValidDouble, y1)
+ assert(!y2.isValidLong, y2)
+ assert(y2.isValidFloat, y2)
+ assert(y2.isValidDouble, y2)
+
+ testBigIntIsFloat()
+ testBigIntIsDouble()
assert(!l1.isValidInt && (l1 - 1).isValidInt, l1)
assert(!l2.isValidInt && (l2 + 1).isValidInt, l2)
}
+
+ def biExp2(e: Int) = BigInt(1) << e
+
+ def testBigIntIsFloat() {
+ val prec = 24
+ def checkFloatT(x: BigInt) = {
+ assert(x.isValidFloat, x)
+ assert((-x).isValidFloat, -x)
+ }
+ def checkFloatF(x: BigInt) = {
+ assert(!x.isValidFloat, x)
+ assert(!(-x).isValidFloat, -x)
+ }
+ checkFloatT(biExp2(prec) - 1)
+ checkFloatT(biExp2(prec))
+ checkFloatF(biExp2(prec) + 1)
+ checkFloatT(biExp2(prec) + 2)
+ checkFloatT(biExp2(prec) - 2)
+ checkFloatF(biExp2(prec + 1) - 1)
+ checkFloatT(biExp2(prec + 1))
+ checkFloatF(biExp2(prec + 1) + 1)
+ checkFloatF(biExp2(prec + 1) + 2)
+ checkFloatF(biExp2(prec + 1) + 3)
+ checkFloatT(biExp2(prec + 1) + 4)
+ checkFloatT(biExp2(64))
+ checkFloatF(biExp2(64) + biExp2(64 - prec))
+ checkFloatT(biExp2(64) + biExp2(64 - prec + 1))
+ checkFloatT(biExp2(127))
+ checkFloatT(biExp2(128) - biExp2(128 - prec))
+ checkFloatF(biExp2(128) - biExp2(128 - prec - 1))
+ checkFloatF(biExp2(128))
+ }
+
+ def testBigIntIsDouble() {
+ val prec = 53
+ def checkDoubleT(x: BigInt) = {
+ assert(x.isValidDouble, x)
+ assert((-x).isValidDouble, -x)
+ }
+ def checkDoubleF(x: BigInt) = {
+ assert(!x.isValidDouble, x)
+ assert(!(-x).isValidDouble, -x)
+ }
+ checkDoubleT(biExp2(prec) - 1)
+ checkDoubleT(biExp2(prec))
+ checkDoubleF(biExp2(prec) + 1)
+ checkDoubleT(biExp2(prec) + 2)
+ checkDoubleT(biExp2(prec + 1) - 2)
+ checkDoubleF(biExp2(prec + 1) - 1)
+ checkDoubleT(biExp2(prec + 1))
+ checkDoubleF(biExp2(prec + 1) + 1)
+ checkDoubleF(biExp2(prec + 1) + 2)
+ checkDoubleF(biExp2(prec + 1) + 3)
+ checkDoubleT(biExp2(prec + 1) + 4)
+ checkDoubleT(biExp2(64))
+ checkDoubleF(biExp2(64) + biExp2(64 - prec))
+ checkDoubleT(biExp2(64) + biExp2(64 - prec + 1))
+ checkDoubleT(biExp2(1023))
+ checkDoubleT(biExp2(1024) - biExp2(1024 - prec))
+ checkDoubleF(biExp2(1024) - biExp2(1024 - prec - 1))
+ checkDoubleF(biExp2(1024))
+ }
}
diff --git a/test/files/run/lift-and-unlift.scala b/test/files/run/lift-and-unlift.scala
index b944c70155..a4a5d9502e 100644
--- a/test/files/run/lift-and-unlift.scala
+++ b/test/files/run/lift-and-unlift.scala
@@ -2,7 +2,7 @@ import Function.unlift
object Test {
def evens1(x: Int) = if (x % 2 == 0) Some(x) else None
- def evens2: PartialFunction[Int, Int] = {
+ val evens2: PartialFunction[Int, Int] = {
case x if x % 2 == 0 => x
}
@@ -21,7 +21,7 @@ object Test {
})
assert(f1 eq f3.lift)
- // Hmm, why is this not true:
- // assert(f2 eq f4.lift)
+ assert(f4 eq unlift(f2))
+ assert(f4 eq evens2)
}
}
diff --git a/test/files/run/numbereq.scala b/test/files/run/numbereq.scala
index 77a217df36..a1f11da205 100644
--- a/test/files/run/numbereq.scala
+++ b/test/files/run/numbereq.scala
@@ -16,7 +16,20 @@ object Test {
base ::: extras
}
-
+
+ def mkNumbers(x: BigInt): List[AnyRef] = {
+ List(
+ List(BigDecimal(x, java.math.MathContext.UNLIMITED)),
+ List(x),
+ if (x.isValidDouble) List(new java.lang.Double(x.toDouble)) else Nil,
+ if (x.isValidFloat) List(new java.lang.Float(x.toFloat)) else Nil,
+ if (x.isValidLong) List(new java.lang.Long(x.toLong)) else Nil,
+ if (x.isValidInt) List(new java.lang.Integer(x.toInt)) else Nil,
+ if (x.isValidShort) List(new java.lang.Short(x.toShort)) else Nil,
+ if (x.isValidByte) List(new java.lang.Byte(x.toByte)) else Nil,
+ if (x.isValidChar) List(new java.lang.Character(x.toChar)) else Nil
+ ).flatten
+ }
def main(args: Array[String]): Unit = {
val ints = (0 to 15).toList map (Short.MinValue >> _)
@@ -37,5 +50,23 @@ object Test {
assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
assert(x.## == y.##, "%s != %s".format(x.getClass, y.getClass))
}
+
+ val bigInts = (0 to 1024).toList map (BigInt(-1) << _)
+ val bigInts2 = bigInts map (x => -x)
+ val bigInts3 = bigInts map (_ + 1)
+ val bigInts4 = bigInts2 map (_ - 1)
+
+ val setneg1b = bigInts map mkNumbers
+ val setneg2b = bigInts3 map mkNumbers
+ val setpos1b = bigInts2 map mkNumbers
+ val setpos2b = bigInts4 map mkNumbers
+
+ val sets2 = setneg1 ++ setneg1b ++ setneg2 ++ setneg2b ++ List(zero) ++ setpos1 ++ setpos1b ++ setpos2 ++ setpos2b
+
+ for (set <- sets2 ; x <- set ; y <- set) {
+// println("'%s' == '%s' (%s == %s) (%s == %s)".format(x, y, x.hashCode, y.hashCode, x.##, y.##))
+ assert(x == y, "%s/%s != %s/%s".format(x, x.getClass, y, y.getClass))
+// assert(x.## == y.##, "%s != %s".format(x.getClass, y.getClass)) Disable until Double.## is fixed (SI-5640)
+ }
}
-} \ No newline at end of file
+}
diff --git a/test/files/run/option-fold.check b/test/files/run/option-fold.check
new file mode 100644
index 0000000000..4e3fe99f98
--- /dev/null
+++ b/test/files/run/option-fold.check
@@ -0,0 +1,5 @@
+List()
+List(5)
+-1
+0
+1
diff --git a/test/files/run/option-fold.scala b/test/files/run/option-fold.scala
new file mode 100644
index 0000000000..d554ba4f9b
--- /dev/null
+++ b/test/files/run/option-fold.scala
@@ -0,0 +1,19 @@
+object Test {
+ sealed class A
+ case object B extends A
+ case class C(x: Int) extends A
+
+ def f[T](x: Option[T]) = x.fold(List.empty[T])(List(_))
+ def g(x: Option[A]) = x.fold(-1) {
+ case B => 0
+ case C(x) => x
+ }
+
+ def main(args: Array[String]): Unit = {
+ println(f(None))
+ println(f(Some(5)))
+ println(g(None))
+ println(g(Some(B)))
+ println(g(Some(C(1))))
+ }
+}
diff --git a/test/files/run/t5614.check b/test/files/run/t5614.check
new file mode 100644
index 0000000000..f659f2da3b
--- /dev/null
+++ b/test/files/run/t5614.check
@@ -0,0 +1,3 @@
+3
+a
+b
diff --git a/test/files/run/t5614.flags b/test/files/run/t5614.flags
new file mode 100644
index 0000000000..48fd867160
--- /dev/null
+++ b/test/files/run/t5614.flags
@@ -0,0 +1 @@
+-Xexperimental
diff --git a/test/files/run/t5614.scala b/test/files/run/t5614.scala
new file mode 100644
index 0000000000..7c85c33f12
--- /dev/null
+++ b/test/files/run/t5614.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ val str = s"a\nb"
+ println(str.length)
+ println(str)
+}