Skip to content

Commit

Permalink
Drop procedure syntax from test/ using ScalaFix
Browse files Browse the repository at this point in the history
```
$ coursier launch ch.epfl.scala:scalafix-cli_2.12.3:0.5.3 -- -r ProcedureSyntax test
$ coursier launch ch.epfl.scala:scalafix-cli_2.12.4:0.5.10 -- -r ExplicitUnit test
```
  • Loading branch information
eed3si9n authored and adriaanm committed Apr 10, 2018
1 parent f983b5c commit e13047c
Show file tree
Hide file tree
Showing 849 changed files with 1,827 additions and 1,827 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BitManipulationBenchmark {

//////////////////////////////////////////////

@Benchmark def withIntegerBitCount(bh: Blackhole) {
@Benchmark def withIntegerBitCount(bh: Blackhole): Unit = {
for (v <- powersOfTwo) {
val leadingZeros = withIntegerBitCount(v)
// assert (leadingZeros == withLoop(v), s"$leadingZeros != ${withLoop(v)} ($v)")
Expand All @@ -30,7 +30,7 @@ class BitManipulationBenchmark {

//////////////////////////////////////////////

@Benchmark def withIntegerNumberOfLeadingZeros(bh: Blackhole) {
@Benchmark def withIntegerNumberOfLeadingZeros(bh: Blackhole): Unit = {
for (v <- powersOfTwo) {
val leadingZeros = withIntegerNumberOfLeadingZeros(v)
// assert (leadingZeros == withLoop(v), s"$leadingZeros != ${withLoop(v)} ($v)")
Expand All @@ -42,7 +42,7 @@ class BitManipulationBenchmark {

//////////////////////////////////////////////

@Benchmark def withLoop(bh: Blackhole) {
@Benchmark def withLoop(bh: Blackhole): Unit = {
for (v <- powersOfTwo) {
val leadingZeros = withLoop(v)
bh.consume(leadingZeros)
Expand All @@ -61,7 +61,7 @@ class BitManipulationBenchmark {

//////////////////////////////////////////////

@Benchmark def withMatch(bh: Blackhole) {
@Benchmark def withMatch(bh: Blackhole): Unit = {
for (v <- powersOfTwo) {
val leadingZeros = withMatch(v)
// assert (leadingZeros == withLoop(v), s"$leadingZeros != ${withLoop(v)} ($v)")
Expand Down Expand Up @@ -106,7 +106,7 @@ class BitManipulationBenchmark {

//////////////////////////////////////////////

@Benchmark def with2DeBruijn(bh: Blackhole) {
@Benchmark def with2DeBruijn(bh: Blackhole): Unit = {
for (v <- powersOfTwo) {
val leadingZeros = with2DeBruijn(v)
// assert (leadingZeros == withLoop(v), s"$leadingZeros != ${withLoop(v)} ($v)")
Expand All @@ -122,7 +122,7 @@ class BitManipulationBenchmark {

//////////////////////////////////////////////

@Benchmark def withBinSearch(bh: Blackhole) {
@Benchmark def withBinSearch(bh: Blackhole): Unit = {
for (v <- powersOfTwo) {
val leadingZeros = withBinSearch(v)
// assert (leadingZeros == withLoop(v), s"$leadingZeros != ${withLoop(v)} ($v)")
Expand Down Expand Up @@ -150,7 +150,7 @@ class BitManipulationBenchmark {

//////////////////////////////////////////////

@Benchmark def withSumBinSearch(bh: Blackhole) {
@Benchmark def withSumBinSearch(bh: Blackhole): Unit = {
for (v <- powersOfTwo) {
val leadingZeros = withSumBinSearch(v)
// assert(leadingZeros == withLoop(v), s"$leadingZeros != ${withLoop(v)} ($v)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private object OpenHashMapBenchmark {
var maps: Array[OpenHashMap[K,Int]] = null

@Setup
def threadSetup(params: BenchmarkParams) {
def threadSetup(params: BenchmarkParams): Unit = {
size = params.getParam("size").toInt
val n = math.ceil(minNanosPerInvocation / (nanosPerPut * size)).toInt
_mapEntries = size * n
Expand All @@ -66,12 +66,12 @@ private object OpenHashMapBenchmark {
}

@Setup(Level.Iteration)
def iterationSetup {
def iterationSetup: Unit = {
_operations = 0
}

@Setup(Level.Invocation)
def setup(params: IterationParams) {
def setup(params: IterationParams): Unit = {
for (i <- 0 until maps.length) maps(i) = new OpenHashMap[K,Int](size)

if (params.getType == IterationType.MEASUREMENT) {
Expand All @@ -81,7 +81,7 @@ private object OpenHashMapBenchmark {
}

@TearDown(Level.Iteration)
def iterationTeardown(params: IterationParams) {
def iterationTeardown(params: IterationParams): Unit = {
if (params.getType == IterationType.MEASUREMENT) {
// limit to smaller cases to avoid OOM
_memory =
Expand All @@ -108,7 +108,7 @@ private object OpenHashMapBenchmark {

/** Load the map with keys from `1` to `size`. */
@Setup
def setup(params: BenchmarkParams) {
def setup(params: BenchmarkParams): Unit = {
val size = params.getParam("size").toInt
_keys = keyBuilder.build(size)
put(map, keys, 0, size)
Expand All @@ -133,7 +133,7 @@ private object OpenHashMapBenchmark {

/** Load the map with keys from `1` to `size`, removing half of them. */
@Setup
def setup(params: BenchmarkParams) {
def setup(params: BenchmarkParams): Unit = {
val size = params.getParam("size").toInt
_keys = keyBuilder.build(size)
put_remove(map, keys)
Expand Down Expand Up @@ -172,7 +172,7 @@ private object OpenHashMapBenchmark {
* @param from lowest index in the range of keys to add
* @param to highest index in the range of keys to add, plus one
*/
private[this] def put[K](map: OpenHashMap[K,Int], keys: KeySeq[K], from: Int, to: Int) {
private[this] def put[K](map: OpenHashMap[K,Int], keys: KeySeq[K], from: Int, to: Int): Unit = {
var i = from
while (i < to) { // using a `for` expression instead adds significant overhead
map.put(keys(i), i)
Expand All @@ -190,7 +190,7 @@ private object OpenHashMapBenchmark {
*
* @param keys list of keys to use
*/
private def put_remove[K](map: OpenHashMap[K,Int], keys: KeySeq[K]) {
private def put_remove[K](map: OpenHashMap[K,Int], keys: KeySeq[K]): Unit = {
val blocks = 25 // should be a non-trivial factor of `size`
val size = keys.size
val blockSize: Int = size / blocks
Expand Down Expand Up @@ -241,7 +241,7 @@ class OpenHashMapBenchmark {

/** Test putting elements to a map of `Int` to `Int`. */
@Benchmark
def put_Int(state: IntBulkPutState) {
def put_Int(state: IntBulkPutState): Unit = {
var i = 0
while (i < state.maps.length) {
put(state.maps(i), state.keys)
Expand All @@ -251,7 +251,7 @@ class OpenHashMapBenchmark {

/** Test putting and removing elements to a growing map of `Int` to `Int`. */
@Benchmark
def put_remove_Int(state: IntBulkPutState) {
def put_remove_Int(state: IntBulkPutState): Unit = {
var i = 0
while (i < state.maps.length) {
put_remove(state.maps(i), state.keys)
Expand All @@ -276,7 +276,7 @@ class OpenHashMapBenchmark {

/** Test putting elements to a map of `AnyRef` to `Int`. */
@Benchmark
def put_AnyRef(state: AnyRefBulkPutState) {
def put_AnyRef(state: AnyRefBulkPutState): Unit = {
var i = 0
while (i < state.maps.length) {
put(state.maps(i), state.keys)
Expand All @@ -286,7 +286,7 @@ class OpenHashMapBenchmark {

/** Test putting and removing elements to a growing map of `AnyRef` to `Int`. */
@Benchmark
def put_remove_AnyRef(state: AnyRefBulkPutState) {
def put_remove_AnyRef(state: AnyRefBulkPutState): Unit = {
var i = 0
while (i < state.maps.length) {
put_remove(state.maps(i), state.keys)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ object OpenHashMapRunner extends JmhRunner {
private[this] def stats(r: Result[_]) = r.getScore + " " + r.getStatistics.getStandardDeviation


def main(args: Array[String]) {
def main(args: Array[String]): Unit = {
import scala.collection.JavaConversions._

val opts = new CommandLineOptions(args: _*)
Expand Down Expand Up @@ -95,7 +95,7 @@ object OpenHashMapRunner extends JmhRunner {
}
}

private[this] def outputDataset(f: PrintWriter, label: String, dataset: Iterable[RunResult]) {
private[this] def outputDataset(f: PrintWriter, label: String, dataset: Iterable[RunResult]): Unit = {
f.println(s"# [$label]")

val isMemoryUsageDataset = label.endsWith(memoryDatasetQualifier)
Expand Down
2 changes: 1 addition & 1 deletion test/files/bench/equality/eq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object eq extends testing.Benchmark {
val obj1 = new Object
val obj2 = new Object

def run() {
def run(): Unit = {
var sum = 0
sum += eqtest(x => if (x == 0) obj1 else obj2, 2000)
sum += eqtest(x => x, 1000)
Expand Down
2 changes: 1 addition & 1 deletion test/files/bench/equality/eqeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object eqeq extends testing.Benchmark {
val obj1 = new Object
val obj2 = new Object

def run() {
def run(): Unit = {
var sum = 0
sum += eqeqtest(x => if (x == 0) obj1 else obj2, 2000)
sum += eqeqtest(x => x, 1000)
Expand Down
2 changes: 1 addition & 1 deletion test/files/instrumented/InstrumentationTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ package instrumented {

/** Tests if instrumentation itself works correctly */
object Test {
def main(args: Array[String]) {
def main(args: Array[String]): Unit = {
if (scala.tools.partest.utils.Properties.isAvian) {
println("!!!TEST SKIPPED!!!")
println("Instrumentation is not supported on Avian.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package instrumented

object MyPredef {
@inline
final def assert(assertion: Boolean, message: => Any) {
final def assert(assertion: Boolean, message: => Any): Unit = {
if (!assertion)
throw new java.lang.AssertionError("assertion failed: " + message)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import scala.tools.partest.instrumented.Instrumentation._
import instrumented._

object Test {
def main(args: Array[String]) {
def main(args: Array[String]): Unit = {
if (scala.tools.partest.utils.Properties.isAvian) {
println("!!!TEST SKIPPED!!!")
println("Instrumentation is not supported on Avian.")
Expand Down
2 changes: 1 addition & 1 deletion test/files/instrumented/t6611.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import scala.tools.partest.instrumented.Instrumentation._

object Test {
def main(args: Array[String]) {
def main(args: Array[String]): Unit = {
startProfiling()

// tests optimization in Cleanup for varargs reference arrays
Expand Down
18 changes: 9 additions & 9 deletions test/files/jvm/annotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object Test2 {
@throws(classOf[IOException])
def read() = in.read()
}
def run {
def run: Unit = {
val method = classOf[Reader].getMethod("read")
method.getExceptionTypes foreach println
}
Expand All @@ -32,7 +32,7 @@ object Test3 {
@Deprecated
def foo: Unit = ()
}
def run {
def run: Unit = {
val method = classOf[Foo].getMethod("foo")
val annotation = method.getAnnotation(classOf[Deprecated])
println(annotation)
Expand Down Expand Up @@ -103,15 +103,15 @@ object Test4 {
class Foo10(@SourceAnnotation("on param 1") val name: String)
class Foo11(@(SourceAnnotation @scala.annotation.meta.field)("on param 2") val name: String)
class Foo12(@(SourceAnnotation @scala.annotation.meta.setter)("on param 3") var name: String)
def run {
def run: Unit = {
import java.lang.annotation.Annotation
import java.lang.reflect.AnnotatedElement
def printSourceAnnotation(a: Annotation) {
def printSourceAnnotation(a: Annotation): Unit = {
val ann = a.asInstanceOf[SourceAnnotation]
println("@test.SourceAnnotation(mails=" + ann.mails.deep.mkString("{", ",", "}") +
", value=" + ann.value + ")")
}
def printSourceAnnotations(target: AnnotatedElement) {
def printSourceAnnotations(target: AnnotatedElement): Unit = {
//print SourceAnnotation in a predefined way to insure
// against difference in the JVMs (e.g. Sun's vs IBM's)
val anns = target.getAnnotations()
Expand All @@ -121,7 +121,7 @@ object Test4 {
println
}
}
def printParamSourceAnnotations(target: { def getParameterAnnotations(): Array[Array[Annotation]] }) {
def printParamSourceAnnotations(target: { def getParameterAnnotations(): Array[Array[Annotation]] }): Unit = {
val anns = target.getParameterAnnotations().flatten
anns foreach printSourceAnnotation
if (anns.length > 0) {
Expand Down Expand Up @@ -171,7 +171,7 @@ object Test5 {
def get = getter.invoke(this).asInstanceOf[Integer].intValue
def set(n: Int) = setter.invoke(this, new Integer(n))
}
def run {
def run: Unit = {
val count = new Count
println(count.get)
count.set(99)
Expand All @@ -187,7 +187,7 @@ object Test6 {
@BeanProperty val m: Int = if (prop) 1 else 2
}

def run {
def run: Unit = {
val c = new C("bob")
c.setText("dylan")
println(c.getText())
Expand All @@ -203,7 +203,7 @@ object Test6 {
class A3345(@volatile private var i:Int)

object Test {
def main(args: Array[String]) {
def main(args: Array[String]): Unit = {
Test2.run
Test3.run // requires the use of -target:jvm-1.5
Test4.run
Expand Down
6 changes: 3 additions & 3 deletions test/files/jvm/bigints.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* @author Stephane Micheloud
*/
object Test {
def main(args: Array[String]) {
def main(args: Array[String]): Unit = {
Test_BigInt.runTest()
Test_BigDecimal.runTest()
}
}

object Test_BigInt {
def runTest() {
def runTest(): Unit = {
import BigInt._

val x: BigInt = 1
Expand All @@ -26,7 +26,7 @@ object Test_BigInt {
}

object Test_BigDecimal {
def runTest() {
def runTest(): Unit = {
import scala.BigDecimal, BigDecimal._

val xi: BigDecimal = 1
Expand Down
4 changes: 2 additions & 2 deletions test/files/jvm/deprecation/Test_1.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Test {
def test {
def test: Unit = {
val d = new Defs
val u = d.i + 1
d.i = 2
Expand All @@ -14,4 +14,4 @@ class Test {
}
}

object Test { def main(args: Array[String]) { } }
object Test { def main(args: Array[String]): Unit = { } }
2 changes: 1 addition & 1 deletion test/files/jvm/future-spec/FutureTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ class FutureTests extends MinimalScalaTest {

"fold mutable zeroes safely" in {
import scala.collection.mutable.ArrayBuffer
def test(testNumber: Int) {
def test(testNumber: Int): Unit = {
val fs = (0 to 1000) map (i => Future(i))
val f = Future.foldLeft(fs)(ArrayBuffer.empty[AnyRef]) {
case (l, i) if i % 2 == 0 => l += i.asInstanceOf[AnyRef]
Expand Down
4 changes: 2 additions & 2 deletions test/files/jvm/future-spec/PromiseTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class PromiseTests extends MinimalScalaTest {
futureWithResult(_(future, result))
}

def futureWithResult(f: ((Future[Any], Any) => Unit) => Unit) {
def futureWithResult(f: ((Future[Any], Any) => Unit) => Unit): Unit = {

"be completed" in { f((future, _) => future.isCompleted mustBe (true)) }

Expand Down Expand Up @@ -210,7 +210,7 @@ class PromiseTests extends MinimalScalaTest {

}

def futureWithException[E <: Throwable: Manifest](f: ((Future[Any], String) => Unit) => Unit) {
def futureWithException[E <: Throwable: Manifest](f: ((Future[Any], String) => Unit) => Unit): Unit = {

"be completed" in {
f((future, _) => future.isCompleted mustBe (true))
Expand Down
4 changes: 2 additions & 2 deletions test/files/jvm/future-spec/main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.util.concurrent.{ TimeoutException, CountDownLatch, TimeUnit }

object Test {

def main(args: Array[String]) {
def main(args: Array[String]): Unit = {
(new FutureTests).check()
(new PromiseTests).check()
(new TryTests).check()
Expand Down Expand Up @@ -37,7 +37,7 @@ trait MinimalScalaTest extends Output with Features {

val throwables = mutable.ArrayBuffer[Throwable]()

def check() {
def check(): Unit = {
if (throwables.nonEmpty) println(buffer.toString)
}

Expand Down
Loading

0 comments on commit e13047c

Please sign in to comment.