Skip to content

Commit b671365

Browse files
committed
SI-9888. Prevent OOM on ParRange. Improve toString.
1 parent 27476f2 commit b671365

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

src/library/scala/collection/parallel/immutable/ParRange.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ self =>
107107
}
108108
}
109109

110+
override def toString = s"Par$range"
110111
}
111112

112113
object ParRange {

test/files/jvm/serialization-new.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,12 @@ x = ParHashSet(1, 2, 3)
268268
y = ParHashSet(1, 2, 3)
269269
x equals y: true, y equals x: true
270270

271-
x = ParRange(0, 1, 2, 3, 4)
272-
y = ParRange(0, 1, 2, 3, 4)
271+
x = ParRange 0 to 4
272+
y = ParRange 0 to 4
273273
x equals y: true, y equals x: true
274274

275-
x = ParRange(0, 1, 2, 3)
276-
y = ParRange(0, 1, 2, 3)
275+
x = ParRange 0 until 4
276+
y = ParRange 0 until 4
277277
x equals y: true, y equals x: true
278278

279279
x = ParMap(5 -> 1, 10 -> 2)

test/files/jvm/serialization.check

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,12 @@ x = ParHashSet(1, 2, 3)
268268
y = ParHashSet(1, 2, 3)
269269
x equals y: true, y equals x: true
270270

271-
x = ParRange(0, 1, 2, 3, 4)
272-
y = ParRange(0, 1, 2, 3, 4)
271+
x = ParRange 0 to 4
272+
y = ParRange 0 to 4
273273
x equals y: true, y equals x: true
274274

275-
x = ParRange(0, 1, 2, 3)
276-
y = ParRange(0, 1, 2, 3)
275+
x = ParRange 0 until 4
276+
y = ParRange 0 until 4
277277
x equals y: true, y equals x: true
278278

279279
x = ParMap(5 -> 1, 10 -> 2)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package scala.collection.parallel.immutable
2+
3+
import org.junit.runner.RunWith
4+
import org.junit.runners.JUnit4
5+
import org.junit.Test
6+
7+
@RunWith(classOf[JUnit4])
8+
class ParRangeTest {
9+
10+
@Test
11+
def buildParRangeString {
12+
assert(ParRange(1, 5, 1, true).toString == "ParRange 1 to 5")
13+
}
14+
15+
}

0 commit comments

Comments
 (0)