From cf9b7ae0867f594aba39984ac732fbd26ed12f51 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 20 Aug 2012 08:10:34 +0100 Subject: Compilespeed improvements: Exists arguments and others It turns out that exists is not inlinable, even if put into List. We try to eliminate or hoist most closures passed to exists in Types. There are some other small improvements as well. -- (@gkossakowski): This commit contains also a fix to crasher prepared by @paulp. I squashed that commit and kept the test-case that came with it. --- test/files/pos/specializes-sym-crash.scala | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/files/pos/specializes-sym-crash.scala (limited to 'test') diff --git a/test/files/pos/specializes-sym-crash.scala b/test/files/pos/specializes-sym-crash.scala new file mode 100644 index 0000000000..c46f435ac4 --- /dev/null +++ b/test/files/pos/specializes-sym-crash.scala @@ -0,0 +1,26 @@ +import scala.collection._ + +trait Foo[+A, + +Coll, + +This <: GenSeqView[A, Coll] with GenSeqViewLike[A, Coll, This]] +extends GenSeq[A] with GenSeqLike[A, This] with GenIterableView[A, Coll] with GenIterableViewLike[A, Coll, This] { +self => + + trait Transformed[+B] extends GenSeqView[B, Coll] with super.Transformed[B] { + def length: Int + def apply(idx: Int): B + override def toString = viewToString + } + trait Reversed extends Transformed[A] { + override def iterator: Iterator[A] = createReversedIterator + def length: Int = self.length + def apply(idx: Int): A = self.apply(length - 1 - idx) + final override protected[this] def viewIdentifier = "R" + + private def createReversedIterator = { + var lst = List[A]() + for (elem <- self) lst ::= elem + lst.iterator + } + } +} -- cgit v1.2.3