Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/library/scala/Array.scala
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ object Array {

var n = 0
var i = start
while (if (step < 0) end < i else i < end) {
while (n < array.length) {
array(n) = i
i += step
n += 1
Expand Down
5 changes: 5 additions & 0 deletions test/junit/scala/ArrayTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.junit.Assert.{ assertArrayEquals, assertFalse, assertTrue }
import org.junit.Test

import scala.runtime.BoxedUnit
import scala.tools.testkit.AssertUtil._
import scala.util.chaining._

class ArrayTest {
Expand Down Expand Up @@ -49,4 +50,8 @@ class ArrayTest {
assertTrue("Arrays of String", Array.equals(Array[AnyRef]("hello, world"), Array[AnyRef]("hello, world")))
assertFalse("Arrays of String", Array.equals(Array[AnyRef]("hello, world"), Array[AnyRef]("goodbye, cruel world")))
}

@Test def `i24877 range throws on naive step`: Unit = {
assertSameElements(Array[Int](27), Array.range(27, 42, Int.MaxValue))
}
}