diff options
author | Paul Phillips <paulp@improving.org> | 2013-09-18 00:09:46 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-09-18 07:13:38 -0700 |
commit | f4267ccd96a9143c910c66a5b0436aaa64b7c9dc (patch) | |
tree | 174861715807c23ba332f78769a9f7e1377b7f02 /test/files/continuations-run | |
parent | d45a3c8cc8e9f1d95d797d548a85abd8597f5bc7 (diff) | |
download | scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.gz scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.bz2 scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.zip |
Cull extraneous whitespace.
One last flurry with the broom before I leave you slobs to code
in your own filth. Eliminated all the trailing whitespace I
could manage, with special prejudice reserved for the test cases
which depended on the preservation of trailing whitespace.
Was reminded I cannot figure out how to eliminate the trailing
space on the "scala> " prompt in repl transcripts. At least
reduced the number of such empty prompts by trimming transcript
code on the way in.
Routed ConsoleReporter's "printMessage" through a trailing
whitespace stripping method which might help futureproof
against the future of whitespace diseases. Deleted the up-to-40
lines of trailing whitespace found in various library files.
It seems like only yesterday we performed whitespace surgery
on the whole repo. Clearly it doesn't stick very well. I suggest
it would work better to enforce a few requirements on the way in.
Diffstat (limited to 'test/files/continuations-run')
29 files changed, 119 insertions, 119 deletions
diff --git a/test/files/continuations-run/basics.scala b/test/files/continuations-run/basics.scala index ed1782d77a..07b3de5194 100755 --- a/test/files/continuations-run/basics.scala +++ b/test/files/continuations-run/basics.scala @@ -14,10 +14,10 @@ object Test { } def main(args: Array[String]) { - + println(reset(m0())) println(reset(m1())) - + } - + } diff --git a/test/files/continuations-run/function1.scala b/test/files/continuations-run/function1.scala index ec7ebb66a5..82dfe46c08 100644 --- a/test/files/continuations-run/function1.scala +++ b/test/files/continuations-run/function1.scala @@ -4,13 +4,13 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Unit = { - + val f = () => shift { k: (Int=>Int) => k(7) } val g: () => Int @cps[Int] = f - + println(reset(g())) } - + } diff --git a/test/files/continuations-run/function4.scala b/test/files/continuations-run/function4.scala index 232b1ec3a6..ccb432fe93 100644 --- a/test/files/continuations-run/function4.scala +++ b/test/files/continuations-run/function4.scala @@ -4,12 +4,12 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Unit = { - + val g: () => Int @cps[Int] = () => shift { k: (Int=>Int) => k(7) } - + println(reset(g())) } - + } diff --git a/test/files/continuations-run/function5.scala b/test/files/continuations-run/function5.scala index 17ae08c98e..a83eb80d08 100644 --- a/test/files/continuations-run/function5.scala +++ b/test/files/continuations-run/function5.scala @@ -4,12 +4,12 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Unit = { - + val g: () => Int @cps[Int] = () => 7 - + println(reset(g())) } - + } diff --git a/test/files/continuations-run/function6.scala b/test/files/continuations-run/function6.scala index 6b4c5adc41..13ef88bd9f 100644 --- a/test/files/continuations-run/function6.scala +++ b/test/files/continuations-run/function6.scala @@ -4,13 +4,13 @@ import scala.util.continuations._ object Test { - + def main(args: Array[String]): Unit = { - + val g: PartialFunction[Int, Int @cps[Int]] = { case x => 7 } - + println(reset(g(2))) - + } - + } diff --git a/test/files/continuations-run/ifelse0.scala b/test/files/continuations-run/ifelse0.scala index 2c40f64959..cbff72c77c 100644 --- a/test/files/continuations-run/ifelse0.scala +++ b/test/files/continuations-run/ifelse0.scala @@ -4,15 +4,15 @@ import scala.util.continuations._ object Test { - + def test(x:Int) = if (x <= 7) shift { k: (Int=>Int) => k(k(k(x))) } else shift { k: (Int=>Int) => k(x) } - + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } - + } diff --git a/test/files/continuations-run/ifelse1.scala b/test/files/continuations-run/ifelse1.scala index 6f52a8c1e3..f8e3cf2ca3 100644 --- a/test/files/continuations-run/ifelse1.scala +++ b/test/files/continuations-run/ifelse1.scala @@ -4,12 +4,12 @@ import scala.util.continuations._ object Test { - + def test1(x:Int) = if (x <= 7) shift { k: (Int=>Int) => k(k(k(x))) } else x - + def test2(x:Int) = if (x <= 7) x else @@ -21,5 +21,5 @@ object Test { println(reset(1 + test2(7))) println(reset(1 + test2(8))) } - + } diff --git a/test/files/continuations-run/ifelse2.scala b/test/files/continuations-run/ifelse2.scala index f7f8328703..f5ec864a06 100644 --- a/test/files/continuations-run/ifelse2.scala +++ b/test/files/continuations-run/ifelse2.scala @@ -4,13 +4,13 @@ import scala.util.continuations._ object Test { - + def test(x:Int) = if (x <= 7) shift { k: (Unit=>Unit) => println("abort") } - + def main(args: Array[String]): Unit = { println(reset{ test(7); println("alive") }) println(reset{ test(8); println("alive") }) } - + } diff --git a/test/files/continuations-run/ifelse3.scala b/test/files/continuations-run/ifelse3.scala index 7b85770be9..2c5b5765db 100644 --- a/test/files/continuations-run/ifelse3.scala +++ b/test/files/continuations-run/ifelse3.scala @@ -4,18 +4,18 @@ import scala.util.continuations._ object Test { - + def util(x: Boolean) = shift { k: (Boolean=>Int) => k(x) } - + def test(x:Int) = if (util(x <= 7)) x - 1 else x + 1 - - + + def main(args: Array[String]): Unit = { println(reset(test(7))) println(reset(test(8))) } - + } diff --git a/test/files/continuations-run/ifelse4.scala b/test/files/continuations-run/ifelse4.scala index a0dbcafc57..46ec15365e 100644 --- a/test/files/continuations-run/ifelse4.scala +++ b/test/files/continuations-run/ifelse4.scala @@ -2,7 +2,7 @@ import scala.util.continuations._ object Test { def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1)))) - + def testA(x1: Int): Int @cps[Int] = { sh(x1) if (x1==42) x1 else sh(x1) @@ -11,7 +11,7 @@ object Test { def testB(x1: Int): Int @cps[Int] = { if (sh(x1)==43) x1 else x1 } - + def testC(x1: Int): Int @cps[Int] = { sh(x1) if (sh(x1)==44) x1 else x1 diff --git a/test/files/continuations-run/infer1.scala b/test/files/continuations-run/infer1.scala index 1196bd40a8..76f746da57 100644 --- a/test/files/continuations-run/infer1.scala +++ b/test/files/continuations-run/infer1.scala @@ -4,9 +4,9 @@ import scala.util.continuations._ object Test { - + def test(x: => Int @cpsParam[String,Int]) = 7 - + def test2() = { val x = shift { k: (Int => String) => 9 } x @@ -14,9 +14,9 @@ object Test { def test3(x: => Int @cpsParam[Int,Int]) = 7 - + def util() = shift { k: (String => String) => "7" } - + def main(args: Array[String]): Unit = { test { shift { k: (Int => String) => 9 } } test { shift { k: (Int => String) => 9 }; 2 } @@ -29,5 +29,5 @@ object Test { test3 { { test3(0); 2 } } } - + } diff --git a/test/files/continuations-run/match0.scala b/test/files/continuations-run/match0.scala index 63b73bf21e..8769ed9fcb 100644 --- a/test/files/continuations-run/match0.scala +++ b/test/files/continuations-run/match0.scala @@ -4,15 +4,15 @@ import scala.util.continuations._ object Test { - + def test(x:Int) = x match { case 7 => shift { k: (Int=>Int) => k(k(k(x))) } case 8 => shift { k: (Int=>Int) => k(x) } } - + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } - + } diff --git a/test/files/continuations-run/match1.scala b/test/files/continuations-run/match1.scala index 62d639ee72..b89fb706b0 100644 --- a/test/files/continuations-run/match1.scala +++ b/test/files/continuations-run/match1.scala @@ -4,15 +4,15 @@ import scala.util.continuations._ object Test { - + def test(x:Int) = x match { case 7 => shift { k: (Int=>Int) => k(k(k(x))) } case _ => x } - + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } - + } diff --git a/test/files/continuations-run/match2.scala b/test/files/continuations-run/match2.scala index 5092ce3abe..002d9b52dd 100644 --- a/test/files/continuations-run/match2.scala +++ b/test/files/continuations-run/match2.scala @@ -4,23 +4,23 @@ import scala.util.continuations._ object Test { - + def test1() = { val (a, b) = shift { k: (((String,String)) => String) => k("A","B") } b } case class Elem[T,U](a: T, b: U) - + def test2() = { val Elem(a,b) = shift { k: (Elem[String,String] => String) => k(Elem("A","B")) } b } - + def main(args: Array[String]): Unit = { println(reset(test1())) println(reset(test2())) } - + }
\ No newline at end of file diff --git a/test/files/continuations-run/patvirt.scala b/test/files/continuations-run/patvirt.scala index 7d769d46fe..cfbdda538d 100644 --- a/test/files/continuations-run/patvirt.scala +++ b/test/files/continuations-run/patvirt.scala @@ -2,11 +2,11 @@ import scala.util.continuations._ object Test { def sh(x1:Int) = shift( (k: Int => Int) => k(k(k(x1)))) - + def test(x1: Int) = { val o7 = { val o6 = { - val o3 = + val o3 = if (7 == x1) Some(x1) else None diff --git a/test/files/continuations-run/t3199.scala b/test/files/continuations-run/t3199.scala index 7b54793e05..2cb73c005a 100644 --- a/test/files/continuations-run/t3199.scala +++ b/test/files/continuations-run/t3199.scala @@ -1,20 +1,20 @@ -import _root_.scala.collection.Seq -import _root_.scala.util.control.Exception -import _root_.scala.util.continuations._ - -object Test { - - trait AbstractResource[+R <: AnyRef] { - def reflect[B] : R @cpsParam[B,Either[Throwable, B]] = shift(acquireFor) - def acquireFor[B](f : R => B) : Either[Throwable, B] = { - import Exception._ - catching(List(classOf[Throwable]) : _*) either (f(null.asInstanceOf[R])) - } - } - - def main(args: Array[String]) : Unit = { - val x = new AbstractResource[String] { } - val result = x.acquireFor( x => 7 ) - println(result) - } - } +import _root_.scala.collection.Seq +import _root_.scala.util.control.Exception +import _root_.scala.util.continuations._ + +object Test { + + trait AbstractResource[+R <: AnyRef] { + def reflect[B] : R @cpsParam[B,Either[Throwable, B]] = shift(acquireFor) + def acquireFor[B](f : R => B) : Either[Throwable, B] = { + import Exception._ + catching(List(classOf[Throwable]) : _*) either (f(null.asInstanceOf[R])) + } + } + + def main(args: Array[String]) : Unit = { + val x = new AbstractResource[String] { } + val result = x.acquireFor( x => 7 ) + println(result) + } + } diff --git a/test/files/continuations-run/t3199b.scala b/test/files/continuations-run/t3199b.scala index fe1ecafe72..5010f2b085 100644 --- a/test/files/continuations-run/t3199b.scala +++ b/test/files/continuations-run/t3199b.scala @@ -1,11 +1,11 @@ object Test { - + def test() = { java.util.Arrays.asList(Array(1,2,3):_*) } - + def main(args: Array[String]) { println(test()) } - + } diff --git a/test/files/continuations-run/t3223.scala b/test/files/continuations-run/t3223.scala index fda61f41ea..75613fe5c7 100644 --- a/test/files/continuations-run/t3223.scala +++ b/test/files/continuations-run/t3223.scala @@ -2,16 +2,16 @@ import scala.util.continuations._ object Test { def foo(x:Int) = { - try { + try { throw new Exception shiftUnit0[Int,Int](7) } catch { - case ex: Throwable => + case ex: Throwable => val g = (a:Int)=>a 9 } } - + def main(args: Array[String]) { println(reset(foo(0))) } diff --git a/test/files/continuations-run/t3225.scala b/test/files/continuations-run/t3225.scala index bc6d635c88..a0c9c91985 100644 --- a/test/files/continuations-run/t3225.scala +++ b/test/files/continuations-run/t3225.scala @@ -31,10 +31,10 @@ object Test { } def blaX[A] = shift { k:(Bla=>A) => k(new Bla) } - + def fooX[A] = blaX[A].x def fooY[A] = blaX[A].y[A] - + def testPoly() = { println(reset(blaX[Bla]).x) println(reset(blaX[Int].x)) @@ -52,5 +52,5 @@ object Test { testMono() testPoly() } - + } diff --git a/test/files/continuations-run/t5314-2.scala b/test/files/continuations-run/t5314-2.scala index 8a896dec2c..e7e5d46f03 100644 --- a/test/files/continuations-run/t5314-2.scala +++ b/test/files/continuations-run/t5314-2.scala @@ -1,15 +1,15 @@ import scala.util.continuations._ -class ReturnRepro { - def s1: Int @cps[Any] = shift { k => k(5) } +class ReturnRepro { + def s1: Int @cps[Any] = shift { k => k(5) } def caller = reset { println(p(3)) } def caller2 = reset { println(p2(3)) } def caller3 = reset { println(p3(3)) } - def p(i: Int): Int @cps[Any] = { - val v= s1 + 3 - return v - } + def p(i: Int): Int @cps[Any] = { + val v= s1 + 3 + return v + } def p2(i: Int): Int @cps[Any] = { val v = s1 + 3 diff --git a/test/files/continuations-run/t5314-3.scala b/test/files/continuations-run/t5314-3.scala index 62c547f5a2..c2fe8f6f87 100644 --- a/test/files/continuations-run/t5314-3.scala +++ b/test/files/continuations-run/t5314-3.scala @@ -1,14 +1,14 @@ import scala.util.continuations._ -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } +class ReturnRepro { + def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } def caller = reset { println(p(3)) } def caller2 = reset { println(p2(3)) } - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 + def p(i: Int): Int @cpsParam[Unit, Any] = { + val v= s1 + 3 return { println("enter return expr"); v } - } + } def p2(i: Int): Int @cpsParam[Unit, Any] = { val v = s1 + 3 diff --git a/test/files/continuations-run/t5314.scala b/test/files/continuations-run/t5314.scala index d611016ce4..e448d8558d 100644 --- a/test/files/continuations-run/t5314.scala +++ b/test/files/continuations-run/t5314.scala @@ -1,14 +1,14 @@ import scala.util.continuations._ -class ReturnRepro { - def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } +class ReturnRepro { + def s1: Int @cpsParam[Any, Unit] = shift { k => k(5) } def caller = reset { println(p(3)) } def caller2 = reset { println(p2(3)) } - def p(i: Int): Int @cpsParam[Unit, Any] = { - val v= s1 + 3 - return v - } + def p(i: Int): Int @cpsParam[Unit, Any] = { + val v= s1 + 3 + return v + } def p2(i: Int): Int @cpsParam[Unit, Any] = { val v = s1 + 3 @@ -38,7 +38,7 @@ object Test extends App { println(reset { bar3(10) }) println(reset { bar4(10) }) println(reset { bar5(10) }) - + /* original test case */ val repro = new ReturnRepro repro.caller diff --git a/test/files/continuations-run/t5506.scala b/test/files/continuations-run/t5506.scala index 4b3703c725..08f64c9db1 100644 --- a/test/files/continuations-run/t5506.scala +++ b/test/files/continuations-run/t5506.scala @@ -4,11 +4,11 @@ object Test { def g: List[Int] @suspendable = List(1,2,3) -def fp10: List[Int] @suspendable = { +def fp10: List[Int] @suspendable = { g.map(x => x) } -def fp11: List[Int] @suspendable = { +def fp11: List[Int] @suspendable = { val z = g.map(x => x) z } @@ -47,7 +47,7 @@ def main(args: Array[String]) { println(fp10) println(fp11) println(fp12) - + println(fp20) println(fp21) println(fp22) diff --git a/test/files/continuations-run/t5538.scala b/test/files/continuations-run/t5538.scala index 6713cecf2f..9f01624da1 100644 --- a/test/files/continuations-run/t5538.scala +++ b/test/files/continuations-run/t5538.scala @@ -16,13 +16,13 @@ object Test { class PromiseStream[A] { override def toString = xs.toString - + var xs: List[A] = Nil - + final def +=(elem: A): this.type = { xs :+= elem; this } final def ++=(elem: Traversable[A]): this.type = { xs ++= elem; this } - + final def <<(elem: Future[A]): PromiseStream[A] @cps[Future[Any]] = shift { cont: (PromiseStream[A] => Future[Any]) => elem map (a => cont(this += a)) } @@ -40,7 +40,7 @@ object Test { def sequence[A, M[_] <: Traversable[_]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]] = new Future(in.asInstanceOf[Traversable[Future[A]]].map((f:Future[A])=>f.x)(cbf.asInstanceOf[CanBuildFrom[Traversable[Future[A]], A, M[A]]])) - + def flow[A](body: => A @cps[Future[Any]])(implicit executor: ExecutionContext): Future[A] = reset(Future(body)).asInstanceOf[Future[A]] } diff --git a/test/files/continuations-run/trycatch0.scala b/test/files/continuations-run/trycatch0.scala index feb7f7182b..d0b4a52a30 100644 --- a/test/files/continuations-run/trycatch0.scala +++ b/test/files/continuations-run/trycatch0.scala @@ -3,7 +3,7 @@ import scala.util.continuations._ object Test { - + def foo = try { shift((k: Int=>Int) => k(7)) } catch { @@ -17,7 +17,7 @@ object Test { case ex: Throwable => shiftUnit0[Int,Int](9) } - + def main(args: Array[String]): Unit = { println(reset { foo + 3 }) println(reset { bar + 3 }) diff --git a/test/files/continuations-run/trycatch1.scala b/test/files/continuations-run/trycatch1.scala index b00a87d059..2a8db72a8b 100644 --- a/test/files/continuations-run/trycatch1.scala +++ b/test/files/continuations-run/trycatch1.scala @@ -5,7 +5,7 @@ import scala.util.continuations._ object Test { def fatal: Int = throw new Exception() - + def foo1 = try { fatal shift((k: Int=>Int) => k(7)) diff --git a/test/files/continuations-run/while0.scala b/test/files/continuations-run/while0.scala index 542408fb24..e21745374e 100644 --- a/test/files/continuations-run/while0.scala +++ b/test/files/continuations-run/while0.scala @@ -4,9 +4,9 @@ import scala.util.continuations._ object Test { - + def foo(): Int @cps[Unit] = 2 - + def test(): Unit @cps[Unit] = { var x = 0 while (x < 9000) { // pick number large enough to require tail-call opt @@ -18,5 +18,5 @@ object Test { def main(args: Array[String]): Unit = { reset(test()) } - + } diff --git a/test/files/continuations-run/while1.scala b/test/files/continuations-run/while1.scala index 351d52c27a..7ba9f94881 100644 --- a/test/files/continuations-run/while1.scala +++ b/test/files/continuations-run/while1.scala @@ -4,9 +4,9 @@ import scala.util.continuations._ object Test { - + def foo(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") } - + def test(): Unit @cps[Unit] = { var x = 0 while (x < 9) { @@ -18,5 +18,5 @@ object Test { def main(args: Array[String]): Unit = { reset(test()) } - + } diff --git a/test/files/continuations-run/while2.scala b/test/files/continuations-run/while2.scala index f4991dea61..3dbf2ad2fe 100644 --- a/test/files/continuations-run/while2.scala +++ b/test/files/continuations-run/while2.scala @@ -4,10 +4,10 @@ import scala.util.continuations._ object Test { - + def foo1(): Int @cps[Unit] = 2 def foo2(): Int @cps[Unit] = shift { k => println("up"); k(2); println("down") } - + def test(): Unit @cps[Unit] = { var x = 0 while (x < 9000) { // pick number large enough to require tail-call opt @@ -19,5 +19,5 @@ object Test { def main(args: Array[String]): Unit = { reset(test()) } - + } |