From f7ab13b08e085c3bf94d857fc9648ee724e4cb08 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 9 May 2009 03:37:22 +0000 Subject: finitized an infinite loop in sameElements --- .../scala/collection/generic/LinearSequenceTemplate.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/library/scala/collection/generic/LinearSequenceTemplate.scala b/src/library/scala/collection/generic/LinearSequenceTemplate.scala index 30c2b92382..764f33651e 100644 --- a/src/library/scala/collection/generic/LinearSequenceTemplate.scala +++ b/src/library/scala/collection/generic/LinearSequenceTemplate.scala @@ -277,9 +277,12 @@ trait LinearSequenceTemplate[+A, +This <: LinearSequenceTemplate[A, This] with L */ override def sameElements[B >: A](that: Iterable[B]): Boolean = that match { case that1: LinearSequence[_] => - val these = this - val those = that1 - while (!these.isEmpty && !those.isEmpty && these.head == those.head) {} + var these = this + var those = that1 + while (!these.isEmpty && !those.isEmpty && these.head == those.head) { + these = these.tail + those = those.tail + } these.isEmpty && those.isEmpty case _ => super.sameElements(that) } -- cgit v1.2.3