From 3f035632e37da0c484fcf43310857263e3470433 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Wed, 9 May 2018 11:12:07 +0900 Subject: fix procedure syntax --- .../scala/scala/async/internal/AsyncAnalysis.scala | 16 +++--- .../scala/async/internal/AsyncTransform.scala | 2 +- src/main/scala/scala/async/internal/Lifter.scala | 6 +-- .../scala/scala/async/internal/LiveVariables.scala | 2 +- .../scala/async/internal/TransformUtils.scala | 14 +++--- src/test/scala/scala/async/TreeInterrogation.scala | 2 +- .../scala/scala/async/neg/LocalClasses0Spec.scala | 4 +- src/test/scala/scala/async/neg/NakedAwait.scala | 32 ++++++------ src/test/scala/scala/async/neg/SampleNegSpec.scala | 2 +- src/test/scala/scala/async/package.scala | 2 +- src/test/scala/scala/async/run/WarningsSpec.scala | 6 +-- .../scala/async/run/anf/AnfTransformSpec.scala | 58 +++++++++++----------- .../scala/scala/async/run/await0/Await0Spec.scala | 2 +- .../scala/scala/async/run/block0/AsyncSpec.scala | 4 +- src/test/scala/scala/async/run/block1/block1.scala | 2 +- .../async/run/exceptions/ExceptionsSpec.scala | 8 +-- .../scala/scala/async/run/futures/FutureSpec.scala | 48 +++++++++--------- .../scala/scala/async/run/hygiene/Hygiene.scala | 10 ++-- .../scala/scala/async/run/ifelse0/IfElse0.scala | 4 +- .../scala/scala/async/run/ifelse0/WhileSpec.scala | 14 +++--- .../scala/scala/async/run/ifelse1/IfElse1.scala | 10 ++-- .../scala/scala/async/run/ifelse2/ifelse2.scala | 2 +- .../scala/scala/async/run/ifelse3/IfElse3.scala | 2 +- .../scala/scala/async/run/ifelse4/IfElse4.scala | 2 +- .../scala/async/run/lazyval/LazyValSpec.scala | 2 +- .../scala/async/run/live/LiveVariablesSpec.scala | 22 ++++---- src/test/scala/scala/async/run/match0/Match0.scala | 16 +++--- .../scala/async/run/nesteddef/NestedDef.scala | 12 ++--- .../scala/async/run/noawait/NoAwaitSpec.scala | 6 +-- .../run/stackoverflow/StackOverflowSpec.scala | 2 +- .../scala/async/run/toughtype/ToughType.scala | 26 +++++----- .../run/uncheckedBounds/UncheckedBoundsSpec.scala | 4 +- 32 files changed, 172 insertions(+), 172 deletions(-) diff --git a/src/main/scala/scala/async/internal/AsyncAnalysis.scala b/src/main/scala/scala/async/internal/AsyncAnalysis.scala index 990db74..caa1513 100644 --- a/src/main/scala/scala/async/internal/AsyncAnalysis.scala +++ b/src/main/scala/scala/async/internal/AsyncAnalysis.scala @@ -26,32 +26,32 @@ trait AsyncAnalysis { private class UnsupportedAwaitAnalyzer extends AsyncTraverser { var hasUnsupportedAwaits = false - override def nestedClass(classDef: ClassDef) { + override def nestedClass(classDef: ClassDef): Unit = { val kind = if (classDef.symbol.asClass.isTrait) "trait" else "class" reportUnsupportedAwait(classDef, s"nested $kind") } - override def nestedModule(module: ModuleDef) { + override def nestedModule(module: ModuleDef): Unit = { reportUnsupportedAwait(module, "nested object") } - override def nestedMethod(defDef: DefDef) { + override def nestedMethod(defDef: DefDef): Unit = { reportUnsupportedAwait(defDef, "nested method") } - override def byNameArgument(arg: Tree) { + override def byNameArgument(arg: Tree): Unit = { reportUnsupportedAwait(arg, "by-name argument") } - override def function(function: Function) { + override def function(function: Function): Unit = { reportUnsupportedAwait(function, "nested function") } - override def patMatFunction(tree: Match) { + override def patMatFunction(tree: Match): Unit = { reportUnsupportedAwait(tree, "nested function") } - override def traverse(tree: Tree) { + override def traverse(tree: Tree): Unit = { tree match { case Try(_, _, _) if containsAwait(tree) => reportUnsupportedAwait(tree, "try/catch") @@ -94,7 +94,7 @@ trait AsyncAnalysis { badAwaits.nonEmpty } - private def reportError(pos: Position, msg: String) { + private def reportError(pos: Position, msg: String): Unit = { hasUnsupportedAwaits = true c.abort(pos, msg) } diff --git a/src/main/scala/scala/async/internal/AsyncTransform.scala b/src/main/scala/scala/async/internal/AsyncTransform.scala index dc12cf8..7ef63f7 100644 --- a/src/main/scala/scala/async/internal/AsyncTransform.scala +++ b/src/main/scala/scala/async/internal/AsyncTransform.scala @@ -117,7 +117,7 @@ trait AsyncTransform { cleanupContainsAwaitAttachments(result) } - def logDiagnostics(anfTree: Tree, states: Seq[String]) { + def logDiagnostics(anfTree: Tree, states: Seq[String]): Unit = { def location = try { macroPos.source.path } catch { diff --git a/src/main/scala/scala/async/internal/Lifter.scala b/src/main/scala/scala/async/internal/Lifter.scala index 3afe6d6..ff90576 100644 --- a/src/main/scala/scala/async/internal/Lifter.scala +++ b/src/main/scala/scala/async/internal/Lifter.scala @@ -17,12 +17,12 @@ trait Lifter { object companionship { private val companions = collection.mutable.Map[Symbol, Symbol]() private val companionsInverse = collection.mutable.Map[Symbol, Symbol]() - private def record(sym1: Symbol, sym2: Symbol) { + private def record(sym1: Symbol, sym2: Symbol): Unit = { companions(sym1) = sym2 companions(sym2) = sym1 } - def record(defs: List[Tree]) { + def record(defs: List[Tree]): Unit = { // Keep note of local companions so we rename them consistently // when lifting. val comps = for { @@ -86,7 +86,7 @@ trait Lifter { def liftableSyms: Set[Symbol] = { val liftableMutableSet = collection.mutable.Set[Symbol]() - def markForLift(sym: Symbol) { + def markForLift(sym: Symbol): Unit = { if (!liftableMutableSet(sym)) { liftableMutableSet += sym diff --git a/src/main/scala/scala/async/internal/LiveVariables.scala b/src/main/scala/scala/async/internal/LiveVariables.scala index 8ae00f5..692d0bf 100644 --- a/src/main/scala/scala/async/internal/LiveVariables.scala +++ b/src/main/scala/scala/async/internal/LiveVariables.scala @@ -81,7 +81,7 @@ trait LiveVariables { } private def capturingCheck(tree: Tree) = capturing(tree foreach check) private var capturing: Boolean = false - private def check(tree: Tree) { + private def check(tree: Tree): Unit = { tree match { case Ident(_) if liftedSyms(tree.symbol) => if (capturing) diff --git a/src/main/scala/scala/async/internal/TransformUtils.scala b/src/main/scala/scala/async/internal/TransformUtils.scala index be56bb7..855cbd2 100644 --- a/src/main/scala/scala/async/internal/TransformUtils.scala +++ b/src/main/scala/scala/async/internal/TransformUtils.scala @@ -289,25 +289,25 @@ private[async] trait TransformUtils { * and `nestedClass` etc are invoked. */ trait AsyncTraverser extends Traverser { - def nestedClass(classDef: ClassDef) { + def nestedClass(classDef: ClassDef): Unit = { } - def nestedModule(module: ModuleDef) { + def nestedModule(module: ModuleDef): Unit = { } - def nestedMethod(defdef: DefDef) { + def nestedMethod(defdef: DefDef): Unit = { } - def byNameArgument(arg: Tree) { + def byNameArgument(arg: Tree): Unit = { } - def function(function: Function) { + def function(function: Function): Unit = { } - def patMatFunction(tree: Match) { + def patMatFunction(tree: Match): Unit = { } - override def traverse(tree: Tree) { + override def traverse(tree: Tree): Unit = { tree match { case _ if isAsync(tree) => // Under -Ymacro-expand:discard, used in the IDE, nested async blocks will be visible to the outer blocks diff --git a/src/test/scala/scala/async/TreeInterrogation.scala b/src/test/scala/scala/async/TreeInterrogation.scala index 9426d1d..3b685c8 100644 --- a/src/test/scala/scala/async/TreeInterrogation.scala +++ b/src/test/scala/scala/async/TreeInterrogation.scala @@ -11,7 +11,7 @@ import tools.reflect.ToolBox class TreeInterrogation { @Test - def `a minimal set of vals are lifted to vars`() { + def `a minimal set of vals are lifted to vars`(): Unit = { val cm = reflect.runtime.currentMirror val tb = mkToolbox(s"-cp $toolboxClasspath") val tree = tb.parse( diff --git a/src/test/scala/scala/async/neg/LocalClasses0Spec.scala b/src/test/scala/scala/async/neg/LocalClasses0Spec.scala index fd261b5..68ce9ea 100644 --- a/src/test/scala/scala/async/neg/LocalClasses0Spec.scala +++ b/src/test/scala/scala/async/neg/LocalClasses0Spec.scala @@ -10,7 +10,7 @@ import scala.async.internal.AsyncId class LocalClasses0Spec { @Test - def localClassCrashIssue16() { + def localClassCrashIssue16(): Unit = { import AsyncId.{async, await} async { class B { def f = 1 } @@ -19,7 +19,7 @@ class LocalClasses0Spec { } @Test - def nestedCaseClassAndModuleAllowed() { + def nestedCaseClassAndModuleAllowed(): Unit = { import AsyncId.{await, async} async { trait Base { def base = 0} diff --git a/src/test/scala/scala/async/neg/NakedAwait.scala b/src/test/scala/scala/async/neg/NakedAwait.scala index ba2f23a..f4a10dd 100644 --- a/src/test/scala/scala/async/neg/NakedAwait.scala +++ b/src/test/scala/scala/async/neg/NakedAwait.scala @@ -9,7 +9,7 @@ import org.junit.Test class NakedAwait { @Test - def `await only allowed in async neg`() { + def `await only allowed in async neg`(): Unit = { expectError("`await` must be enclosed in an `async` block") { """ | import _root_.scala.async.Async._ @@ -19,7 +19,7 @@ class NakedAwait { } @Test - def `await not allowed in by-name argument`() { + def `await not allowed in by-name argument`(): Unit = { expectError("await must not be used under a by-name argument.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -30,7 +30,7 @@ class NakedAwait { } @Test - def `await not allowed in boolean short circuit argument 1`() { + def `await not allowed in boolean short circuit argument 1`(): Unit = { expectError("await must not be used under a by-name argument.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -40,7 +40,7 @@ class NakedAwait { } @Test - def `await not allowed in boolean short circuit argument 2`() { + def `await not allowed in boolean short circuit argument 2`(): Unit = { expectError("await must not be used under a by-name argument.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -50,7 +50,7 @@ class NakedAwait { } @Test - def nestedObject() { + def nestedObject(): Unit = { expectError("await must not be used under a nested object.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -60,7 +60,7 @@ class NakedAwait { } @Test - def nestedTrait() { + def nestedTrait(): Unit = { expectError("await must not be used under a nested trait.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -70,7 +70,7 @@ class NakedAwait { } @Test - def nestedClass() { + def nestedClass(): Unit = { expectError("await must not be used under a nested class.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -80,7 +80,7 @@ class NakedAwait { } @Test - def nestedFunction() { + def nestedFunction(): Unit = { expectError("await must not be used under a nested function.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -90,7 +90,7 @@ class NakedAwait { } @Test - def nestedPatMatFunction() { + def nestedPatMatFunction(): Unit = { expectError("await must not be used under a nested class.") { // TODO more specific error message """ | import _root_.scala.async.internal.AsyncId._ @@ -100,7 +100,7 @@ class NakedAwait { } @Test - def tryBody() { + def tryBody(): Unit = { expectError("await must not be used under a try/catch.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -110,7 +110,7 @@ class NakedAwait { } @Test - def catchBody() { + def catchBody(): Unit = { expectError("await must not be used under a try/catch.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -120,7 +120,7 @@ class NakedAwait { } @Test - def finallyBody() { + def finallyBody(): Unit = { expectError("await must not be used under a try/catch.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -130,7 +130,7 @@ class NakedAwait { } @Test - def guard() { + def guard(): Unit = { expectError("await must not be used under a pattern guard.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -140,7 +140,7 @@ class NakedAwait { } @Test - def nestedMethod() { + def nestedMethod(): Unit = { expectError("await must not be used under a nested method.") { """ | import _root_.scala.async.internal.AsyncId._ @@ -150,7 +150,7 @@ class NakedAwait { } @Test - def returnIllegal() { + def returnIllegal(): Unit = { expectError("return is illegal") { """ | import _root_.scala.async.internal.AsyncId._ @@ -162,7 +162,7 @@ class NakedAwait { } @Test - def lazyValIllegal() { + def lazyValIllegal(): Unit = { expectError("await must not be used under a lazy val initializer") { """ | import _root_.scala.async.internal.AsyncId._ diff --git a/src/test/scala/scala/async/neg/SampleNegSpec.scala b/src/test/scala/scala/async/neg/SampleNegSpec.scala index 5c36af1..d7662e5 100644 --- a/src/test/scala/scala/async/neg/SampleNegSpec.scala +++ b/src/test/scala/scala/async/neg/SampleNegSpec.scala @@ -9,7 +9,7 @@ import org.junit.Test class SampleNegSpec { @Test - def `missing symbol`() { + def `missing symbol`(): Unit = { expectError("not found: value kaboom") { """ | kaboom diff --git a/src/test/scala/scala/async/package.scala b/src/test/scala/scala/async/package.scala index 94a26f9..552abd3 100644 --- a/src/test/scala/scala/async/package.scala +++ b/src/test/scala/scala/async/package.scala @@ -74,7 +74,7 @@ package object async { .getParentFile.getParentFile def expectError(errorSnippet: String, compileOptions: String = "", - baseCompileOptions: String = s"-cp ${toolboxClasspath}")(code: String) { + baseCompileOptions: String = s"-cp ${toolboxClasspath}")(code: String): Unit = { intercept[ToolBoxError] { eval(code, compileOptions + " " + baseCompileOptions) }.getMessage mustContain errorSnippet diff --git a/src/test/scala/scala/async/run/WarningsSpec.scala b/src/test/scala/scala/async/run/WarningsSpec.scala index 9c55af4..6c1282a 100644 --- a/src/test/scala/scala/async/run/WarningsSpec.scala +++ b/src/test/scala/scala/async/run/WarningsSpec.scala @@ -33,7 +33,7 @@ class WarningsSpec { @Test // https://github.com/scala/async/issues/74 - def noDeadCodeWarningForAsyncThrow() { + def noDeadCodeWarningForAsyncThrow(): Unit = { val global = mkGlobal("-cp ${toolboxClasspath} -Yrangepos -Ywarn-dead-code -Xfatal-warnings -Ystop-after:refchecks") // was: "a pure expression does nothing in statement position; you may be omitting necessary parentheses" val source = @@ -51,7 +51,7 @@ class WarningsSpec { } @Test - def noDeadCodeWarningInMacroExpansion() { + def noDeadCodeWarningInMacroExpansion(): Unit = { val global = mkGlobal("-cp ${toolboxClasspath} -Yrangepos -Ywarn-dead-code -Xfatal-warnings -Ystop-after:refchecks") val source = """ | class Test { @@ -76,7 +76,7 @@ class WarningsSpec { } @Test - def ignoreNestedAwaitsInIDE_t1002561() { + def ignoreNestedAwaitsInIDE_t1002561(): Unit = { // https://www.assembla.com/spaces/scala-ide/tickets/1002561 val global = mkGlobal("-cp ${toolboxClasspath} -Yrangepos -Ystop-after:typer ") val source = """ diff --git a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala index 661b6dc..16321cd 100644 --- a/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala +++ b/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala @@ -71,7 +71,7 @@ object State { class AnfTransformSpec { @Test - def `simple ANF transform`() { + def `simple ANF transform`(): Unit = { val o = new AnfTestClass val fut = o.m(10) val res = Await.result(fut, 2 seconds) @@ -79,7 +79,7 @@ class AnfTransformSpec { } @Test - def `simple ANF transform 2`() { + def `simple ANF transform 2`(): Unit = { val o = new AnfTestClass val fut = o.m2(10) val res = Await.result(fut, 2 seconds) @@ -87,7 +87,7 @@ class AnfTransformSpec { } @Test - def `simple ANF transform 3`() { + def `simple ANF transform 3`(): Unit = { val o = new AnfTestClass val fut = o.m3(10) val res = Await.result(fut, 2 seconds) @@ -95,7 +95,7 @@ class AnfTransformSpec { } @Test - def `ANF transform of assigning the result of an if-else`() { + def `ANF transform of assigning the result of an if-else`(): Unit = { val o = new AnfTestClass val fut = o.m4(10) val res = Await.result(fut, 2 seconds) @@ -103,7 +103,7 @@ class AnfTransformSpec { } @Test - def `Unit-typed if-else in tail position`() { + def `Unit-typed if-else in tail position`(): Unit = { val o = new AnfTestClass val fut = o.futureUnitIfElse(10) Await.result(fut, 2 seconds) @@ -111,7 +111,7 @@ class AnfTransformSpec { } @Test - def `inlining block does not produce duplicate definition`() { + def `inlining block does not produce duplicate definition`(): Unit = { AsyncId.async { val f = 12 val x = AsyncId.await(f) @@ -127,7 +127,7 @@ class AnfTransformSpec { } @Test - def `inlining block in tail position does not produce duplicate definition`() { + def `inlining block in tail position does not produce duplicate definition`(): Unit = { AsyncId.async { val f = 12 val x = AsyncId.await(f) @@ -140,7 +140,7 @@ class AnfTransformSpec { } @Test - def `match as expression 1`() { + def `match as expression 1`(): Unit = { import ExecutionContext.Implicits.global val result = AsyncId.async { val x = "" match { @@ -152,7 +152,7 @@ class AnfTransformSpec { } @Test - def `match as expression 2`() { + def `match as expression 2`(): Unit = { import ExecutionContext.Implicits.global val result = AsyncId.async { val x = "" match { @@ -168,7 +168,7 @@ class AnfTransformSpec { } @Test - def nestedAwaitAsBareExpression() { + def nestedAwaitAsBareExpression(): Unit = { import ExecutionContext.Implicits.global import AsyncId.{async, await} val result = async { @@ -178,7 +178,7 @@ class AnfTransformSpec { } @Test - def nestedAwaitInBlock() { + def nestedAwaitInBlock(): Unit = { import ExecutionContext.Implicits.global import AsyncId.{async, await} val result = async { @@ -189,7 +189,7 @@ class AnfTransformSpec { } @Test - def nestedAwaitInIf() { + def nestedAwaitInIf(): Unit = { import ExecutionContext.Implicits.global import AsyncId.{async, await} val result = async { @@ -201,7 +201,7 @@ class AnfTransformSpec { } @Test - def byNameExpressionsArentLifted() { + def byNameExpressionsArentLifted(): Unit = { import AsyncId.{async, await} def foo(ignored: => Any, b: Int) = b val result = async { @@ -211,7 +211,7 @@ class AnfTransformSpec { } @Test - def evaluationOrderRespected() { + def evaluationOrderRespected(): Unit = { import AsyncId.{async, await} def foo(a: Int, b: Int) = (a, b) val result = async { @@ -226,7 +226,7 @@ class AnfTransformSpec { } @Test - def awaitInNonPrimaryParamSection1() { + def awaitInNonPrimaryParamSection1(): Unit = { import AsyncId.{async, await} def foo(a0: Int)(b0: Int) = s"a0 = $a0, b0 = $b0" val res = async { @@ -238,7 +238,7 @@ class AnfTransformSpec { } @Test - def awaitInNonPrimaryParamSection2() { + def awaitInNonPrimaryParamSection2(): Unit = { import AsyncId.{async, await} def foo[T](a0: Int)(b0: Int*) = s"a0 = $a0, b0 = ${b0.head}" val res = async { @@ -250,7 +250,7 @@ class AnfTransformSpec { } @Test - def awaitInNonPrimaryParamSectionWithLazy1() { + def awaitInNonPrimaryParamSectionWithLazy1(): Unit = { import AsyncId.{async, await} def foo[T](a: => Int)(b: Int) = b val res = async { @@ -261,7 +261,7 @@ class AnfTransformSpec { } @Test - def awaitInNonPrimaryParamSectionWithLazy2() { + def awaitInNonPrimaryParamSectionWithLazy2(): Unit = { import AsyncId.{async, await} def foo[T](a: Int)(b: => Int) = a val res = async { @@ -272,7 +272,7 @@ class AnfTransformSpec { } @Test - def awaitWithLazy() { + def awaitWithLazy(): Unit = { import AsyncId.{async, await} def foo[T](a: Int, b: => Int) = a val res = async { @@ -283,7 +283,7 @@ class AnfTransformSpec { } @Test - def awaitOkInReciever() { + def awaitOkInReciever(): Unit = { import AsyncId.{async, await} class Foo { def bar(a: Int)(b: Int) = a + b } async { @@ -292,7 +292,7 @@ class AnfTransformSpec { } @Test - def namedArgumentsRespectEvaluationOrder() { + def namedArgumentsRespectEvaluationOrder(): Unit = { import AsyncId.{async, await} def foo(a: Int, b: Int) = (a, b) val result = async { @@ -307,7 +307,7 @@ class AnfTransformSpec { } @Test - def namedAndDefaultArgumentsRespectEvaluationOrder() { + def namedAndDefaultArgumentsRespectEvaluationOrder(): Unit = { import AsyncId.{async, await} var i = 0 def next() = { @@ -325,7 +325,7 @@ class AnfTransformSpec { } @Test - def repeatedParams1() { + def repeatedParams1(): Unit = { import AsyncId.{async, await} var i = 0 def foo(a: Int, b: Int*) = b.toList @@ -336,7 +336,7 @@ class AnfTransformSpec { } @Test - def repeatedParams2() { + def repeatedParams2(): Unit = { import AsyncId.{async, await} var i = 0 def foo(a: Int, b: Int*) = b.toList @@ -347,7 +347,7 @@ class AnfTransformSpec { } @Test - def awaitInThrow() { + def awaitInThrow(): Unit = { import _root_.scala.async.internal.AsyncId.{async, await} intercept[Exception]( async { @@ -357,7 +357,7 @@ class AnfTransformSpec { } @Test - def awaitInTyped() { + def awaitInTyped(): Unit = { import _root_.scala.async.internal.AsyncId.{async, await} async { (("msg: " + await(0)): String).toString @@ -366,7 +366,7 @@ class AnfTransformSpec { @Test - def awaitInAssign() { + def awaitInAssign(): Unit = { import _root_.scala.async.internal.AsyncId.{async, await} async { var x = 0 @@ -376,7 +376,7 @@ class AnfTransformSpec { } @Test - def caseBodyMustBeTypedAsUnit() { + def caseBodyMustBeTypedAsUnit(): Unit = { import _root_.scala.async.internal.AsyncId.{async, await} val Up = 1 val Down = 2 @@ -390,7 +390,7 @@ class AnfTransformSpec { } @Test - def awaitInImplicitApply() { + def awaitInImplicitApply(): Unit = { val tb = mkToolbox(s"-cp ${toolboxClasspath}") val tree = tb.typeCheck(tb.parse { """ diff --git a/src/test/scala/scala/async/run/await0/Await0Spec.scala b/src/test/scala/scala/async/run/await0/Await0Spec.scala index e8190c7..eedfc1d 100644 --- a/src/test/scala/scala/async/run/await0/Await0Spec.scala +++ b/src/test/scala/scala/async/run/await0/Await0Spec.scala @@ -64,7 +64,7 @@ class Await0Class { class Await0Spec { @Test - def `An async method support a simple await`() { + def `An async method support a simple await`(): Unit = { val o = new Await0Class val fut = o.m0(10) val res = Await.result(fut, 10 seconds) diff --git a/src/test/scala/scala/async/run/block0/AsyncSpec.scala b/src/test/scala/scala/async/run/block0/AsyncSpec.scala index c5f759c..4ce7cba 100644 --- a/src/test/scala/scala/async/run/block0/AsyncSpec.scala +++ b/src/test/scala/scala/async/run/block0/AsyncSpec.scala @@ -40,7 +40,7 @@ class Test1Class { class AsyncSpec { @Test - def `simple await`() { + def `simple await`(): Unit = { val o = new Test1Class val fut = o.m2(10) val res = Await.result(fut, 2 seconds) @@ -48,7 +48,7 @@ class AsyncSpec { } @Test - def `several awaits in sequence`() { + def `several awaits in sequence`(): Unit = { val o = new Test1Class val fut = o.m3(10) val res = Await.result(fut, 4 seconds) diff --git a/src/test/scala/scala/async/run/block1/block1.scala b/src/test/scala/scala/async/run/block1/block1.scala index 7cef8ef..ee320af 100644 --- a/src/test/scala/scala/async/run/block1/block1.scala +++ b/src/test/scala/scala/async/run/block1/block1.scala @@ -32,7 +32,7 @@ class Test1Class { class Block1Spec { - @Test def `support a simple await`() { + @Test def `support a simple await`(): Unit = { val o = new Test1Class val fut = o.m4(10) val res = Await.result(fut, 2 seconds) diff --git a/src/test/scala/scala/async/run/exceptions/ExceptionsSpec.scala b/src/test/scala/scala/async/run/exceptions/ExceptionsSpec.scala index 649543f..9ee21ae 100644 --- a/src/test/scala/scala/async/run/exceptions/ExceptionsSpec.scala +++ b/src/test/scala/scala/async/run/exceptions/ExceptionsSpec.scala @@ -18,13 +18,13 @@ import org.junit.Test class ExceptionsSpec { @Test - def `uncaught exception within async`() { + def `uncaught exception within async`(): Unit = { val fut = async { throw new Exception("problem") } intercept[Exception] { Await.result(fut, 2.seconds) } } @Test - def `uncaught exception within async after await`() { + def `uncaught exception within async after await`(): Unit = { val base = Future { "five!".length } val fut = async { val len = await(base) @@ -34,7 +34,7 @@ class ExceptionsSpec { } @Test - def `await failing future within async`() { + def `await failing future within async`(): Unit = { val base = Future[Int] { throw new Exception("problem") } val fut = async { val x = await(base) @@ -44,7 +44,7 @@ class ExceptionsSpec { } @Test - def `await failing future within async after await`() { + def `await failing future within async after await`(): Unit = { val base = Future[Any] { "five!".length } val fut = async { val a = await(base.mapTo[Int]) // result: 5 diff --git a/src/test/scala/scala/async/run/futures/FutureSpec.scala b/src/test/scala/scala/async/run/futures/FutureSpec.scala index 82e43fa..6344c04 100644 --- a/src/test/scala/scala/async/run/futures/FutureSpec.scala +++ b/src/test/scala/scala/async/run/futures/FutureSpec.scala @@ -33,7 +33,7 @@ class FutureSpec { /* future specification */ - @Test def `A future with custom ExecutionContext should handle Throwables`() { + @Test def `A future with custom ExecutionContext should handle Throwables`(): Unit = { val ms = new mutable.HashSet[Throwable] with mutable.SynchronizedSet[Throwable] implicit val ec = scala.concurrent.ExecutionContext.fromExecutor(new java.util.concurrent.ForkJoinPool(), { t => @@ -83,7 +83,7 @@ class FutureSpec { import ExecutionContext.Implicits._ - @Test def `A future with global ExecutionContext should compose with for-comprehensions`() { + @Test def `A future with global ExecutionContext should compose with for-comprehensions`(): Unit = { import scala.reflect.ClassTag def asyncInt(x: Int) = Future { (x * 2).toString } @@ -111,7 +111,7 @@ class FutureSpec { } //TODO this is not yet supported by Async - @Test def `support pattern matching within a for-comprehension`() { + @Test def `support pattern matching within a for-comprehension`(): Unit = { case class Req[T](req: T) case class Res[T](res: T) def asyncReq[T](req: Req[T]) = req match { @@ -135,14 +135,14 @@ class FutureSpec { intercept[NoSuchElementException] { Await.result(future2, defaultTimeout) } } - @Test def mini() { + @Test def mini(): Unit = { val future4 = async { await(Future.successful(0)).toString } Await.result(future4, defaultTimeout) } - @Test def `recover from exceptions`() { + @Test def `recover from exceptions`(): Unit = { val future1 = Future(5) val future2 = async { await(future1) / 0 } val future3 = async { await(future2).toString } @@ -190,7 +190,7 @@ class FutureSpec { Await.result(future11, defaultTimeout) mustBe ("Oops!") } - @Test def `recoverWith from exceptions`() { + @Test def `recoverWith from exceptions`(): Unit = { val o = new IllegalStateException("original") val r = new IllegalStateException("recovered") @@ -214,7 +214,7 @@ class FutureSpec { } mustBe (r) } - @Test def `andThen like a boss`() { + @Test def `andThen like a boss`(): Unit = { val q = new java.util.concurrent.LinkedBlockingQueue[Int] for (i <- 1 to 1000) { val chained = Future { @@ -234,7 +234,7 @@ class FutureSpec { } } - @Test def `firstCompletedOf`() { + @Test def `firstCompletedOf`(): Unit = { def futures = Vector.fill[Future[Int]](10) { Promise[Int]().future } :+ Future.successful[Int](5) @@ -243,7 +243,7 @@ class FutureSpec { Await.result(Future.firstCompletedOf(futures.iterator), defaultTimeout) mustBe (5) } - @Test def `find`() { + @Test def `find`(): Unit = { val futures = for (i <- 1 to 10) yield Future { i } @@ -255,7 +255,7 @@ class FutureSpec { Await.result(notFound, defaultTimeout) mustBe (None) } - @Test def `zip`() { + @Test def `zip`(): Unit = { val timeout = 10000 millis val f = new IllegalStateException("test") intercept[IllegalStateException] { @@ -277,7 +277,7 @@ class FutureSpec { Await.result(successful, timeout) mustBe (("foo", "foo")) } - @Test def `fold`() { + @Test def `fold`(): Unit = { val timeout = 10000 millis def async(add: Int, wait: Int) = Future { Thread.sleep(wait) @@ -299,7 +299,7 @@ class FutureSpec { Await.result(foldedit, timeout) mustBe (45) } - @Test def `fold by composing`() { + @Test def `fold by composing`(): Unit = { val timeout = 10000 millis def async(add: Int, wait: Int) = Future { Thread.sleep(wait) @@ -314,7 +314,7 @@ class FutureSpec { Await.result(folded, timeout) mustBe (45) } - @Test def `fold with an exception`() { + @Test def `fold with an exception`(): Unit = { val timeout = 10000 millis def async(add: Int, wait: Int) = Future { Thread.sleep(wait) @@ -331,9 +331,9 @@ class FutureSpec { }.getMessage mustBe ("shouldFoldResultsWithException: expected") } - @Test def `fold mutable zeroes safely`() { + @Test def `fold mutable zeroes safely`(): Unit = { import scala.collection.mutable.ArrayBuffer - def test(testNumber: Int) { + def test(testNumber: Int): Unit = { val fs = (0 to 1000) map (i => Future(i)) // TODO: change to `foldLeft` after support for 2.11 is dropped val f = Future.fold(fs)(ArrayBuffer.empty[AnyRef]) { @@ -348,13 +348,13 @@ class FutureSpec { (1 to 100) foreach test //Make sure it tries to provoke the problem } - @Test def `return zero value if folding empty list`() { + @Test def `return zero value if folding empty list`(): Unit = { // TODO: change to `foldLeft` after support for 2.11 is dropped val zero = Future.fold(List[Future[Int]]())(0)(_ + _) Await.result(zero, defaultTimeout) mustBe (0) } - @Test def `shouldReduceResults`() { + @Test def `shouldReduceResults`(): Unit = { def async(idx: Int) = Future { Thread.sleep(idx * 20) idx @@ -372,7 +372,7 @@ class FutureSpec { Await.result(reducedit, timeout) mustBe (45) } - @Test def `shouldReduceResultsWithException`() { + @Test def `shouldReduceResultsWithException`(): Unit = { def async(add: Int, wait: Int) = Future { Thread.sleep(wait) if (add == 6) throw new IllegalArgumentException("shouldFoldResultsWithException: expected") @@ -389,7 +389,7 @@ class FutureSpec { }.getMessage mustBe ("shouldFoldResultsWithException: expected") } - @Test def `shouldReduceThrowNSEEOnEmptyInput`() { + @Test def `shouldReduceThrowNSEEOnEmptyInput`(): Unit = { intercept[java.util.NoSuchElementException] { // TODO: change to `reduceLeft` after support for 2.11 is dropped val emptyreduced = Future.reduce(List[Future[Int]]())(_ + _) @@ -397,7 +397,7 @@ class FutureSpec { } } - @Test def `shouldTraverseFutures`() { + @Test def `shouldTraverseFutures`(): Unit = { object counter { var count = -1 def incAndGet() = counter.synchronized { @@ -419,7 +419,7 @@ class FutureSpec { Await.result(traversedIterator, defaultTimeout).sum mustBe (10000) } - @Test def `shouldBlockUntilResult`() { + @Test def `shouldBlockUntilResult`(): Unit = { val latch = new TestLatch val f = Future { @@ -449,7 +449,7 @@ class FutureSpec { } } - @Test def `run callbacks async`() { + @Test def `run callbacks async`(): Unit = { val latch = Vector.fill(10)(new TestLatch) val f1 = Future { @@ -519,7 +519,7 @@ class FutureSpec { Await.ready(f4, defaultTimeout).isCompleted mustBe (true) } - @Test def `should not deadlock with nested await (ticket 1313)`() { + @Test def `should not deadlock with nested await (ticket 1313)`(): Unit = { val simple = async { await { Future { } } val unit = Future(()) @@ -542,7 +542,7 @@ class FutureSpec { Await.ready(complex, defaultTimeout).isCompleted mustBe (true) } - @Test def `should not throw when Await.ready`() { + @Test def `should not throw when Await.ready`(): Unit = { val expected = try Success(5 / 0) catch { case a: ArithmeticException => Failure(a) } val f = async { await(Future(5)) / 0 } Await.ready(f, defaultTimeout).value.get.toString mustBe expected.toString diff --git a/src/test/scala/scala/async/run/hygiene/Hygiene.scala b/src/test/scala/scala/async/run/hygiene/Hygiene.scala index 541611e..041e357 100644 --- a/src/test/scala/scala/async/run/hygiene/Hygiene.scala +++ b/src/test/scala/scala/async/run/hygiene/Hygiene.scala @@ -14,7 +14,7 @@ class HygieneSpec { import AsyncId.{async, await} @Test - def `is hygenic`() { + def `is hygenic`(): Unit = { val state = 23 val result: Any = "result" def resume(): Any = "resume" @@ -29,7 +29,7 @@ class HygieneSpec { } @Test - def `external var as result of await`() { + def `external var as result of await`(): Unit = { var ext = 0 async { ext = await(12) @@ -38,7 +38,7 @@ class HygieneSpec { } @Test - def `external var as result of await 2`() { + def `external var as result of await 2`(): Unit = { var ext = 0 val inp = 10 async { @@ -51,7 +51,7 @@ class HygieneSpec { } @Test - def `external var as result of await 3`() { + def `external var as result of await 3`(): Unit = { var ext = 0 val inp = 10 async { @@ -65,7 +65,7 @@ class HygieneSpec { } @Test - def `is hygenic nested`() { + def `is hygenic nested`(): Unit = { val state = 23 val result: Any = "result" def resume(): Any = "resume" diff --git a/src/test/scala/scala/async/run/ifelse0/IfElse0.scala b/src/test/scala/scala/async/run/ifelse0/IfElse0.scala index 62e1970..3eb06e6 100644 --- a/src/test/scala/scala/async/run/ifelse0/IfElse0.scala +++ b/src/test/scala/scala/async/run/ifelse0/IfElse0.scala @@ -39,14 +39,14 @@ class TestIfElseClass { class IfElseSpec { - @Test def `support await in a simple if-else expression`() { + @Test def `support await in a simple if-else expression`(): Unit = { val o = new TestIfElseClass val fut = o.m2(10) val res = Await.result(fut, 2 seconds) res mustBe (14) } - @Test def `await in condition`() { + @Test def `await in condition`(): Unit = { import AsyncId.{async, await} val result = async { if ({await(true); await(true)}) await(1) else ??? diff --git a/src/test/scala/scala/async/run/ifelse0/WhileSpec.scala b/src/test/scala/scala/async/run/ifelse0/WhileSpec.scala index 9ba0b69..44d84d7 100644 --- a/src/test/scala/scala/async/run/ifelse0/WhileSpec.scala +++ b/src/test/scala/scala/async/run/ifelse0/WhileSpec.scala @@ -12,7 +12,7 @@ import scala.async.internal.AsyncId class WhileSpec { @Test - def whiling1() { + def whiling1(): Unit = { import AsyncId._ val result = async { @@ -28,7 +28,7 @@ class WhileSpec { } @Test - def whiling2() { + def whiling2(): Unit = { import AsyncId._ val result = async { @@ -44,7 +44,7 @@ class WhileSpec { } @Test - def nestedWhile() { + def nestedWhile(): Unit = { import AsyncId._ val result = async { @@ -64,7 +64,7 @@ class WhileSpec { } @Test - def whileExpr() { + def whileExpr(): Unit = { import AsyncId._ val result = async { @@ -77,7 +77,7 @@ class WhileSpec { result mustBe () } - @Test def doWhile() { + @Test def doWhile(): Unit = { import AsyncId._ val result = async { var b = 0 @@ -93,7 +93,7 @@ class WhileSpec { result mustBe "123123" } - @Test def whileAwaitCondition() { + @Test def whileAwaitCondition(): Unit = { import AsyncId._ val result = async { var b = true @@ -105,7 +105,7 @@ class WhileSpec { result mustBe false } - @Test def doWhileAwaitCondition() { + @Test def doWhileAwaitCondition(): Unit = { import AsyncId._ val result = async { var b = true diff --git a/src/test/scala/scala/async/run/ifelse1/IfElse1.scala b/src/test/scala/scala/async/run/ifelse1/IfElse1.scala index 855f767..0991397 100644 --- a/src/test/scala/scala/async/run/ifelse1/IfElse1.scala +++ b/src/test/scala/scala/async/run/ifelse1/IfElse1.scala @@ -161,7 +161,7 @@ class TestIfElse1Class { class IfElse1Spec { @Test - def `await in a nested if-else expression`() { + def `await in a nested if-else expression`(): Unit = { val o = new TestIfElse1Class val fut = o.m1(10) val res = Await.result(fut, 2 seconds) @@ -169,7 +169,7 @@ class IfElse1Spec { } @Test - def `await in a nested if-else expression 2`() { + def `await in a nested if-else expression 2`(): Unit = { val o = new TestIfElse1Class val fut = o.m2(10) val res = Await.result(fut, 2 seconds) @@ -178,7 +178,7 @@ class IfElse1Spec { @Test - def `await in a nested if-else expression 3`() { + def `await in a nested if-else expression 3`(): Unit = { val o = new TestIfElse1Class val fut = o.m3(10) val res = Await.result(fut, 2 seconds) @@ -187,7 +187,7 @@ class IfElse1Spec { @Test - def `await in a nested if-else expression 4`() { + def `await in a nested if-else expression 4`(): Unit = { val o = new TestIfElse1Class val fut = o.m4(10) val res = Await.result(fut, 2 seconds) @@ -195,7 +195,7 @@ class IfElse1Spec { } @Test - def `await in deeply-nested if-else conditions`() { + def `await in deeply-nested if-else conditions`(): Unit = { val o = new TestIfElse1Class val fut = o.m5 val res = Await.result(fut, 2 seconds) diff --git a/src/test/scala/scala/async/run/ifelse2/ifelse2.scala b/src/test/scala/scala/async/run/ifelse2/ifelse2.scala index 19035ef..4c23a99 100644 --- a/src/test/scala/scala/async/run/ifelse2/ifelse2.scala +++ b/src/test/scala/scala/async/run/ifelse2/ifelse2.scala @@ -38,7 +38,7 @@ class TestIfElse2Class { class IfElse2Spec { @Test - def `variables of the same name in different blocks`() { + def `variables of the same name in different blocks`(): Unit = { val o = new TestIfElse2Class val fut = o.m(10) val res = Await.result(fut, 2 seconds) diff --git a/src/test/scala/scala/async/run/ifelse3/IfElse3.scala b/src/test/scala/scala/async/run/ifelse3/IfElse3.scala index 2f9ae1c..2f25a73 100644 --- a/src/test/scala/scala/async/run/ifelse3/IfElse3.scala +++ b/src/test/scala/scala/async/run/ifelse3/IfElse3.scala @@ -41,7 +41,7 @@ class TestIfElse3Class { class IfElse3Spec { @Test - def `variables of the same name in different blocks`() { + def `variables of the same name in different blocks`(): Unit = { val o = new TestIfElse3Class val fut = o.m(10) val res = Await.result(fut, 2 seconds) diff --git a/src/test/scala/scala/async/run/ifelse4/IfElse4.scala b/src/test/scala/scala/async/run/ifelse4/IfElse4.scala index 96fc14c..27ff5e0 100644 --- a/src/test/scala/scala/async/run/ifelse4/IfElse4.scala +++ b/src/test/scala/scala/async/run/ifelse4/IfElse4.scala @@ -54,7 +54,7 @@ class TestIfElse4Class { class IfElse4Spec { @Test - def `await result with complex type containing skolem`() { + def `await result with complex type containing skolem`(): Unit = { val o = new TestIfElse4Class val fut = o.run(o.K(null)) val res = Await.result(fut, 2 seconds) diff --git a/src/test/scala/scala/async/run/lazyval/LazyValSpec.scala b/src/test/scala/scala/async/run/lazyval/LazyValSpec.scala index c91508e..69c5187 100644 --- a/src/test/scala/scala/async/run/lazyval/LazyValSpec.scala +++ b/src/test/scala/scala/async/run/lazyval/LazyValSpec.scala @@ -11,7 +11,7 @@ import scala.async.internal.AsyncId._ class LazyValSpec { @Test - def lazyValAllowed() { + def lazyValAllowed(): Unit = { val result = async { var x = 0 lazy val y = { x += 1; 42 } diff --git a/src/test/scala/scala/async/run/live/LiveVariablesSpec.scala b/src/test/scala/scala/async/run/live/LiveVariablesSpec.scala index 5497b07..9b36faa 100644 --- a/src/test/scala/scala/async/run/live/LiveVariablesSpec.scala +++ b/src/test/scala/scala/async/run/live/LiveVariablesSpec.scala @@ -22,7 +22,7 @@ class LiveVariablesSpec { AsyncTestLV.clear() @Test - def `zero out fields of reference type`() { + def `zero out fields of reference type`(): Unit = { val f = async { Cell(1) } def m1(x: Cell[Int]): Cell[Int] = @@ -46,7 +46,7 @@ class LiveVariablesSpec { } @Test - def `zero out fields of type Any`() { + def `zero out fields of type Any`(): Unit = { val f = async { Cell(1) } def m1(x: Cell[Int]): Cell[Int] = @@ -70,7 +70,7 @@ class LiveVariablesSpec { } @Test - def `do not zero out fields of primitive type`() { + def `do not zero out fields of primitive type`(): Unit = { val f = async { 1 } def m1(x: Int): Cell[Int] = @@ -94,7 +94,7 @@ class LiveVariablesSpec { } @Test - def `zero out fields of value class type`() { + def `zero out fields of value class type`(): Unit = { val f = async { Cell(1) } def m1(x: Cell[Int]): Meter = @@ -118,7 +118,7 @@ class LiveVariablesSpec { } @Test - def `zero out fields after use in loop`() { + def `zero out fields after use in loop`(): Unit = { val f = async { MCell(1) } def m1(x: MCell[Int], y: Int): Int = @@ -151,7 +151,7 @@ class LiveVariablesSpec { } @Test - def `don't zero captured fields captured lambda`() { + def `don't zero captured fields captured lambda`(): Unit = { val f = async { val x = "x" val y = "y" @@ -167,7 +167,7 @@ class LiveVariablesSpec { } @Test - def `don't zero captured fields captured by-name`() { + def `don't zero captured fields captured by-name`(): Unit = { def func0[A](a: => A): () => A = () => a val f = async { val x = "x" @@ -184,7 +184,7 @@ class LiveVariablesSpec { } @Test - def `don't zero captured fields nested class`() { + def `don't zero captured fields nested class`(): Unit = { def func0[A](a: => A): () => A = () => a val f = async { val x = "x" @@ -203,7 +203,7 @@ class LiveVariablesSpec { } @Test - def `don't zero captured fields nested object`() { + def `don't zero captured fields nested object`(): Unit = { def func0[A](a: => A): () => A = () => a val f = async { val x = "x" @@ -222,7 +222,7 @@ class LiveVariablesSpec { } @Test - def `don't zero captured fields nested def`() { + def `don't zero captured fields nested def`(): Unit = { val f = async { val x = "x" val y = "y" @@ -239,7 +239,7 @@ class LiveVariablesSpec { } @Test - def `capture bug`() { + def `capture bug`(): Unit = { sealed trait Base case class B1() extends Base case class B2() extends Base diff --git a/src/test/scala/scala/async/run/match0/Match0.scala b/src/test/scala/scala/async/run/match0/Match0.scala index 824391f..ab0612e 100644 --- a/src/test/scala/scala/async/run/match0/Match0.scala +++ b/src/test/scala/scala/async/run/match0/Match0.scala @@ -54,21 +54,21 @@ class TestMatchClass { class MatchSpec { - @Test def `support await in a simple match expression`() { + @Test def `support await in a simple match expression`(): Unit = { val o = new TestMatchClass val fut = o.m2(10) // matches first case val res = Await.result(fut, 2 seconds) res mustBe (14) } - @Test def `support await in a simple match expression 2`() { + @Test def `support await in a simple match expression 2`(): Unit = { val o = new TestMatchClass val fut = o.m3(1) // matches second case val res = Await.result(fut, 2 seconds) res mustBe (5) } - @Test def `support await in a match expression with binds`() { + @Test def `support await in a match expression with binds`(): Unit = { val result = AsyncId.async { val x = 1 Option(x) match { @@ -81,7 +81,7 @@ class MatchSpec { result mustBe (2) } - @Test def `support await referring to pattern matching vals`() { + @Test def `support await referring to pattern matching vals`(): Unit = { import AsyncId.{async, await} val result = async { val x = 1 @@ -99,7 +99,7 @@ class MatchSpec { result mustBe ((Some(""), true)) } - @Test def `await in scrutinee`() { + @Test def `await in scrutinee`(): Unit = { import AsyncId.{async, await} val result = async { await(if ("".isEmpty) await(1) else ???) match { @@ -110,7 +110,7 @@ class MatchSpec { result mustBe (3) } - @Test def duplicateBindName() { + @Test def duplicateBindName(): Unit = { import AsyncId.{async, await} def m4(m: Any) = async { m match { @@ -123,7 +123,7 @@ class MatchSpec { m4("") mustBe 0 } - @Test def bugCastBoxedUnitToStringMatch() { + @Test def bugCastBoxedUnitToStringMatch(): Unit = { import scala.async.internal.AsyncId.{async, await} def foo = async { val p2 = await(5) @@ -135,7 +135,7 @@ class MatchSpec { foo mustBe "5" } - @Test def bugCastBoxedUnitToStringIf() { + @Test def bugCastBoxedUnitToStringIf(): Unit = { import scala.async.internal.AsyncId.{async, await} def foo = async { val p2 = await(5) diff --git a/src/test/scala/scala/async/run/nesteddef/NestedDef.scala b/src/test/scala/scala/async/run/nesteddef/NestedDef.scala index 69e741d..d714e52 100644 --- a/src/test/scala/scala/async/run/nesteddef/NestedDef.scala +++ b/src/test/scala/scala/async/run/nesteddef/NestedDef.scala @@ -8,7 +8,7 @@ import scala.async.internal.AsyncId class NestedDef { @Test - def nestedDef() { + def nestedDef(): Unit = { import AsyncId._ val result = async { val a = 0 @@ -23,7 +23,7 @@ class NestedDef { @Test - def nestedFunction() { + def nestedFunction(): Unit = { import AsyncId._ val result = async { val a = 0 @@ -38,7 +38,7 @@ class NestedDef { // We must lift `foo` and `bar` in the next two tests. @Test - def nestedDefTransitive1() { + def nestedDefTransitive1(): Unit = { import AsyncId._ val result = async { val a = 0 @@ -51,7 +51,7 @@ class NestedDef { } @Test - def nestedDefTransitive2() { + def nestedDefTransitive2(): Unit = { import AsyncId._ val result = async { val a = 0 @@ -66,7 +66,7 @@ class NestedDef { // checking that our use/definition analysis doesn't cycle. @Test - def mutuallyRecursive1() { + def mutuallyRecursive1(): Unit = { import AsyncId._ val result = async { val a = 0 @@ -80,7 +80,7 @@ class NestedDef { // checking that our use/definition analysis doesn't cycle. @Test - def mutuallyRecursive2() { + def mutuallyRecursive2(): Unit = { import AsyncId._ val result = async { val a = 0 diff --git a/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala b/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala index 669eee2..65497ef 100644 --- a/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala +++ b/src/test/scala/scala/async/run/noawait/NoAwaitSpec.scala @@ -12,7 +12,7 @@ import org.junit.Test class NoAwaitSpec { @Test - def `async block without await`() { + def `async block without await`(): Unit = { def foo = 1 async { foo @@ -21,7 +21,7 @@ class NoAwaitSpec { } @Test - def `async block without await 2`() { + def `async block without await 2`(): Unit = { async { def x = 0 if (x > 0) 0 else 1 @@ -29,7 +29,7 @@ class NoAwaitSpec { } @Test - def `async expr without await`() { + def `async expr without await`(): Unit = { def foo = 1 async(foo) mustBe (foo) } diff --git a/src/test/scala/scala/async/run/stackoverflow/StackOverflowSpec.scala b/src/test/scala/scala/async/run/stackoverflow/StackOverflowSpec.scala index c0850d6..2bd41bd 100644 --- a/src/test/scala/scala/async/run/stackoverflow/StackOverflowSpec.scala +++ b/src/test/scala/scala/async/run/stackoverflow/StackOverflowSpec.scala @@ -13,7 +13,7 @@ import scala.async.internal.AsyncId class StackOverflowSpec { @Test - def stackSafety() { + def stackSafety(): Unit = { import AsyncId._ async { var i = 100000000 diff --git a/src/test/scala/scala/async/run/toughtype/ToughType.scala b/src/test/scala/scala/async/run/toughtype/ToughType.scala index 50c6300..c4582fa 100644 --- a/src/test/scala/scala/async/run/toughtype/ToughType.scala +++ b/src/test/scala/scala/async/run/toughtype/ToughType.scala @@ -29,13 +29,13 @@ object ToughTypeObject { class ToughTypeSpec { - @Test def `propogates tough types`() { + @Test def `propogates tough types`(): Unit = { val fut = ToughTypeObject.m2 val res: (List[_], scala.async.run.toughtype.ToughTypeObject.Inner) = Await.result(fut, 2 seconds) res._1 mustBe (Nil) } - @Test def patternMatchingPartialFunction() { + @Test def patternMatchingPartialFunction(): Unit = { import AsyncId.{await, async} async { await(1) @@ -45,7 +45,7 @@ class ToughTypeSpec { } mustBe 3 } - @Test def patternMatchingPartialFunctionNested() { + @Test def patternMatchingPartialFunctionNested(): Unit = { import AsyncId.{await, async} async { await(1) @@ -56,7 +56,7 @@ class ToughTypeSpec { } mustBe -3 } - @Test def patternMatchingFunction() { + @Test def patternMatchingFunction(): Unit = { import AsyncId.{await, async} async { await(1) @@ -66,7 +66,7 @@ class ToughTypeSpec { } mustBe 3 } - @Test def existentialBindIssue19() { + @Test def existentialBindIssue19(): Unit = { import AsyncId.{await, async} def m7(a: Any) = async { a match { @@ -80,7 +80,7 @@ class ToughTypeSpec { m7(Nil) mustBe 0 } - @Test def existentialBind2Issue19() { + @Test def existentialBind2Issue19(): Unit = { import scala.async.Async._, scala.concurrent.ExecutionContext.Implicits.global def conjure[T]: T = null.asInstanceOf[T] @@ -94,7 +94,7 @@ class ToughTypeSpec { } } - @Test def singletonTypeIssue17() { + @Test def singletonTypeIssue17(): Unit = { import AsyncId.{async, await} class A { class B } async { @@ -104,7 +104,7 @@ class ToughTypeSpec { } } - @Test def existentialMatch() { + @Test def existentialMatch(): Unit = { import AsyncId.{async, await} trait Container[+A] case class ContainerImpl[A](value: A) extends Container[A] @@ -120,7 +120,7 @@ class ToughTypeSpec { foo } - @Test def existentialIfElse0() { + @Test def existentialIfElse0(): Unit = { import AsyncId.{async, await} trait Container[+A] case class ContainerImpl[A](value: A) extends Container[A] @@ -151,7 +151,7 @@ class ToughTypeSpec { // We compensated in `Lifter` by copying `ValDef` parameter symbols directly across. // // Turns out the behaviour stems from `thisMethodType` in `Namers`, which treats type parameter skolem symbols. - @Test def nestedMethodWithInconsistencyTreeAndInfoParamSymbols() { + @Test def nestedMethodWithInconsistencyTreeAndInfoParamSymbols(): Unit = { import language.{reflectiveCalls, postfixOps} import scala.concurrent.{Future, ExecutionContext, Await} import scala.concurrent.duration._ @@ -214,7 +214,7 @@ class ToughTypeSpec { } - @Test def ticket66Nothing() { + @Test def ticket66Nothing(): Unit = { import scala.concurrent.Future import scala.concurrent.ExecutionContext.Implicits.global val e = new Exception() @@ -229,7 +229,7 @@ class ToughTypeSpec { } } - @Test def ticket83ValueClass() { + @Test def ticket83ValueClass(): Unit = { import scala.async.Async._ import scala.concurrent._, duration._, ExecutionContext.Implicits.global val f = async { @@ -240,7 +240,7 @@ class ToughTypeSpec { result mustEqual (new IntWrapper("foo")) } - @Test def ticket86NestedValueClass() { + @Test def ticket86NestedValueClass(): Unit = { import ExecutionContext.Implicits.global val f = async { diff --git a/src/test/scala/scala/async/run/uncheckedBounds/UncheckedBoundsSpec.scala b/src/test/scala/scala/async/run/uncheckedBounds/UncheckedBoundsSpec.scala index e728242..ea24995 100644 --- a/src/test/scala/scala/async/run/uncheckedBounds/UncheckedBoundsSpec.scala +++ b/src/test/scala/scala/async/run/uncheckedBounds/UncheckedBoundsSpec.scala @@ -6,7 +6,7 @@ import org.junit.{Test, Assert} import scala.async.TreeInterrogation class UncheckedBoundsSpec { - @Test def insufficientLub_SI_7694() { + @Test def insufficientLub_SI_7694(): Unit = { eval( s""" object Test { import _root_.scala.async.run.toughtype._ @@ -18,7 +18,7 @@ class UncheckedBoundsSpec { """, compileOptions = s"-cp ${toolboxClasspath} ") } - @Test def insufficientLub_SI_7694_ScalaConcurrent() { + @Test def insufficientLub_SI_7694_ScalaConcurrent(): Unit = { eval( s""" object Test { import _root_.scala.async.run.toughtype._ -- cgit v1.2.3