Skip to content

Commit 07ed3f1

Browse files
committed
Revert "Avoid static initialization deadlock in run tests."
This reverts commit 8f90105.
1 parent 57a2a01 commit 07ed3f1

File tree

5 files changed

+23
-34
lines changed

5 files changed

+23
-34
lines changed

tests/run/t5375.scala

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
object Test {
1+
object Test extends dotty.runtime.LegacyApp {
22
val foos = (1 to 1000).toSeq
3-
4-
def main(args: Array[String]): Unit = {
5-
try
6-
foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i)
7-
catch {
8-
case ex: RuntimeException => println("Runtime exception")
9-
}
3+
try
4+
foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i)
5+
catch {
6+
case ex: RuntimeException => println("Runtime exception")
107
}
118
}

tests/run/t6052.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77

8-
object Test {
8+
object Test extends dotty.runtime.LegacyApp {
99
def seqarr(i: Int) = Array[Int]() ++ (0 until i)
1010
def pararr(i: Int) = seqarr(i).par
1111

@@ -15,9 +15,7 @@ object Test {
1515
assert(gseq == gpar, (gseq, gpar))
1616
}
1717

18-
def main(args: Array[String]): Unit = {
19-
for (i <- 0 until 20) check(i, _ > 0)
20-
for (i <- 0 until 20) check(i, _ % 2)
21-
for (i <- 0 until 20) check(i, _ % 4)
22-
}
18+
for (i <- 0 until 20) check(i, _ > 0)
19+
for (i <- 0 until 20) check(i, _ % 2)
20+
for (i <- 0 until 20) check(i, _ % 4)
2321
}

tests/run/t6410.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11

22

33

4-
object Test {
5-
def main(args: Array[String]): Unit = {
6-
val x = collection.parallel.mutable.ParArray.range(1,10) groupBy { _ % 2 } mapValues { _.size }
7-
println(x)
8-
val y = collection.parallel.immutable.ParVector.range(1,10) groupBy { _ % 2 } mapValues { _.size }
9-
println(y)
10-
}
4+
object Test extends dotty.runtime.LegacyApp {
5+
val x = collection.parallel.mutable.ParArray.range(1,10) groupBy { _ % 2 } mapValues { _.size }
6+
println(x)
7+
val y = collection.parallel.immutable.ParVector.range(1,10) groupBy { _ % 2 } mapValues { _.size }
8+
println(y)
119
}

tests/run/t6467.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ import collection._
66

77

88

9-
object Test {
9+
object Test extends dotty.runtime.LegacyApp {
1010

1111
def compare(s1: String, s2: String): Unit = {
1212
assert(s1 == s2, s1 + "\nvs.\n" + s2)
1313
}
1414

15-
def main(args: Array[String]): Unit = {
16-
compare(List(1, 2, 3, 4).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234")
17-
compare(List(1, 2, 3, 4).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234")
18-
compare(Seq(0 until 100: _*).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString)
19-
compare(Seq(0 until 100: _*).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString)
20-
}
15+
compare(List(1, 2, 3, 4).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234")
16+
compare(List(1, 2, 3, 4).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, "1234")
17+
compare(Seq(0 until 100: _*).aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString)
18+
compare(Seq(0 until 100: _*).par.aggregate(new java.lang.StringBuffer)(_ append _, _ append _).toString, (0 until 100).mkString)
2119

2220
}

tests/run/t7498.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55

66

77

8-
object Test {
8+
object Test extends dotty.runtime.LegacyApp {
99
import scala.collection.concurrent.TrieMap
1010

1111
class Collision(val idx: Int) {
1212
override def hashCode = idx % 10
1313
}
1414

15-
def main(args: Array[String]): Unit = {
16-
val tm = TrieMap[Collision, Unit]()
17-
for (i <- 0 until 1000) tm(new Collision(i)) = ()
15+
val tm = TrieMap[Collision, Unit]()
16+
for (i <- 0 until 1000) tm(new Collision(i)) = ()
1817

19-
tm.par.foreach(kv => ())
20-
}
18+
tm.par.foreach(kv => ())
2119
}
2220

0 commit comments

Comments
 (0)