Skip to content

Commit ae41dfd

Browse files
committed
fixup! fixup! Backport LazyList
fix LazyListTest
1 parent 49dc7d1 commit ae41dfd

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

compat/src/main/scala-2.11_2.12/scala/collection/compat/immutable/LazyList.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,7 @@ object LazyList extends SeqFactory[LazyList] {
11801180
/** Construct a LazyList consisting of a given first element followed by elements
11811181
* from another LazyList.
11821182
*/
1183+
// def #::[B >: A](elem: => B): LazyList[B] = newLL(sCons(elem, l()))
11831184
def #::[B >: A](elem: B): LazyList[B] = newLL(sCons(elem, l()))
11841185

11851186
/** Construct a LazyList consisting of the concatenation of the given LazyList and

compat/src/test/scala/test/scala/collection/LazyListTest.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ class LazyListTest {
5252
assertEquals(LazyList(None, Some(1)), LazyList(None) #::: LazyList(Some(1)))
5353
}
5454

55-
@Test
56-
def testLazyListDoesNotForceHead: Unit = {
55+
@Test
56+
def testLazyListDoesNotForceHead: Unit = {
5757
var i = 0
5858
def f: Int = { i += 1; i }
59-
val s = LazyList.empty.#::(f).#::(f).#::(f)
59+
// val s = LazyList.empty.#::(f).#::(f).#::(f)
60+
val s = LazyList.empty.#::(f).#::(f).#::(f).#:::(LazyList.empty)
6061
assertEquals(0, i)
61-
}
62+
}
6263

6364
@Test
6465
def testEmptyLazyListToString(): Unit = {
@@ -214,7 +215,8 @@ class LazyListTest {
214215

215216
var lazeCount = 0
216217
def lazeL(i: Int) = { lazeCount += 1; i }
217-
val xs21 = lazeL(1) #:: lazeL(2) #:: lazeL(3) #:: LazyList.empty
218+
// val xs21 = lazeL(1) #:: lazeL(2) #:: lazeL(3) #:: LazyList.empty
219+
val xs21 = LazyList.empty #::: lazeL(1) #:: lazeL(2) #:: lazeL(3) #:: LazyList.empty
218220

219221
assertEquals(0, lazeCount)
220222
}

0 commit comments

Comments
 (0)