From 8b030ca4844d6a0ad67f4b47f416a7af59bddea2 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 8 May 2009 20:42:27 +0000 Subject: Further refinement of fix for #1960. --- src/compiler/scala/tools/nsc/transform/Constructors.scala | 10 +++++++--- src/library/scala/collection/immutable/PagedSeq.scala | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/compiler/scala/tools/nsc/transform/Constructors.scala b/src/compiler/scala/tools/nsc/transform/Constructors.scala index 17dbe36a8d..31ef241ac8 100644 --- a/src/compiler/scala/tools/nsc/transform/Constructors.scala +++ b/src/compiler/scala/tools/nsc/transform/Constructors.scala @@ -261,13 +261,17 @@ abstract class Constructors extends Transform { // It would be better to mangle the constructor parameter name since // it can only be used internally, but I think we need more robust name // mangling before we introduce more of it. - val parentSymbols = - Map(( for (p <- impl.parents ; sym <- p.symbol.info.nonPrivateMembers) yield sym.name -> p ): _*) + val parentSymbols = Map((for { + p <- impl.parents + if p.symbol.isTrait + sym <- p.symbol.info.nonPrivateMembers + if sym.isGetter && !sym.isOuterField + } yield sym.name -> p): _*) // Initialize all parameters fields that must be kept. val paramInits = for (acc <- paramAccessors if mustbeKept(acc)) yield { - if ((parentSymbols contains acc.name) && !(acc.name startsWith "$outer")) + if (parentSymbols contains acc.name) unit.error(acc.pos, "parameter '%s' requires field but conflicts with %s in '%s'".format( acc.name, acc.name, parentSymbols(acc.name))) diff --git a/src/library/scala/collection/immutable/PagedSeq.scala b/src/library/scala/collection/immutable/PagedSeq.scala index c63336f2da..85eca5777b 100644 --- a/src/library/scala/collection/immutable/PagedSeq.scala +++ b/src/library/scala/collection/immutable/PagedSeq.scala @@ -109,7 +109,7 @@ import PagedSeq._ * @author Martin Odersky */ class PagedSeq[T] protected (more: (Array[T], Int, Int) => Int, - first: Page[T], start: Int, end: Int) extends RandomAccessSeq[T] { + first1: Page[T], start: Int, end: Int) extends RandomAccessSeq[T] { /** A paged sequence is constructed from a method that produces more characters when asked. * The producer method is analogous to the read method in java.io.Reader. @@ -120,15 +120,15 @@ class PagedSeq[T] protected (more: (Array[T], Int, Int) => Int, */ def this(more: (Array[T], Int, Int) => Int) = this(more, new Page[T](0), 0, UndeterminedEnd) - private var current: Page[T] = first + private var current: Page[T] = first1 - private def latest = first.latest + private def latest = first1.latest private def addMore() = latest.addMore(more) private def page(absindex: Int) = { if (absindex < current.start) - current = first + current = first1 while (absindex >= current.end && current.next != null) current = current.next while (absindex >= current.end && !current.isLast) { @@ -167,7 +167,7 @@ class PagedSeq[T] protected (more: (Array[T], Int, Int) => Int, page(start) val s = start + _start val e = if (_end == UndeterminedEnd) _end else start + _end - var f = first + var f = first1 while (f.end <= s && !f.isLast) f = f.next new PagedSeq(more, f, s, e) } -- cgit v1.2.3