Skip to content

avoid early evaluation in some Stream's methods #6415

@scabug

Description

@scabug
scala> lazy val x = \{ println("evaluated"); 1 }
x: Int = <lazy>

scala> 0 #:: x #:: Stream.empty
res0: scala.collection.immutable.Stream[Int] = Stream(0, ?)

scala> res0.isDefinedAt(0)
evaluated
res1: Boolean = true

I think that It is not lazy to call GenTraversableLike#tail in LinearSeqOptimized#lengthCompare.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions