Skip to content

Commit da316c4

Browse files
committed
Expression for all zero bits
`null.asInstanceOf[A]` is more kosher than `0`. It doesn't matter here because the value is never used and is always re-assigned. It's too bad someone started accusing `var x: A = _` of undue ugliness. That remains the best expression of non-assignment.
1 parent 11c18aa commit da316c4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/src/scala/collection/IterableOnce.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A] =>
723723
throw new UnsupportedOperationException("empty.reduceLeft")
724724

725725
var first = true
726-
var acc: B = 0.asInstanceOf[B]
726+
var acc: B = null.asInstanceOf[B]
727727

728728
while (it.hasNext) {
729729
val x = it.next()

0 commit comments

Comments
 (0)