From 2e725908c3bd340daf140906885fdb43fba13a0f Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 27 Jul 2016 14:22:59 +0200 Subject: Fix problem related to cbn parameters in supercalls The closures generated by elimByName did not get the InSuperCall flag set. This caused problems in lambda lift which led to a verify error for the new version CollectionStrawMan6. That version replaces explicit function parameters in class LazyList by by-name parameters. Also: Clarify logic for liftLocals in LambdaLift (liftLocals caused the immediate problem but was in the end not to blame). --- tests/run/colltest6/CollectionStrawMan6_1.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/run/colltest6') diff --git a/tests/run/colltest6/CollectionStrawMan6_1.scala b/tests/run/colltest6/CollectionStrawMan6_1.scala index f4d5e006b..5889782d6 100644 --- a/tests/run/colltest6/CollectionStrawMan6_1.scala +++ b/tests/run/colltest6/CollectionStrawMan6_1.scala @@ -562,14 +562,14 @@ object CollectionStrawMan6 extends LowPriority { override def className = "ArrayBufferView" } - class LazyList[+A](expr: () => LazyList.Evaluated[A]) + class LazyList[+A](expr: => LazyList.Evaluated[A]) extends LinearSeq[A] with SeqLike[A, LazyList] { self => private[this] var evaluated = false private[this] var result: LazyList.Evaluated[A] = _ def force: LazyList.Evaluated[A] = { if (!evaluated) { - result = expr() + result = expr evaluated = true } result @@ -579,7 +579,7 @@ object CollectionStrawMan6 extends LowPriority { override def head = force.get._1 override def tail = force.get._2 - def #:: [B >: A](elem: => B): LazyList[B] = new LazyList(() => Some((elem, self))) + def #:: [B >: A](elem: => B): LazyList[B] = new LazyList(Some((elem, self))) def fromIterable[B](c: Iterable[B]): LazyList[B] = LazyList.fromIterable(c) @@ -600,10 +600,10 @@ object CollectionStrawMan6 extends LowPriority { def fromIterable[B](coll: Iterable[B]): LazyList[B] = coll match { case coll: LazyList[B] => coll - case _ => new LazyList(() => if (coll.isEmpty) None else Some((coll.head, fromIterable(coll.tail)))) + case _ => new LazyList(if (coll.isEmpty) None else Some((coll.head, fromIterable(coll.tail)))) } - object Empty extends LazyList[Nothing](() => None) + object Empty extends LazyList[Nothing](None) object #:: { def unapply[A](s: LazyList[A]): Evaluated[A] = s.force -- cgit v1.2.3