File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
main/scala-2.11_2.12/scala/collection/compat/immutable
test/scala/test/scala/collection Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -365,7 +365,7 @@ final class LazyList[+A] private (private[this] var lazyState: () => LazyList.St
365365 newLL {
366366 if (isEmpty) suffix match {
367367 case lazyList : LazyList [B ] => lazyList.state // don't recompute the LazyList
368- case _ => stateFromIterator(suffix .toIterator)
368+ case coll => stateFromIterator(coll .toIterator)
369369 } else sCons(head, tail lazyAppendedAll suffix)
370370 }
371371
Original file line number Diff line number Diff line change @@ -376,4 +376,12 @@ class LazyListTest {
376376 assertNoStackOverflow((new L ).a)
377377 assertNoStackOverflow((new L ).b)
378378 }
379+
380+ // scala/bug#11931
381+ @ Test
382+ def lazyAppendedAllExecutesOnce (): Unit = {
383+ var count = 0
384+ LazyList (1 ).lazyAppendedAll({ count += 1 ; Seq (2 )}).toList
385+ assertEquals(1 , count)
386+ }
379387}
You can’t perform that action at this time.
0 commit comments