Skip to content

Commit b704d81

Browse files
committed
Fixes needed for new lazy val overriding rules.
1 parent 16fd18e commit b704d81

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/library/scala/collection/IterableViewLike.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ trait IterableViewLike[+A,
8383
}
8484

8585
trait ZippedI[B] extends TransformedI[(A, B)] {
86-
protected[this] val other: GenIterable[B]
86+
protected[this] lazy val other: GenIterable[B]
8787
def iterator: Iterator[(A, B)] = self.iterator zip other.iterator
8888
final override protected[this] def viewIdentifier = "Z"
8989
}
9090

9191
trait ZippedAllI[A1 >: A, B] extends TransformedI[(A1, B)] {
92-
protected[this] val other: GenIterable[B]
93-
protected[this] val thisElem: A1
94-
protected[this] val thatElem: B
92+
protected[this] lazy val other: GenIterable[B]
93+
protected[this] lazy val thisElem: A1
94+
protected[this] lazy val thatElem: B
9595
final override protected[this] def viewIdentifier = "Z"
9696
def iterator: Iterator[(A1, B)] =
9797
self.iterator.zipAll(other.iterator, thisElem, thatElem)

src/library/scala/collection/SeqViewLike.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ trait SeqViewLike[+A,
159159
// Must also take care to allow patching inside an infinite stream
160160
// (patching in an infinite stream is not okay)
161161
trait PatchedS[B >: A] extends TransformedS[B] {
162-
protected[this] val from: Int
163-
protected[this] val patch: GenSeq[B]
164-
protected[this] val replaced: Int
162+
protected[this] lazy val from: Int
163+
protected[this] lazy val patch: GenSeq[B]
164+
protected[this] lazy val replaced: Int
165165
private lazy val plen = patch.length
166166
override def iterator: Iterator[B] = self.iterator patch (from, patch.iterator, replaced)
167167
def length: Int = {
@@ -180,7 +180,7 @@ trait SeqViewLike[+A,
180180
}
181181

182182
trait PrependedS[B >: A] extends TransformedS[B] {
183-
protected[this] val fst: B
183+
protected[this] lazy val fst: B
184184
override def iterator: Iterator[B] = Iterator.single(fst) ++ self.iterator
185185
def length: Int = 1 + self.length
186186
def apply(idx: Int): B =

src/library/scala/collection/TraversableViewLike.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ trait TraversableViewLike[+A,
137137
* on it. Used for those operations which do not naturally lend themselves to a view
138138
*/
139139
trait ForcedT[B] extends TransformedT[B] {
140-
protected[this] val forced: GenSeq[B]
140+
protected[this] lazy val forced: GenSeq[B]
141141
def foreach[U](f: B => U) = forced foreach f
142142
final override protected[this] def viewIdentifier = "C"
143143
}
144144

145145
trait SlicedT extends TransformedT[A] {
146-
protected[this] val endpoints: SliceInterval
146+
protected[this] lazy val endpoints: SliceInterval
147147
protected[this] def from = endpoints.from
148148
protected[this] def until = endpoints.until
149149
// protected def newSliced(_endpoints: SliceInterval): TransformedT[A] =
@@ -163,7 +163,7 @@ trait TraversableViewLike[+A,
163163
}
164164

165165
trait MappedT[B] extends TransformedT[B] {
166-
protected[this] val mapping: A => B
166+
protected[this] lazy val mapping: A => B
167167
def foreach[U](f: B => U) {
168168
for (x <- self)
169169
f(mapping(x))
@@ -172,7 +172,7 @@ trait TraversableViewLike[+A,
172172
}
173173

174174
trait FlatMappedT[B] extends TransformedT[B] {
175-
protected[this] val mapping: A => GenTraversableOnce[B]
175+
protected[this] lazy val mapping: A => GenTraversableOnce[B]
176176
def foreach[U](f: B => U) {
177177
for (x <- self)
178178
for (y <- mapping(x).seq)
@@ -182,7 +182,7 @@ trait TraversableViewLike[+A,
182182
}
183183

184184
trait AppendedT[B >: A] extends TransformedT[B] {
185-
protected[this] val rest: GenTraversable[B]
185+
protected[this] lazy val rest: GenTraversable[B]
186186
def foreach[U](f: B => U) {
187187
self foreach f
188188
rest foreach f
@@ -191,7 +191,7 @@ trait TraversableViewLike[+A,
191191
}
192192

193193
trait FilteredT extends TransformedT[A] {
194-
protected[this] val pred: A => Boolean
194+
protected[this] lazy val pred: A => Boolean
195195
def foreach[U](f: A => U) {
196196
for (x <- self)
197197
if (pred(x)) f(x)
@@ -200,7 +200,7 @@ trait TraversableViewLike[+A,
200200
}
201201

202202
trait TakenWhileT extends TransformedT[A] {
203-
protected[this] val pred: A => Boolean
203+
protected[this] lazy val pred: A => Boolean
204204
def foreach[U](f: A => U) {
205205
for (x <- self) {
206206
if (!pred(x)) return
@@ -211,7 +211,7 @@ trait TraversableViewLike[+A,
211211
}
212212

213213
trait DroppedWhileT extends TransformedT[A] {
214-
protected[this] val pred: A => Boolean
214+
protected[this] lazy val pred: A => Boolean
215215
def foreach[U](f: A => U) {
216216
var go = false
217217
for (x <- self) {

0 commit comments

Comments
 (0)