From 073c8ef7dd6dff66587e3f03642c59c5348fd16c Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 26 Mar 2020 17:55:57 +0000 Subject: [PATCH] Fast-track deprecating auto-application Auto-application is dropped in Scala 3: https://dotty.epfl.ch/docs/reference/dropped-features/auto-apply.html So it must be deprecated in 2.13 first. Also, AFAICT Object_clone is Java-defined: $ qscala Welcome to Scala 2.13.2-20200325-150327-bc1cad4 (OpenJDK 64-Bit Server VM, Java 11.0.6). Type in expressions for evaluation. Or try :help. scala> :power Power mode enabled. :phase is at typer. import scala.tools.nsc._, intp.global._, definitions._ Try :help or completions for vals._ and power._ scala> Object_clone.isJavaDefined val res0: Boolean = true --- project/GenerateFunctionConverters.scala | 2 +- spec/03-types.md | 4 +- .../scala/tools/nsc/typechecker/Typers.scala | 26 ++++----- src/library/scala/collection/Iterator.scala | 2 +- .../scala/util/control/Exception.scala | 2 +- .../scala/tools/docutil/EmitManPage.scala | 6 +-- .../tools/partest/nest/FileManager.scala | 2 +- .../immutable/VectorIterationBenchmark.scala | 2 +- .../mutable/BitSetIteratorBenchmark.scala | 2 +- test/files/jvm/annotations/Test_2.scala | 4 +- test/files/jvm/console.scala | 2 +- test/files/jvm/future-spec/PromiseTests.scala | 2 +- test/files/jvm/scala-concurrent-tck.scala | 8 +-- test/files/jvm/serialization.scala | 2 +- test/files/jvm/throws-annot-from-java.check | 2 +- .../jvm/throws-annot-from-java/Test_3.scala | 2 +- test/files/jvm/typerep.scala | 16 +++--- test/files/jvm/unittest_io_Jvm.scala | 2 +- test/files/jvm/unreachable.check | 0 test/files/jvm/unreachable/Foo_1.scala | 14 ++--- test/files/neg/auto-application.check | 8 +++ test/files/neg/auto-application.scala | 6 +++ test/files/neg/checksensible.check | 8 +-- test/files/neg/checksensible.scala | 4 +- test/files/neg/delayed-init-ref.scala | 2 +- test/files/neg/t6120.scala | 2 +- test/files/pos/ifunc.scala | 4 +- test/files/pos/spec-asseenfrom.scala | 2 +- test/files/pos/t2691.scala | 4 +- test/files/pos/t4717.scala | 2 +- .../recursive-ask/RecursiveAsk.scala | 2 +- test/files/res/t722/ScanBased.scala | 4 +- test/files/run/Course-2002-01.scala | 10 ++-- test/files/run/Course-2002-02.scala | 54 +++++++++---------- test/files/run/Course-2002-03.scala | 30 +++++------ test/files/run/Course-2002-04.scala | 22 ++++---- test/files/run/Course-2002-05.scala | 22 ++++---- test/files/run/Course-2002-06.scala | 2 +- test/files/run/Course-2002-07.scala | 36 ++++++------- test/files/run/Course-2002-08.scala | 40 +++++++------- test/files/run/Course-2002-09.scala | 16 +++--- test/files/run/Course-2002-10.scala | 12 ++--- test/files/run/Course-2002-13.scala | 24 ++++----- test/files/run/QueueTest.scala | 16 +++--- test/files/run/SymbolsTest.scala | 2 +- test/files/run/UnrolledBuffer.scala | 6 +-- test/files/run/WeakHashSetTest.scala | 24 ++++----- test/files/run/analyzerPlugins.check | 4 +- test/files/run/analyzerPlugins.scala | 6 +-- test/files/run/bitsets.scala | 10 ++-- test/files/run/boolexprs.scala | 4 +- test/files/run/bridges.scala | 6 +-- test/files/run/bugs.scala | 6 +-- test/files/run/constant-optimization.scala | 8 +-- test/files/run/contrib674.scala | 2 +- test/files/run/deeps.scala | 10 ++-- test/files/run/enums.scala | 6 +-- test/files/run/exceptions.scala | 4 +- test/files/run/fors.scala | 44 +++++++-------- test/files/run/imports.scala | 10 ++-- test/files/run/iq.scala | 2 +- test/files/run/iterator3444.scala | 4 +- test/files/run/kmpSliceSearch.scala | 4 +- test/files/run/lisp.scala | 14 ++--- test/files/run/misc.scala | 22 ++++---- test/files/run/overloads.scala | 4 +- test/files/run/partialfun.scala | 4 +- test/files/run/patmat-exprs.scala | 40 +++++++------- .../files/run/patmat-mix-case-extractor.scala | 2 +- test/files/run/patmatnew.scala | 2 +- test/files/run/primitive-sigs-2-new.scala | 2 +- test/files/run/primitive-sigs-2-old.scala | 2 +- test/files/run/reify_fors_newpatmat.scala | 4 +- test/files/run/reify_fors_oldpatmat.scala | 4 +- test/files/run/reify_printf.scala | 4 +- test/files/run/repl-save.scala | 2 +- test/files/run/richs.scala | 2 +- test/files/run/runtime.scala | 26 ++++----- test/files/run/settings-parse.scala | 2 +- .../files/run/sip23-no-constant-folding.scala | 2 +- test/files/run/slices.scala | 12 ++--- test/files/run/streams.scala | 8 +-- test/files/run/t0325.scala | 6 +-- test/files/run/t10513.scala | 2 +- test/files/run/t1195-new.scala | 12 ++--- test/files/run/t1195-old.scala | 12 ++--- test/files/run/t1535.scala | 6 +-- test/files/run/t1909b.scala | 2 +- test/files/run/t2333.scala | 2 +- test/files/run/t2552.scala | 6 +-- test/files/run/t3242b.scala | 2 +- test/files/run/t3269.scala | 2 +- test/files/run/t3346e.scala | 2 +- test/files/run/t3530.scala | 2 +- test/files/run/t4054.scala | 22 ++++---- test/files/run/t4225d.scala | 8 +-- test/files/run/t4225e.scala | 6 +-- test/files/run/t4671.check | 6 +-- test/files/run/t4671.scala | 2 +- test/files/run/t4809.scala | 4 +- test/files/run/t5577.scala | 2 +- test/files/run/t5612.scala | 2 +- test/files/run/t5907.check | 2 - test/files/run/t5907.scala | 2 - test/files/run/t5923b/Test.scala | 2 +- test/files/run/t6240-universe-code-gen.scala | 2 +- test/files/run/t6669.scala | 2 +- test/files/run/t6863.check | 16 +++--- test/files/run/t6863.scala | 36 ++++++------- test/files/run/t8153.scala | 2 +- test/files/run/t9178a.scala | 2 +- test/files/run/tailcalls.scala | 12 ++--- test/files/run/try.scala | 2 +- test/files/run/type-currying.scala | 4 +- test/files/run/unittest_iterator.scala | 8 +-- test/files/run/unreachable.scala | 14 ++--- test/files/run/vector1.scala | 2 +- test/files/specialized/arrays-traits.scala | 4 +- test/files/specialized/fft.scala | 4 +- test/files/specialized/spec-matrix-new.scala | 4 +- test/files/specialized/spec-matrix-old.scala | 4 +- test/files/specialized/spec-super.scala | 6 +-- .../junit/scala/collection/IteratorTest.scala | 2 +- .../collection/SetMapConsistencyTest.scala | 2 +- .../collection/immutable/RangeTest.scala | 4 +- .../collection/immutable/VectorTest.scala | 8 +-- test/junit/scala/concurrent/FutureTest.scala | 4 +- test/junit/scala/io/SourceTest.scala | 2 +- .../nsc/reporters/ConsoleReporterTest.scala | 10 ++-- test/scalacheck/treemap.scala | 4 +- test/scalacheck/treeset.scala | 4 +- 131 files changed, 519 insertions(+), 513 deletions(-) delete mode 100644 test/files/jvm/unreachable.check create mode 100644 test/files/neg/auto-application.check create mode 100644 test/files/neg/auto-application.scala diff --git a/project/GenerateFunctionConverters.scala b/project/GenerateFunctionConverters.scala index a5e3dda95a6f..12271bfa1ecb 100644 --- a/project/GenerateFunctionConverters.scala +++ b/project/GenerateFunctionConverters.scala @@ -348,7 +348,7 @@ object GenerateFunctionConverters { def sameText(f: java.io.File, text: String): Boolean = { val x = scala.io.Source.fromFile(f) - val lines = try { x.getLines.toVector } finally { x.close } + val lines = try { x.getLines().toVector } finally { x.close } // work around scala/bug#11125 lines.iterator.filter(_.nonBlank) == Predef.augmentString(text).lines.filter(_.nonBlank) } diff --git a/spec/03-types.md b/spec/03-types.md index 7bef5c473bd7..a0face5b259b 100644 --- a/spec/03-types.md +++ b/spec/03-types.md @@ -685,7 +685,7 @@ An overloaded type consisting of type alternatives $T_1 \commadots T_n (n \geq 2 ###### Example ```scala -def println: Unit +def println(): Unit def println(s: String): Unit = $\ldots$ def println(x: Float): Unit = $\ldots$ def println(x: Float, width: Int): Unit = $\ldots$ @@ -694,7 +694,7 @@ def println[A](x: A)(tostring: A => String): Unit = $\ldots$ define a single function `println` which has an overloaded type. ``` -println: => Unit $\overload$ +println: () Unit $\overload$ (String) Unit $\overload$ (Float) Unit $\overload$ (Float, Int) Unit $\overload$ diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 5a9c2f8a1f7b..91e98412340a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -971,27 +971,23 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper } def matchNullaryLoosely: Boolean = { - def test(sym: Symbol) = - sym.isJavaDefined || - sym.owner == AnyClass || - sym == Object_clone + def test(sym: Symbol) = sym.isJavaDefined || sym.owner == AnyClass test(meth) || meth.overrides.exists(test) } - // (4.2) condition for auto-application by -Xsource level + + // (4.2) condition for auto-application // - // until 3.0: none (assuming condition for (4.3) was not met) - // in 3.0: `meth.isJavaDefined` - // (TODO decide -- currently the condition is more involved to give slack to Scala methods overriding Java-defined ones; - // I think we should resolve that by introducing slack in overriding e.g. a Java-defined `def toString()` by a Scala-defined `def toString`. - // This also works better for dealing with accessors overriding Java-defined methods. The current strategy in methodSig is problematic: - // > // Add a () parameter section if this overrides some method with () parameters - // > val vparamSymssOrEmptyParamsFromOverride = - // This means an accessor that overrides a Java-defined method gets a MethodType instead of a NullaryMethodType, which breaks lots of assumptions about accessors) + // Currently the condition is more involved to give slack to Scala methods overriding Java-defined ones; + // I (moors) think we should resolve that by introducing slack in overriding e.g. a Java-defined `def toString()` by a Scala-defined `def toString`. + // This also works better for dealing with accessors overriding Java-defined methods. The current strategy in methodSig is problematic: + // > // Add a () parameter section if this overrides some method with () parameters + // > val vparamSymssOrEmptyParamsFromOverride = + // This means an accessor that overrides a Java-defined method gets a MethodType instead of a NullaryMethodType, which breaks lots of assumptions about accessors) def checkCanAutoApply(): Boolean = { - if (sourceLevel3 && !isPastTyper && !matchNullaryLoosely) { + if (!isPastTyper && !matchNullaryLoosely) { context.deprecationWarning(tree.pos, NoSymbol, s"Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method ${meth.decodedName},\n" + s"or remove the empty argument list from its definition (Java-defined methods are exempt).\n"+ - s"In Scala 3, an unapplied method like this will be eta-expanded into a function.", "3.0.0") + s"In Scala 3, an unapplied method like this will be eta-expanded into a function.", "2.13.2") } true } diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala index a5849ac1d136..0de2d9cabb2e 100644 --- a/src/library/scala/collection/Iterator.scala +++ b/src/library/scala/collection/Iterator.scala @@ -40,7 +40,7 @@ import scala.runtime.Statics * {{{ * def f[A](it: Iterator[A]) = { * if (it.hasNext) { // Safe to reuse "it" after "hasNext" - * it.next // Safe to reuse "it" after "next" + * it.next() // Safe to reuse "it" after "next" * val remainder = it.drop(2) // it is *not* safe to use "it" again after this line! * remainder.take(2) // it is *not* safe to use "remainder" after this line! * } else it diff --git a/src/library/scala/util/control/Exception.scala b/src/library/scala/util/control/Exception.scala index 315ed5d90f35..c635261c8f53 100644 --- a/src/library/scala/util/control/Exception.scala +++ b/src/library/scala/util/control/Exception.scala @@ -60,7 +60,7 @@ import scala.language.implicitConversions * def printUrl(url: String) : Unit = { * val con = new URL(url) openConnection() * val source = scala.io.Source.fromInputStream(con.getInputStream()) - * source.getLines.foreach(println) + * source.getLines().foreach(println) * } * * val badUrl = "htt/xx" diff --git a/src/manual/scala/tools/docutil/EmitManPage.scala b/src/manual/scala/tools/docutil/EmitManPage.scala index 198892ca1598..e55d844c0d2a 100644 --- a/src/manual/scala/tools/docutil/EmitManPage.scala +++ b/src/manual/scala/tools/docutil/EmitManPage.scala @@ -70,9 +70,9 @@ object EmitManPage { for (d <- definitions) { out println ".TP" emitText(d.term) - out.println + out.println() emitText(d.description) - if (n > 1) { out.println; n -= 1 } + if (n > 1) { out.println(); n -= 1 } } case Link(label, url) => @@ -88,7 +88,7 @@ object EmitManPage { case TextParagraph(text) => out println ".PP" emitText(text) - out.println + out.println() case BlockQuote(text) => out println ".TP" diff --git a/src/partest/scala/tools/partest/nest/FileManager.scala b/src/partest/scala/tools/partest/nest/FileManager.scala index a0f2b4b5d0f0..202e6fff634b 100644 --- a/src/partest/scala/tools/partest/nest/FileManager.scala +++ b/src/partest/scala/tools/partest/nest/FileManager.scala @@ -72,7 +72,7 @@ object FileManager { * @return the unified diff of the compared files or the empty string if they're equal */ def compareFiles(original: File, revised: File): String = { - compareContents(io.Source.fromFile(original).getLines.toSeq, io.Source.fromFile(revised).getLines.toSeq, original.getName, revised.getName) + compareContents(io.Source.fromFile(original).getLines().toSeq, io.Source.fromFile(revised).getLines().toSeq, original.getName, revised.getName) } /** Compares two lists of lines using difflib to produce a unified diff. diff --git a/test/benchmarks/src/main/scala/scala/collection/immutable/VectorIterationBenchmark.scala b/test/benchmarks/src/main/scala/scala/collection/immutable/VectorIterationBenchmark.scala index 743db65a2ca6..edc380c8e200 100644 --- a/test/benchmarks/src/main/scala/scala/collection/immutable/VectorIterationBenchmark.scala +++ b/test/benchmarks/src/main/scala/scala/collection/immutable/VectorIterationBenchmark.scala @@ -31,7 +31,7 @@ class VectorIterationBenchmark { var i = 0 val it = value.iterator while (i < size) { - bh.consume(it.next) + bh.consume(it.next()) i += 1 } } diff --git a/test/benchmarks/src/main/scala/scala/collection/mutable/BitSetIteratorBenchmark.scala b/test/benchmarks/src/main/scala/scala/collection/mutable/BitSetIteratorBenchmark.scala index 617ddd56a303..c865ac51639d 100644 --- a/test/benchmarks/src/main/scala/scala/collection/mutable/BitSetIteratorBenchmark.scala +++ b/test/benchmarks/src/main/scala/scala/collection/mutable/BitSetIteratorBenchmark.scala @@ -27,7 +27,7 @@ class BitSetIteratorBenchmark { @Benchmark def iterateAll(): Unit = { var sum = 0 val it = bs.iterator - while (it.hasNext) sum += it.next + while (it.hasNext) sum += it.next() } } diff --git a/test/files/jvm/annotations/Test_2.scala b/test/files/jvm/annotations/Test_2.scala index 82aea02e4d5d..ecac824b11e0 100644 --- a/test/files/jvm/annotations/Test_2.scala +++ b/test/files/jvm/annotations/Test_2.scala @@ -120,7 +120,7 @@ object Test4 { anns foreach printSourceAnnotation if (anns.length > 0) { println(target) - println + println() } } def printParamSourceAnnotations(target: { def getParameterAnnotations(): Array[Array[Annotation]] }): Unit = { @@ -128,7 +128,7 @@ object Test4 { anns foreach printSourceAnnotation if (anns.length > 0) { println(target) - println + println() } } printSourceAnnotations(classOf[Foo1]) diff --git a/test/files/jvm/console.scala b/test/files/jvm/console.scala index 0ac43f2d263d..844f17de4aab 100644 --- a/test/files/jvm/console.scala +++ b/test/files/jvm/console.scala @@ -6,7 +6,7 @@ object Test extends App { print(true) print(1) print(1.0) - flush + flush() println("..") println(1) printf("Argument nr. %d has value %1.2f\n", diff --git a/test/files/jvm/future-spec/PromiseTests.scala b/test/files/jvm/future-spec/PromiseTests.scala index 654adb501866..e569136e891c 100644 --- a/test/files/jvm/future-spec/PromiseTests.scala +++ b/test/files/jvm/future-spec/PromiseTests.scala @@ -104,7 +104,7 @@ class PromiseTests extends MinimalScalaTest { "not be completable with a completed Promise" in { { val p = Promise[String]().failure(new RuntimeException("unbr0ken")) - p.tryCompleteWith(Promise[String].failure(new Exception("br0ken")).future) + p.tryCompleteWith(Promise[String]().failure(new Exception("br0ken")).future) intercept[RuntimeException] { Await.result(p.future, defaultTimeout) }.getMessage mustBe ("unbr0ken") diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala index a5ba1b1538e3..64381722784e 100644 --- a/test/files/jvm/scala-concurrent-tck.scala +++ b/test/files/jvm/scala-concurrent-tck.scala @@ -117,15 +117,15 @@ class FutureCallbacks extends TestBase { } def testThatNestedCallbacksDoNotYieldStackOverflow(): Unit = { - val promise = Promise[Int] + val promise = Promise[Int]() (0 to 10000).map(Future(_)).foldLeft(promise.future)((pf, f) => f.flatMap(i => pf)) promise.success(-1) } def stressTestNumberofCallbacks(): Unit = once { done => - val promise = Promise[Unit] - val otherPromise = Promise[Unit] + val promise = Promise[Unit]() + val otherPromise = Promise[Unit]() def attachMeaninglessCallbacksTo[T](f: Future[T]): Future[T] = { (1 to 20000).foreach(_ => f.onComplete(_ => ())) f @@ -359,7 +359,7 @@ def testTransformFailure(): Unit = once { def testFlatMapDelayed(): Unit = once { done => val f = Future { 5 } - val p = Promise[Int] + val p = Promise[Int]() val g = f flatMap { _ => p.future } g onComplete { case Success(x) => done(x == 10) diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala index a06407e8ce60..d2479180954f 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization.scala @@ -531,6 +531,6 @@ object Test10_util { { val random = new Random(345) val random2: Random = read(write(random)) - rep(5) { assert(random.nextInt == random2.nextInt) } + rep(5) { assert(random.nextInt() == random2.nextInt()) } } } diff --git a/test/files/jvm/throws-annot-from-java.check b/test/files/jvm/throws-annot-from-java.check index 4a4bd6ad2110..f8d00ed65a53 100644 --- a/test/files/jvm/throws-annot-from-java.check +++ b/test/files/jvm/throws-annot-from-java.check @@ -17,7 +17,7 @@ scala> :paste println("atp.typeParams.isEmpty: " + atp.typeParams.isEmpty) println(throwsAnn) } - println + println() { val method = clazz.info.member(newTermName("bar")) diff --git a/test/files/jvm/throws-annot-from-java/Test_3.scala b/test/files/jvm/throws-annot-from-java/Test_3.scala index df62e032262e..1c85d9302e33 100644 --- a/test/files/jvm/throws-annot-from-java/Test_3.scala +++ b/test/files/jvm/throws-annot-from-java/Test_3.scala @@ -13,7 +13,7 @@ object Test extends ReplTest { println("atp.typeParams.isEmpty: " + atp.typeParams.isEmpty) println(throwsAnn) } - println + println() { val method = clazz.info.member(newTermName("bar")) diff --git a/test/files/jvm/typerep.scala b/test/files/jvm/typerep.scala index a10e1b025d99..5bf9351433d7 100644 --- a/test/files/jvm/typerep.scala +++ b/test/files/jvm/typerep.scala @@ -49,7 +49,7 @@ object testPrimitives { println(getType("abc")) println(getType(())) // Unit println(getType(classOf[Int])) // Class - println + println() } object testOptions { @@ -62,7 +62,7 @@ object testOptions { println(getType(None: Option[Int])) val y: Option[Int] = None println(getType(y)) - println + println() } object testLists { @@ -71,7 +71,7 @@ object testLists { println(getType(List(List(3)))) println(getType(Nil: List[Int])) println(getType(List(1, "abc"))) - println + println() } object testArrays { @@ -81,7 +81,7 @@ object testArrays { println(getType(List(1).toArray)) println(getType(List[Int]().toArray)) println(getType(Array(3).drop(1).toArray)) // empty - println + println() } object testTuples { @@ -90,7 +90,7 @@ object testTuples { println(getType(((3, "abc"), (4, "xyz")))) println(getType(((Some('b'), 3), (Some('a'), 4)))) //println(getType(((Some('b'), 3), (None, 4)))) - println + println() } object testFuncs { @@ -109,7 +109,7 @@ object testFuncs { def f5(f: Int => Int, x: Int) = f(x) println(getType(f5 _)) println(getType(f5(f1, 1))) - println + println() } class Foo { @@ -135,12 +135,12 @@ object testClasses { val foo2 = new Foo println(getType(foo2)) println(getType(new foo2.Bar(1))) - println + println() println(getType(pkg1.c1)) val c1 = new pkg1.C1 println(getType(c1)) - println + println() */ } diff --git a/test/files/jvm/unittest_io_Jvm.scala b/test/files/jvm/unittest_io_Jvm.scala index a3098887a3e0..e9b4e01ecec0 100644 --- a/test/files/jvm/unittest_io_Jvm.scala +++ b/test/files/jvm/unittest_io_Jvm.scala @@ -8,7 +8,7 @@ object Test { |it is split on several lines. | |isn't it? - |""".stripMargin).getLines.toList + |""".stripMargin).getLines().toList println("lines.size = " + lines.size) lines.foreach(println) } diff --git a/test/files/jvm/unreachable.check b/test/files/jvm/unreachable.check deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/test/files/jvm/unreachable/Foo_1.scala b/test/files/jvm/unreachable/Foo_1.scala index 0f95941db05f..62ec1c825b47 100644 --- a/test/files/jvm/unreachable/Foo_1.scala +++ b/test/files/jvm/unreachable/Foo_1.scala @@ -9,14 +9,14 @@ class Foo_1 { def unreachableIf: Int = { return 42 - if (util.Random.nextInt % 2 == 0) + if (util.Random.nextInt() % 2 == 0) 0 else 1 } def unreachableIfBranches: Int = { - if (util.Random.nextInt % 2 == 0) + if (util.Random.nextInt() % 2 == 0) return 42 else return 42 @@ -25,14 +25,14 @@ class Foo_1 { } def unreachableOneLegIf: Int = { - if (util.Random.nextInt % 2 == 0) + if (util.Random.nextInt() % 2 == 0) return 42 return 42 } def unreachableLeftBranch: Int = { - val result = if (util.Random.nextInt % 2 == 0) + val result = if (util.Random.nextInt() % 2 == 0) return 42 else 42 @@ -41,7 +41,7 @@ class Foo_1 { } def unreachableRightBranch: Int = { - val result = if (util.Random.nextInt % 2 == 0) + val result = if (util.Random.nextInt() % 2 == 0) 42 else return 42 @@ -92,7 +92,7 @@ class Foo_1 { def unreachableSwitch: Int = { return 42 - val x = util.Random.nextInt % 2 + val x = util.Random.nextInt() % 2 x match { case 0 => return 0 case 1 => return 1 @@ -102,7 +102,7 @@ class Foo_1 { } def unreachableAfterSwitch: Int = { - val x = util.Random.nextInt % 2 + val x = util.Random.nextInt() % 2 x match { case 0 => return 42 case 1 => return 41 + x diff --git a/test/files/neg/auto-application.check b/test/files/neg/auto-application.check new file mode 100644 index 000000000000..59dd48c62ba4 --- /dev/null +++ b/test/files/neg/auto-application.check @@ -0,0 +1,8 @@ +auto-application.scala:5: warning: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method meth, +or remove the empty argument list from its definition (Java-defined methods are exempt). +In Scala 3, an unapplied method like this will be eta-expanded into a function. + meth // warn, auto-application (of nilary methods) is deprecated + ^ +error: No warnings can be incurred under -Werror. +1 warning +1 error diff --git a/test/files/neg/auto-application.scala b/test/files/neg/auto-application.scala new file mode 100644 index 000000000000..4e10adb6b875 --- /dev/null +++ b/test/files/neg/auto-application.scala @@ -0,0 +1,6 @@ +// scalac: -deprecation -Werror + +class Test { + def meth() = "" + meth // warn, auto-application (of nilary methods) is deprecated +} diff --git a/test/files/neg/checksensible.check b/test/files/neg/checksensible.check index 61fdde888886..db877785b87b 100644 --- a/test/files/neg/checksensible.check +++ b/test/files/neg/checksensible.check @@ -51,7 +51,7 @@ checksensible.scala:47: warning: comparing values of types Unit and Unit using ` () == () ^ checksensible.scala:48: warning: comparing values of types Unit and Unit using `==` will always yield true - () == println + () == println() ^ checksensible.scala:49: warning: comparing values of types Unit and scala.runtime.BoxedUnit using `==` will always yield true () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false @@ -60,7 +60,7 @@ checksensible.scala:50: warning: comparing values of types scala.runtime.BoxedUn scala.runtime.BoxedUnit.UNIT != () ^ checksensible.scala:53: warning: comparing values of types Int and Unit using `!=` will always yield true - (1 != println) + (1 != println()) ^ checksensible.scala:54: warning: comparing values of types Int and Symbol using `!=` will always yield true (1 != 'sym) @@ -169,7 +169,7 @@ checksensible.scala:47: warning: comparing values of types Unit and Unit using ` () == () ^ checksensible.scala:48: warning: comparing values of types Unit and Unit using `==` will always yield true - () == println + () == println() ^ checksensible.scala:49: warning: comparing values of types Unit and scala.runtime.BoxedUnit using `==` will always yield true () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false @@ -178,7 +178,7 @@ checksensible.scala:50: warning: comparing values of types scala.runtime.BoxedUn scala.runtime.BoxedUnit.UNIT != () ^ checksensible.scala:53: warning: comparing values of types Int and Unit using `!=` will always yield true - (1 != println) + (1 != println()) ^ checksensible.scala:54: warning: comparing values of types Int and Symbol using `!=` will always yield true (1 != 'sym) diff --git a/test/files/neg/checksensible.scala b/test/files/neg/checksensible.scala index c1a6ec021d5d..72dd36675796 100644 --- a/test/files/neg/checksensible.scala +++ b/test/files/neg/checksensible.scala @@ -45,12 +45,12 @@ class EqEqValTest { 1 != true () == true () == () - () == println + () == println() () == scala.runtime.BoxedUnit.UNIT // these should warn for always being true/false scala.runtime.BoxedUnit.UNIT != () (scala.runtime.BoxedUnit.UNIT: java.io.Serializable) != () // shouldn't warn - (1 != println) + (1 != println()) (1 != 'sym) } diff --git a/test/files/neg/delayed-init-ref.scala b/test/files/neg/delayed-init-ref.scala index 1b084b37820c..eebabca1d310 100644 --- a/test/files/neg/delayed-init-ref.scala +++ b/test/files/neg/delayed-init-ref.scala @@ -29,7 +29,7 @@ object Client { // See: https://groups.google.com/d/msg/scala-sips/wP6dL8nIAQs/ogjoPE-MSVAJ trait Before extends DelayedInit { def before(): Unit - override def delayedInit(x: => Unit): Unit = { before; x } + override def delayedInit(x: => Unit): Unit = { before(); x } } object Spec { trait UserContext extends Before { diff --git a/test/files/neg/t6120.scala b/test/files/neg/t6120.scala index 784e4189c8d5..51c007d8af54 100644 --- a/test/files/neg/t6120.scala +++ b/test/files/neg/t6120.scala @@ -9,7 +9,7 @@ class A { implicit class BooleanOps(val b: Boolean) { @deprecated("bobo", since="2.11.0") @migration("Used to return 5", changedIn="2.12.6") - def bippy() = 42 + def bippy = 42 } def f = (null == null).bippy def g = true.bippy diff --git a/test/files/pos/ifunc.scala b/test/files/pos/ifunc.scala index 10a0bef9b542..3d604ec3fe15 100644 --- a/test/files/pos/ifunc.scala +++ b/test/files/pos/ifunc.scala @@ -2,9 +2,9 @@ trait T { val f = if (_) 42 else 17 - val p = while (_) println // weird + val p = while (_) println() // weird val q = do println while (_) // weird - val g = (b: () => Boolean) => while (b()) println // less weird + val g = (b: () => Boolean) => while (b()) println() // less weird } diff --git a/test/files/pos/spec-asseenfrom.scala b/test/files/pos/spec-asseenfrom.scala index ede579170956..5c412dd96924 100644 --- a/test/files/pos/spec-asseenfrom.scala +++ b/test/files/pos/spec-asseenfrom.scala @@ -14,7 +14,7 @@ class Automaton[@specialized(Double) W,State] { def finalStateWeights() = { val it = allStates.iterator; while(it.hasNext) { - finalWeight(it.next); + finalWeight(it.next()); } } */ diff --git a/test/files/pos/t2691.scala b/test/files/pos/t2691.scala index 5f0ddd122f87..0a18f2ea9442 100644 --- a/test/files/pos/t2691.scala +++ b/test/files/pos/t2691.scala @@ -4,13 +4,13 @@ object Breakdown { object Test { 42 match { case Breakdown("") => // needed to trigger bug - case Breakdown("", who) => println ("hello " + who) + case Breakdown("", who) => println("hello " + who) } } object Test2 { 42 match { case Breakdown("") => // needed to trigger bug case Breakdown("foo") => // needed to trigger bug - case Breakdown("", who) => println ("hello " + who) + case Breakdown("", who) => println("hello " + who) } } diff --git a/test/files/pos/t4717.scala b/test/files/pos/t4717.scala index 145b0f71ec59..8cfe6230a940 100644 --- a/test/files/pos/t4717.scala +++ b/test/files/pos/t4717.scala @@ -3,7 +3,7 @@ trait Bug1[@specialized(Boolean) A] extends IterableOnce[A] { def ++[B >: A](that: IterableOnce[B]): Iterator[B] = new Iterator[B] { lazy val it = that.iterator def hasNext = it.hasNext - def next = it.next + def next = it.next() } } diff --git a/test/files/presentation/recursive-ask/RecursiveAsk.scala b/test/files/presentation/recursive-ask/RecursiveAsk.scala index 22f5103e28e3..b930f09c1e4d 100644 --- a/test/files/presentation/recursive-ask/RecursiveAsk.scala +++ b/test/files/presentation/recursive-ask/RecursiveAsk.scala @@ -7,7 +7,7 @@ object Test extends InteractiveTest { val res0 = compiler.askForResponse( () => { println("[ outer] askForResponse") val res = compiler.askForResponse( () => { println("[nested] askForResponse") }) - println (res.get(5000) match { + println(res.get(5000) match { case Some(_) => "passed" case None => "timeout" }) diff --git a/test/files/res/t722/ScanBased.scala b/test/files/res/t722/ScanBased.scala index 8e55b800ac8d..98cd08cd7e1b 100644 --- a/test/files/res/t722/ScanBased.scala +++ b/test/files/res/t722/ScanBased.scala @@ -1,10 +1,10 @@ package t722; trait ScanBased extends Parser { trait AdjacentLink extends Link { - override def foo() = super.foo; + override def foo() = super.foo(); } trait WhitespaceLink extends AdjacentLink { - override def foo() = super.foo; + override def foo() = super.foo(); } } diff --git a/test/files/run/Course-2002-01.scala b/test/files/run/Course-2002-01.scala index 3426f26eed19..b489d3cca18c 100644 --- a/test/files/run/Course-2002-01.scala +++ b/test/files/run/Course-2002-01.scala @@ -188,19 +188,19 @@ object M4 { else pascal(c - 1, l - 1) + pascal(c, l - 1); Console.print(pascal(0,0)); - Console.println; + Console.println() Console.print(pascal(0,1)); Console.print(' '); Console.print(pascal(1,1)); - Console.println; + Console.println() Console.print(pascal(0,2)); Console.print(' '); Console.print(pascal(1,2)); Console.print(' '); Console.print(pascal(2,2)); - Console.println; + Console.println() Console.print(pascal(0,3)); Console.print(' '); @@ -209,7 +209,7 @@ object M4 { Console.print(pascal(2,3)); Console.print(' '); Console.print(pascal(3,3)); - Console.println; + Console.println() Console.print(pascal(0,4)); Console.print(' '); @@ -220,7 +220,7 @@ object M4 { Console.print(pascal(3,4)); Console.print(' '); Console.print(pascal(4,4)); - Console.println; + Console.println() } //############################################################################ diff --git a/test/files/run/Course-2002-02.scala b/test/files/run/Course-2002-02.scala index b8650108ed89..0d5d6c437369 100644 --- a/test/files/run/Course-2002-02.scala +++ b/test/files/run/Course-2002-02.scala @@ -8,7 +8,7 @@ object M0 { Console.println(gcd(14,21)) Console.println(factorial(5)) - Console.println + Console.println() } //############################################################################ @@ -38,7 +38,7 @@ object M1 { Console.println(sumReciprocals(1,4)) Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)) Console.println("pi = " + sumPi(20)) - Console.println + Console.println() } //############################################################################ @@ -65,7 +65,7 @@ object M2 { Console.println(sumReciprocals(1,4)) Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)) Console.println("pi = " + sumPi(20)) - Console.println + Console.println() } //############################################################################ @@ -85,7 +85,7 @@ object M3 { Console.println(sumReciprocals(1,4)) Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)) Console.println("pi = " + sumPi(20)) - Console.println + Console.println() } //############################################################################ @@ -108,7 +108,7 @@ object M4 { Console.println(sumReciprocals(1,4)) Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)) Console.println("pi = " + sumPi(20)) - Console.println + Console.println() } //############################################################################ @@ -129,7 +129,7 @@ object M5 { Console.println(sumReciprocals(1,4)) Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)) Console.println("pi = " + sumPi(20)) - Console.println + Console.println() } //############################################################################ @@ -149,7 +149,7 @@ object M6 { Console.println(sumReciprocals(1,4)) Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)) Console.println("pi = " + sumPi(20)) - Console.println + Console.println() } //############################################################################ @@ -172,7 +172,7 @@ object M7 { Console.println(sumReciprocals(1,4)) Console.println(sumCubes(1, 10) + sumReciprocals(10, 20)) Console.println("pi = " + sumPi(20)) - Console.println + Console.println() } //############################################################################ @@ -188,7 +188,7 @@ object M8 { Console.println("pi = " + productPi(20)) Console.println("pi = " + pi) - Console.println + Console.println() } //############################################################################ @@ -223,7 +223,7 @@ object M9 { Console.println("pi = " + sumPi(20)) Console.println("pi = " + productPi(20)) Console.println("pi = " + pi) - Console.println + Console.println() } //############################################################################ @@ -244,7 +244,7 @@ object MA { def sqrt(x: Double) = fixedPoint(y => (y + x / y) / 2)(1.0) Console.println("sqrt(2) = " + sqrt(2)) - Console.println + Console.println() } //############################################################################ @@ -266,7 +266,7 @@ object MB { def sqrt(x: Double) = fixedPoint(averageDamp(y => x/y))(1.0); Console.println("sqrt(2) = " + sqrt(2)) - Console.println + Console.println() } //############################################################################ @@ -294,13 +294,13 @@ object MC { "1 + 2 + .. + 5 = " + sum(x => x)(1, 5)); Console.println( "1 * 2 * .. * 5 = " + product(x => x)(1, 5)); - Console.println; + Console.println() Console.println( "1^2 + 2^2 + .. + 5^2 = " + sum(x => x*x)(1, 5)); Console.println( "1^2 * 2^2 * .. * 5^2 = " + product(x => x*x)(1, 5)); - Console.println; + Console.println() Console.println( "factorial(0) = " + factorial(0)) @@ -314,7 +314,7 @@ object MC { "factorial(4) = " + factorial(4)) Console.println( "factorial(5) = " + factorial(5)) - Console.println + Console.println() } //############################################################################ @@ -339,13 +339,13 @@ object MD { "1 + 2 + .. + 5 = " + sum(x => x)(1, 5)) Console.println( "1 * 2 * .. * 5 = " + product(x => x)(1, 5)) - Console.println; + Console.println() Console.println( "1^2 + 2^2 + .. + 5^2 = " + sum(x => x*x)(1, 5)) Console.println( "1^2 * 2^2 * .. * 5^2 = " + product(x => x*x)(1, 5)) - Console.println; + Console.println() Console.println( "factorial(0) = " + factorial(0)) @@ -359,7 +359,7 @@ object MD { "factorial(4) = " + factorial(4)) Console.println( "factorial(5) = " + factorial(5)) - Console.println + Console.println() } //############################################################################ @@ -382,13 +382,13 @@ object ME { "1 + 2 + .. + 5 = " + sum(x => x)(1, 5)) Console.println( "1 * 2 * .. * 5 = " + product(x => x)(1, 5)) - Console.println; + Console.println() Console.println( "1^2 + 2^2 + .. + 5^2 = " + sum(x => x*x)(1, 5)) Console.println( "1^2 * 2^2 * .. * 5^2 = " + product(x => x*x)(1, 5)) - Console.println; + Console.println() Console.println( "factorial(0) = " + factorial(0)) @@ -402,7 +402,7 @@ object ME { "factorial(4) = " + factorial(4)) Console.println( "factorial(5) = " + factorial(5)) - Console.println + Console.println() } //############################################################################ @@ -464,7 +464,7 @@ object MH { Console.println("power(0,6) = " + power(0,6)) Console.println("power(0,7) = " + power(0,7)) Console.println("power(0,8) = " + power(0,8)) - Console.println + Console.println() Console.println("power(1,0) = " + power(1,0)) Console.println("power(1,1) = " + power(1,1)) @@ -475,7 +475,7 @@ object MH { Console.println("power(1,6) = " + power(1,6)) Console.println("power(1,7) = " + power(1,7)) Console.println("power(1,8) = " + power(1,8)) - Console.println + Console.println() Console.println("power(2,0) = " + power(2,0)) Console.println("power(2,1) = " + power(2,1)) @@ -486,7 +486,7 @@ object MH { Console.println("power(2,6) = " + power(2,6)) Console.println("power(2,7) = " + power(2,7)) Console.println("power(2,8) = " + power(2,8)) - Console.println + Console.println() Console.println("power(3,0) = " + power(3,0)) Console.println("power(3,1) = " + power(3,1)) @@ -497,7 +497,7 @@ object MH { Console.println("power(3,6) = " + power(3,6)) Console.println("power(3,7) = " + power(3,7)) Console.println("power(3,8) = " + power(3,8)) - Console.println + Console.println() Console.println("power(4,0) = " + power(4,0)) Console.println("power(4,1) = " + power(4,1)) @@ -508,7 +508,7 @@ object MH { Console.println("power(4,6) = " + power(4,6)) Console.println("power(4,7) = " + power(4,7)) Console.println("power(4,8) = " + power(4,8)) - Console.println + Console.println() Console.println("power(5,0) = " + power(5,0)) Console.println("power(5,1) = " + power(5,1)) @@ -519,7 +519,7 @@ object MH { Console.println("power(5,6) = " + power(5,6)) Console.println("power(5,7) = " + power(5,7)) Console.println("power(5,8) = " + power(5,8)) - Console.println + Console.println() } //############################################################################ diff --git a/test/files/run/Course-2002-03.scala b/test/files/run/Course-2002-03.scala index 2580b950ef53..9a54436cf5fa 100644 --- a/test/files/run/Course-2002-03.scala +++ b/test/files/run/Course-2002-03.scala @@ -23,7 +23,7 @@ object M0 { Console.println(x.denom); Console.println(makeString(x)); Console.println(makeString(addRational(x,y))); - Console.println; + Console.println() } //############################################################################ @@ -50,7 +50,7 @@ object M1 { Console.println(y); Console.println(z); Console.println(x.add(y).mul(z)); - Console.println; + Console.println() } //############################################################################ @@ -87,7 +87,7 @@ object M2 { Console.println(y); Console.println(z); Console.println(x.add(y).mul(z)); - Console.println; + Console.println() } //############################################################################ @@ -109,7 +109,7 @@ object M3 { Console.println(y); Console.println(x.max(y)); Console.println(y.max(x)); - Console.println; + Console.println() } //############################################################################ @@ -142,7 +142,7 @@ object M4 { val x = new Rational(1, 2); val y = new Rational(1, 3); Console.println(x * x + y * y); - Console.println; + Console.println() } //############################################################################ @@ -174,7 +174,7 @@ object M5 { Console.println(x contains 1); Console.println(x contains 2); Console.println(x contains 3); - Console.println; + Console.println() } //############################################################################ @@ -301,27 +301,27 @@ object M8 { Console.println("set2 = " + set2); Console.println("set3 = " + (set3.toString())); Console.println("set4 = " + set4); - Console.println; + Console.println() Console.println("set2 contains the following elements:"); set2.foreach(Console.println); - Console.println; + Console.println() Console.println("set3 contains the following elements:"); - set3 foreach Console.println; - Console.println; + set3 foreach Console.println + Console.println() Console.println("set4 contains the following elements:"); set4.print(); - Console.println; + Console.println() Console.println("2 <- set2: " + (set2 contains 2)); Console.println("3 <- set2: " + set2.contains(3)); - Console.println; + Console.println() Console.println("setx = " + setx); Console.println("setx * 2 = " + (setx.map(x => 2 * x))); - Console.println; + Console.println() Console.println("setx = " + setx); Console.println("sety = " + sety); @@ -331,7 +331,7 @@ object M8 { Console.println("sety > 0 = " + (sety.filter(x => x > 0))); Console.println("setx & sety = " + (setx.intersect2(sety))); Console.println("sety & setx = " + (sety.intersect2(setx))); - Console.println; + Console.println() } } @@ -367,7 +367,7 @@ object M9 { Console.println(new Rational(2,2).asString); Console.println(new Rational(2,2).toString()); Console.println(new Rational(2,2)); - Console.println; + Console.println() } } diff --git a/test/files/run/Course-2002-04.scala b/test/files/run/Course-2002-04.scala index 368e29db453d..022da849e8f5 100644 --- a/test/files/run/Course-2002-04.scala +++ b/test/files/run/Course-2002-04.scala @@ -34,7 +34,7 @@ object M0 { Console.println("list4 = " + list4); Console.println("list5 = " + list5); Console.println("list6 = " + list6); - Console.println; + Console.println() } } @@ -116,7 +116,7 @@ object M1 { Console.println("list8: " + list8 + " -> " + isort(list8)); Console.println("list9: " + list9 + " -> " + isort(list9)); Console.println("listA: " + listA + " -> " + isort(listA)); - Console.println; + Console.println() } } @@ -139,7 +139,7 @@ object M2 { Console.println("f(1) = " + horner(1, poly)); Console.println("f(2) = " + horner(2, poly)); Console.println("f(3) = " + horner(3, poly)); - Console.println; + Console.println() } } @@ -183,38 +183,38 @@ object M3 { Console.println("v1 = " + v1); Console.println("v2 = " + v2); - Console.println; + Console.println() Console.println("id = " + id); Console.println("m1 = " + m1); Console.println("m2 = " + m2); - Console.println; + Console.println() Console.println("v1 * v1 = " + dotproduct(v1,v1)); Console.println("v1 * v2 = " + dotproduct(v1,v2)); Console.println("v2 * v1 = " + dotproduct(v2,v1)); Console.println("v1 * v2 = " + dotproduct(v1,v2)); - Console.println; + Console.println() Console.println("id * v1 = " + matrixTimesVector(id,v1)); Console.println("m1 * v1 = " + matrixTimesVector(m1,v1)); Console.println("m2 * v1 = " + matrixTimesVector(m2,v1)); - Console.println; + Console.println() Console.println("trn(id) = " + transpose(id)); Console.println("trn(m1) = " + transpose(m1)); Console.println("trn(m2) = " + transpose(m2)); - Console.println; + Console.println() Console.println("List(v1) * id = " + matrixTimesMatrix(List(v1),id)); Console.println("List(v1) * m1 = " + matrixTimesMatrix(List(v1),m1)); Console.println("List(v1) * m2 = " + matrixTimesMatrix(List(v1),m2)); - Console.println; + Console.println() Console.println("id * List(v1) = " + matrixTimesMatrix(id,List(v1))); Console.println("m1 * List(v1) = " + matrixTimesMatrix(m1,List(v1))); Console.println("m2 * List(v1) = " + matrixTimesMatrix(m2,List(v1))); - Console.println; + Console.println() Console.println("id * id = " + matrixTimesMatrix(id,id)); Console.println("id * m1 = " + matrixTimesMatrix(id,m1)); @@ -225,7 +225,7 @@ object M3 { Console.println("m1 * m2 = " + matrixTimesMatrix(m1,m2)); Console.println("m2 * m1 = " + matrixTimesMatrix(m2,m1)); Console.println("m2 * m2 = " + matrixTimesMatrix(m2,m2)); - Console.println; + Console.println() } } diff --git a/test/files/run/Course-2002-05.scala b/test/files/run/Course-2002-05.scala index c1e6b07c0ef4..14eee26b75fd 100644 --- a/test/files/run/Course-2002-05.scala +++ b/test/files/run/Course-2002-05.scala @@ -29,20 +29,20 @@ object M0 { Console.println(partition[Int](List(1,2,3,4,5,6,7,8), (x => x < 0))); Console.println(partition[Int](List(1,2,3,4,5,6,7,8), (x => x < 5))); Console.println(partition[Int](List(1,2,3,4,5,6,7,8), (x => x < 9))); - Console.println; + Console.println() Console.println(partition[Int](List(8,7,6,5,4,3,2,1), (x => x < 0))); Console.println(partition[Int](List(8,7,6,5,4,3,2,1), (x => x < 5))); Console.println(partition[Int](List(8,7,6,5,4,3,2,1), (x => x < 9))); - Console.println; + Console.println() Console.println(partition[Int](List(7,2,1,5,4,3,8,6), (x => x < 0))); Console.println(partition[Int](List(7,2,1,5,4,3,8,6), (x => x < 5))); Console.println(partition[Int](List(7,2,1,5,4,3,8,6), (x => x < 9))); - Console.println; + Console.println() Console.println(quicksort[Int]((x,y) => x < y)(List(7,2,1,5,4,3,8,6))); - Console.println; + Console.println() } } @@ -69,20 +69,20 @@ object M1 { Console.println(partition[Int](List(1,2,3,4,5,6,7,8), (x => x < 0))); Console.println(partition[Int](List(1,2,3,4,5,6,7,8), (x => x < 5))); Console.println(partition[Int](List(1,2,3,4,5,6,7,8), (x => x < 9))); - Console.println; + Console.println() Console.println(partition[Int](List(8,7,6,5,4,3,2,1), (x => x < 0))); Console.println(partition[Int](List(8,7,6,5,4,3,2,1), (x => x < 5))); Console.println(partition[Int](List(8,7,6,5,4,3,2,1), (x => x < 9))); - Console.println; + Console.println() Console.println(partition[Int](List(7,2,1,5,4,3,8,6), (x => x < 0))); Console.println(partition[Int](List(7,2,1,5,4,3,8,6), (x => x < 5))); Console.println(partition[Int](List(7,2,1,5,4,3,8,6), (x => x < 9))); - Console.println; + Console.println() Console.println(quicksort[Int]((x,y) => x < y)(List(7,2,1,5,4,3,8,6))); - Console.println; + Console.println() } } @@ -106,7 +106,7 @@ object M2 { Console.println(powerset(List(1,2))); Console.println(powerset(List(1,2,3))); Console.println(powerset(List(1,2,3,4))); - Console.println; + Console.println() } } @@ -149,7 +149,7 @@ object M3 { Console.println("queens(2) = " + queens(2)); Console.println("queens(3) = " + queens(3)); Console.println("queens(4) = " + queens(4)); - Console.println; + Console.println() } } @@ -194,7 +194,7 @@ object M4 { Console.println("queens(2) = " + queens(2)); Console.println("queens(3) = " + queens(3)); Console.println("queens(4) = " + queens(4)); - Console.println; + Console.println() } } diff --git a/test/files/run/Course-2002-06.scala b/test/files/run/Course-2002-06.scala index c4a92bd9fb4e..fabccc22643c 100644 --- a/test/files/run/Course-2002-06.scala +++ b/test/files/run/Course-2002-06.scala @@ -137,7 +137,7 @@ class PostScript (filename: String, _width: Double, _height: Double) /** Terminate the PS document and close the file stream. */ def close : Unit = { Console.println("stroke\nshowpage\n%%EOF"); - Console.flush; + Console.flush() } } diff --git a/test/files/run/Course-2002-07.scala b/test/files/run/Course-2002-07.scala index b60297c8f698..03b7ac6d4d65 100644 --- a/test/files/run/Course-2002-07.scala +++ b/test/files/run/Course-2002-07.scala @@ -58,7 +58,7 @@ object M0 { eval(new Sum(new Number(1),new Number(2)))); Console.println("2 + 3 + 4 = " + eval(new Sum(new Sum(new Number(2),new Number(3)),new Number(4)))); - Console.println; + Console.println() } } @@ -86,7 +86,7 @@ object M1 { new Sum(new Number(1),new Number(2)).eval); Console.println("2 + 3 + 4 = " + new Sum(new Sum(new Number(2),new Number(3)),new Number(4)).eval); - Console.println; + Console.println() } } @@ -110,7 +110,7 @@ object M2 { Console.println(" 1 + 2 = " + eval(Sum(Number(1),Number(2)))); Console.println("2 + 3 + 4 = " + eval(Sum(Sum(Number(2),Number(3)), Number(4)))); - Console.println; + Console.println() } } @@ -134,7 +134,7 @@ object M3 { Console.println(" 1 + 2 = " + Sum(Number(1),Number(2)).eval); Console.println("2 + 3 + 4 = " + Sum(Sum(Number(2),Number(3)), Number(4)).eval); - Console.println; + Console.println() } } @@ -172,7 +172,7 @@ object M4 { test_concat(List(List[Int](),List(1),List(2,3,4,5,6))); // !!! [int] test_concat(List(List[Int](),List[Int](),List(1,2,3,4,5,6))); // !!! [int] test_concat(List(List(1,2),List(3,4),List(5,6))); - Console.println; + Console.println() } } @@ -206,7 +206,7 @@ object M5 { test_zipFun(List(1,2,3),List('a','b','c')); - Console.println; + Console.println() } } @@ -240,7 +240,7 @@ object M6 { test_zipFun(List(1,2,3),List('a','b','c')); - Console.println; + Console.println() } } @@ -283,7 +283,7 @@ object M7 { test_heads(List(List(1,2),List(3,4),List(5,6))); - Console.println; + Console.println() } } @@ -329,7 +329,7 @@ object M8 { test_heads(List(List(1,2),List(3,4),List(5,6))); - Console.println; + Console.println() } } @@ -365,7 +365,7 @@ object M9 { val f1 = f0 derive x; Console.println("f (x) = " + f0); Console.println("f'(x) = " + f1); - Console.println; + Console.println() } } @@ -440,7 +440,7 @@ object MA { Console.println("g (3) = " + evalvars(List(("x",3)))(g0)); Console.println("g'(3) = " + evalvars(List(("x",3)))(g1)); - Console.println; + Console.println() } } @@ -651,7 +651,7 @@ object MB { Console.println("tf(x) = " + tf); Console.println("tg(x) = " + tg); Console.println("th(x) = " + th); - Console.println; + Console.println() val f4 = (x+ _3)*(_2+x)*x*(x+ _1) + (x+ _5)*(x*(x+ _2)+x+ _1) + (x^2) + x; val f3 = f4.derive(x); @@ -664,7 +664,7 @@ object MB { Console.println("f2(x) = " + f2); Console.println("f1(x) = " + f1); Console.println("f0(x) = " + f0); - Console.println; + Console.println() def check(n: String, f: Expr, x: Int, e: Int): Unit = { val a: Int = f.evaluate(List(("x",x))); @@ -677,25 +677,25 @@ object MB { check("f4", f4, 2, 203); check("f4", f4, 3, 524); check("f4", f4, 4, 1121); - Console.println; + Console.println() check("f3", f3, 0, 23); check("f3", f3, 1, 88); check("f3", f3, 2, 219); check("f3", f3, 3, 440); - Console.println; + Console.println() check("f2", f2, 0, 40); check("f2", f2, 1, 94); check("f2", f2, 2, 172); - Console.println; + Console.println() check("f1", f1, 0, 42); check("f1", f1, 1, 66); - Console.println; + Console.println() check("f0", f0, 0, 24); - Console.println; + Console.println() } } diff --git a/test/files/run/Course-2002-08.scala b/test/files/run/Course-2002-08.scala index 231cdfe6d95d..7b55f5b96549 100644 --- a/test/files/run/Course-2002-08.scala +++ b/test/files/run/Course-2002-08.scala @@ -16,7 +16,7 @@ object M0 { count = count + 1; Console.println("x = " + x); Console.println("count = " + count); - Console.println; + Console.println() } } @@ -45,7 +45,7 @@ object M1 { Console.print("account withdraw 20 -> "); Console.println(account withdraw 20); Console.print("account withdraw 15 -> "); - Console.println; + Console.println() } def test1 = { @@ -54,7 +54,7 @@ object M1 { Console.print("x deposit 30 -> "); Console.println((x deposit 30).toString()); // !!! .toString Console.print("y withdraw 20 -> "); - Console.println; + Console.println() } def test2 = { @@ -76,10 +76,10 @@ object M1 { } def test = { - test0; Console.println; - test1; Console.println; - test2; Console.println; - test3; Console.println; + test0; Console.println() + test1; Console.println() + test2; Console.println() + test3; Console.println() } } @@ -106,7 +106,7 @@ object M2 { Console.println("2^1 = " + power(2,1)); Console.println("2^2 = " + power(2,2)); Console.println("2^3 = " + power(2,3)); - Console.println; + Console.println() } } @@ -126,7 +126,7 @@ object M3 { Console.println("2^1 = " + power(2,1)); Console.println("2^2 = " + power(2,2)); Console.println("2^3 = " + power(2,3)); - Console.println; + Console.println() } } @@ -136,9 +136,9 @@ object M4 { def test = { for (i <- range(1, 4)) { Console.print(s"$i ") }; - Console.println; + Console.println() Console.println(for (i <- range(1, 4)) yield i); - Console.println; + Console.println() } } @@ -274,7 +274,7 @@ object M5 { ain setSignal (if (a == 0) false else true); run; Console.println("!" + a + " = " + result); - Console.println; + Console.println() } probe("out ", cout); @@ -296,11 +296,11 @@ object M5 { bin setSignal (if (b == 0) false else true); run; Console.println(a.toString + " & " + b + " = " + result); - Console.println; + Console.println() } probe("out ", cout); - Console.println; + Console.println() test(0,0); test(0,1); @@ -321,11 +321,11 @@ object M5 { bin setSignal (if (b == 0) false else true); run; Console.println(a.toString + " | " + b + " = " + result); - Console.println; + Console.println() } probe("out ", cout); - Console.println; + Console.println() test(0,0); test(0,1); @@ -349,12 +349,12 @@ object M5 { bin setSignal (if (b == 0) false else true); run; Console.println(a.toString + " + " + b + " = " + result); - Console.println; + Console.println() } probe("sum ", sout); probe("carry", cout); - Console.println; + Console.println() test(0,0); test(0,1); @@ -380,12 +380,12 @@ object M5 { cin setSignal (if (c == 0) false else true); run; Console.println(a.toString + " + " + b + " + " + c + " = " + result); - Console.println; + Console.println() } probe("sum ", sout); probe("carry", cout); - Console.println; + Console.println() test(0,0,0); test(0,0,1); diff --git a/test/files/run/Course-2002-09.scala b/test/files/run/Course-2002-09.scala index 588703ddcf68..19afb321a0ae 100644 --- a/test/files/run/Course-2002-09.scala +++ b/test/files/run/Course-2002-09.scala @@ -186,19 +186,19 @@ object M0 { c.setValue(0); c.forgetValue; - Console.println; + Console.println() c.setValue(100); c.forgetValue; - Console.println; + Console.println() f.setValue(32); f.forgetValue; - Console.println; + Console.println() f.setValue(212); f.forgetValue; - Console.println; + Console.println() } } @@ -239,7 +239,7 @@ object M1 { show_c2f(c, f, 100); show_f2c(c, f, 32); show_f2c(c, f, 212); - Console.println; + Console.println() } } @@ -273,7 +273,7 @@ object M2 { show(Some(2), None , Some(6)); show(None , Some(3), Some(6)); show(Some(2), Some(3), Some(6)); - Console.println; + Console.println() show(Some(0), None , None ); show(None , Some(0), None ); @@ -286,7 +286,7 @@ object M2 { show(Some(0), Some(7), Some(0)); show(Some(7), Some(0), Some(0)); show(Some(0), Some(0), Some(0)); - Console.println; + Console.println() } } @@ -313,7 +313,7 @@ object M3 { Console.println("b = 4, c = 5 => a = " + a.str); b.forgetValue; c.forgetValue; - Console.println; + Console.println() } } diff --git a/test/files/run/Course-2002-10.scala b/test/files/run/Course-2002-10.scala index 64f31ac8e1f0..e705894b2a54 100644 --- a/test/files/run/Course-2002-10.scala +++ b/test/files/run/Course-2002-10.scala @@ -15,7 +15,7 @@ object M0 { def test = { var i = 0; fib.take(20).foreach(n => {Console.println("fib("+i+") = "+n); i=i+1}); - Console.println; + Console.println() } } @@ -76,7 +76,7 @@ object M1 { Console.print(str(Pi) + ", "); Console.print(str(Pi) + ", "); Console.print(str(Pi) + "\n"); - Console.println; + Console.println() i = 0; while (i < 10) { Console.print("ln("+i+") = "); @@ -89,7 +89,7 @@ object M1 { Console.print(str(log(2)) + ", "); Console.print(str(log(2)) + ", "); Console.print(str(log(2)) + "\n"); - Console.println; + Console.println() } } @@ -107,7 +107,7 @@ object M2 { var current: Iterator[Int] = new IntIterator(2); def hasNext = true; def next = { - val p = current.next; + val p = current.next(); current = current filter { x => !((x % p) == 0) }; p } @@ -116,8 +116,8 @@ object M2 { def test = { val i = (new PrimeIterator()).take(30); Console.print("prime numbers:"); - while (i.hasNext) { Console.print(" " + i.next); } - Console.println; + while (i.hasNext) { Console.print(" " + i.next()); } + Console.println() } } diff --git a/test/files/run/Course-2002-13.scala b/test/files/run/Course-2002-13.scala index 6ffc3c8501b6..c79ae4a6c1ea 100644 --- a/test/files/run/Course-2002-13.scala +++ b/test/files/run/Course-2002-13.scala @@ -166,30 +166,30 @@ import Programs._; class Parser(s: String) { val it = new Tokenizer(s, "(),.?"); - var token: String = it.next; + var token: String = it.next(); def syntaxError(msg: String): Unit = sys.error(msg + ", but " + token + " found"); def rep[a](p: => a): List[a] = { val t = p; - if (token == ",") { token = it.next; t :: rep(p) } else List(t) + if (token == ",") { token = it.next(); t :: rep(p) } else List(t) } def constructor: Term = { val a = token; - token = it.next; + token = it.next(); Con(a, if (token equals "(") { - token = it.next; + token = it.next(); val ts: List[Term] = if (token equals ")") List() else rep(term); - if (token equals ")") token = it.next else syntaxError("`)` expected"); + if (token equals ")") token = it.next() else syntaxError("`)` expected"); ts } else List()) } def term: Term = { val ch = token.charAt(0); - if ('A' <= ch && ch <= 'Z') { val a = token; token = it.next; Var(a) } + if ('A' <= ch && ch <= 'Z') { val a = token; token = it.next(); Var(a) } else if (it.isDelimiter(ch)) { syntaxError("term expected"); null } else constructor } @@ -197,14 +197,14 @@ class Parser(s: String) { def line: Clause = { val result = if (token equals "?") { - token = it.next; + token = it.next(); Clause(NoTerm, rep(constructor)); } else { Clause( constructor, - if (token equals ":-") { token = it.next; rep(constructor) } else List()) + if (token equals ":-") { token = it.next(); rep(constructor) } else List()) } - if (token equals ".") token = it.next else syntaxError("`.` expected"); + if (token equals ".") token = it.next() else syntaxError("`.` expected"); result } @@ -268,7 +268,7 @@ object Test { "?phrase(S,V,A,D,N).\n" + "?more.\n" ); - Console.println; + Console.println() Prolog.process( "sujet(jean).\n" + @@ -287,7 +287,7 @@ object Test { "?phrase(S,V,A,D,N).\n" + "?more.\n" ); - Console.println; + Console.println() Prolog.process( "sujet(jean).\n" + @@ -313,7 +313,7 @@ object Test { "?phrase(jean,mange,le,cons(grand,nil),cheval).\n" + "?phrase(jean,mange,le,cons(grand,nil),table).\n" ); - Console.println; + Console.println() () } diff --git a/test/files/run/QueueTest.scala b/test/files/run/QueueTest.scala index 2ef526373911..55f3274d74e6 100644 --- a/test/files/run/QueueTest.scala +++ b/test/files/run/QueueTest.scala @@ -19,7 +19,7 @@ object Test { assert(queue.dequeueFirst(_ > 500) == None) assert(queue.dequeueAll(_ > 500).isEmpty) - queue.clear + queue.clear() assert(queue.isEmpty) assert(queue.size == 0) assert(queue.length == 0) @@ -39,7 +39,7 @@ object Test { assert(queue.init.isEmpty) assert(queue.tail.isEmpty) - queue.clear + queue.clear() assert(queue.isEmpty) assert(queue.length == 0) @@ -49,7 +49,7 @@ object Test { assert(queue.head == 11) assert(queue.front == 11) - val deq = queue.dequeue + val deq = queue.dequeue() assert(deq == 11) assert(queue.isEmpty) assert(queue.length == 0) @@ -93,7 +93,7 @@ object Test { assert(queue.last == 20) assert(queue.front == 10) - val ten = queue.dequeue + val ten = queue.dequeue() assert(ten == 10) assert(queue.length == 1) @@ -143,7 +143,7 @@ object Test { for (i <- 0 until 10) queue.enqueue(i * 2) for (i <- 0 until 10) { - val top = queue.dequeue + val top = queue.dequeue() assert(top == i * 2) assert(queue.length == 10 - i - 1) } @@ -159,7 +159,7 @@ object Test { assert(queue.length == 3) assert(queue.nonEmpty) - queue.clear + queue.clear() assert(queue.length == 0) assert(queue.isEmpty) @@ -223,7 +223,7 @@ object Test { assert(queue.head == 0) assert(queue.last == 3) - queue.dequeue + queue.dequeue() assert(queue.head == 3) queue.enqueue(9) @@ -232,7 +232,7 @@ object Test { assert(queue.length == 1) assert(queue.head == 9) - queue.clear + queue.clear() for (i <- -100 until 100) queue.enqueue(i * i + i % 7 + 5) assert(queue.length == 200) diff --git a/test/files/run/SymbolsTest.scala b/test/files/run/SymbolsTest.scala index d90b888e889c..f14d1e696be8 100644 --- a/test/files/run/SymbolsTest.scala +++ b/test/files/run/SymbolsTest.scala @@ -110,7 +110,7 @@ object Test { assert(map(Symbol("ddd")) == Symbol("mfsa")) assert(map(Symbol("WeirdKey1")) == Symbol("WeirdVal1")) - map.clear + map.clear() for (i <- 0 until 100) map.put(Symbol("symKey" + i), Symbol("symVal" + i)) assert(map(Symbol("symKey15")) == Symbol("symVal15")) assert(map(Symbol("symKey22")) == Symbol("symVal22")) diff --git a/test/files/run/UnrolledBuffer.scala b/test/files/run/UnrolledBuffer.scala index e14aac98a910..8007711ec6c6 100644 --- a/test/files/run/UnrolledBuffer.scala +++ b/test/files/run/UnrolledBuffer.scala @@ -14,7 +14,7 @@ object Test { assert(u1.nonEmpty) assert(u1.size == 3) - u1.clear + u1.clear() assert(u1.isEmpty) assert(u1.size == 0) @@ -33,8 +33,8 @@ object Test { val u2 = u1 map { x => (x - 1) / 2 } assert(u2 == UnrolledBuffer(0, 1, 2, 3, 4)) - u1.clear - u2.clear + u1.clear() + u2.clear() assert(u1.size == 0) assert(u2.size == 0) diff --git a/test/files/run/WeakHashSetTest.scala b/test/files/run/WeakHashSetTest.scala index 6f0d429166b4..2d822f6274ea 100644 --- a/test/files/run/WeakHashSetTest.scala +++ b/test/files/run/WeakHashSetTest.scala @@ -33,7 +33,7 @@ package scala.reflect.internal.util { def checkEmpty: Unit = { val hs = new WeakHashSet[String]() assert(hs.size == 0) - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // make sure += works @@ -44,7 +44,7 @@ package scala.reflect.internal.util { assert(hs.size == 2) assert(hs contains "hello") assert(hs contains "goodbye") - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // make sure += works when there are collisions @@ -55,7 +55,7 @@ package scala.reflect.internal.util { assert(hs.size == 2) assert(hs contains Collider("hello")) assert(hs contains Collider("goodbye")) - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // add a large number of elements to force rehashing and then validate @@ -65,7 +65,7 @@ package scala.reflect.internal.util { val elements = (0 until size).toList map ("a" + _) elements foreach (hs += _) elements foreach {i => assert(hs contains i)} - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // make sure rehashing works properly when the set is rehashed @@ -75,7 +75,7 @@ package scala.reflect.internal.util { val elements = (0 until size).toList map {x => Collider("a" + x)} elements foreach (hs += _) elements foreach {i => assert(hs contains i)} - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // test that unreferenced objects are removed @@ -97,7 +97,7 @@ package scala.reflect.internal.util { for (i <- 0 until size) { assert(!(hs contains Collider("b" + i))) } - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // make sure findOrUpdate returns the originally entered element @@ -111,7 +111,7 @@ package scala.reflect.internal.util { // original put in assert(hs findEntryOrUpdate(Collider("a" + i)) eq elements(i)) } - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // check -= functionality @@ -123,7 +123,7 @@ package scala.reflect.internal.util { assert(hs.size == 1) assert(hs contains "hello") assert(!(hs contains "goodbye")) - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // check -= when there are collisions @@ -138,7 +138,7 @@ package scala.reflect.internal.util { hs -= Collider("hello") assert(hs.size == 0) assert(!(hs contains Collider("hello"))) - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // check that the clear method actually cleans everything @@ -150,7 +150,7 @@ package scala.reflect.internal.util { hs.clear() assert(hs.size == 0) elements foreach {i => assert(!(hs contains i))} - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // check that the iterator covers all the contents @@ -159,7 +159,7 @@ package scala.reflect.internal.util { val elements = (0 until 20).toList map ("a" + _) elements foreach (hs += _) assert(elements.iterator.toList.sorted == elements.sorted) - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } // check that the iterator covers all the contents even when there is a collision @@ -168,7 +168,7 @@ package scala.reflect.internal.util { val elements = (0 until 20).toList map {x => Collider("a" + x)} elements foreach (hs += _) assert(elements.iterator.toList.sorted == elements.sorted) - hs.diagnostics.fullyValidate + hs.diagnostics.fullyValidate() } } } diff --git a/test/files/run/analyzerPlugins.check b/test/files/run/analyzerPlugins.check index da66c3de9192..ab00e1568baa 100644 --- a/test/files/run/analyzerPlugins.check +++ b/test/files/run/analyzerPlugins.check @@ -32,7 +32,7 @@ pluginsPt(?, Trees$Literal) [16] pluginsPt(?, Trees$New) [6] pluginsPt(?, Trees$PackageDef) [1] pluginsPt(?, Trees$Return) [1] -pluginsPt(?, Trees$Select) [44] +pluginsPt(?, Trees$Select) [41] pluginsPt(?, Trees$Super) [2] pluginsPt(?, Trees$This) [13] pluginsPt(?, Trees$TypeApply) [3] @@ -93,7 +93,7 @@ pluginsTypeSigAccessor(value y) [1] pluginsTypeSigAccessor(variable count) [2] pluginsTyped( <: Int, Trees$TypeBoundsTree) [2] pluginsTyped("huhu", Trees$Block) [1] -pluginsTyped((): Double, Trees$Select) [6] +pluginsTyped((): Double, Trees$Select) [3] pluginsTyped((): List, Trees$TypeApply) [1] pluginsTyped((): Object, Trees$Select) [1] pluginsTyped((): String, Trees$Ident) [1] diff --git a/test/files/run/analyzerPlugins.scala b/test/files/run/analyzerPlugins.scala index 2e73694a850d..09c541366922 100644 --- a/test/files/run/analyzerPlugins.scala +++ b/test/files/run/analyzerPlugins.scala @@ -22,10 +22,10 @@ object Test extends DirectTest { var count = 0 - math.random // some statement + math.random() // some statement def method: String = { - math.random + math.random() val f = inferField def nested(): String = { @@ -38,7 +38,7 @@ object Test extends DirectTest { def this(str: String) = { this(str.toDouble) - math.random + math.random() count += 1 } } diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala index b6843d1fa9c2..1cb9abea4a9a 100644 --- a/test/files/run/bitsets.scala +++ b/test/files/run/bitsets.scala @@ -38,7 +38,7 @@ object TestMutable { Console.println("mi0 = " + ms0.toImmutable) Console.println("mi1 = " + ms1.toImmutable) Console.println("mi2 = " + ms2.toImmutable) - Console.println + Console.println() val N = 257 val gen = 3 @@ -93,7 +93,7 @@ object TestMutable2 { println("m2_r1 = " + (t1.range(43,194) == b1.range(43,194))) println("m2_r2 = " + (t2.range(43,194) == b2.range(43,194))) println("m2_r3 = " + (t3.range(43,194) == b3.range(43,194))) - println + println() } object TestMutable3 { @@ -162,7 +162,7 @@ object TestImmutable { Console.println("ia1 = " + is1.toList) Console.println("ia2 = " + is2.toList) Console.println("ia3 = " + is3.toList) - Console.println + Console.println() } object TestImmutable2 { @@ -203,13 +203,13 @@ object TestImmutable2 { println("i2_r1 = " + (t1.range(77,194) == b1.range(77,194))) println("i2_r2 = " + (t2.range(77,194) == b2.range(77,194))) println("i2_r3 = " + (t3.range(77,194) == b3.range(77,194))) - println + println() } object TestImmutable3 { import scala.collection.immutable.BitSet BitSet(125).filter{ xi => println(xi); true } // scala/bug#11380 - println + println() } object Test extends App { diff --git a/test/files/run/boolexprs.scala b/test/files/run/boolexprs.scala index 94313d9c8e9a..56cabc5c5b16 100644 --- a/test/files/run/boolexprs.scala +++ b/test/files/run/boolexprs.scala @@ -46,13 +46,13 @@ object Test { case exception: Throwable => Console.print(" raised exception " + exception); } - Console.println; + Console.println() } def main(args: Array[String]): Unit = { check_success("Test1", Test1.run, 1); check_success("Test2", Test2.run, 0); - Console.println; + Console.println() } } diff --git a/test/files/run/bridges.scala b/test/files/run/bridges.scala index a1dd421f2d05..3a90fb88db52 100644 --- a/test/files/run/bridges.scala +++ b/test/files/run/bridges.scala @@ -3584,13 +3584,13 @@ object Test { if (!Help.check(count, value)) { Console.print(name + " failed: "); Help.print; - Console.println; + Console.println() errors = errors + 1; } } catch { case exception: Throwable => { Console.print(name + " raised exception " + exception); - Console.println; + Console.println() errors = errors + 1; } } @@ -7115,7 +7115,7 @@ object Test { // */test("S_TZIfwFooXIfwBarYIf", new S_TZIfwFooXIfwBarYIf[D], 4, "mix"); if (errors > 0) { - Console.println; + Console.println() Console.println(s"$errors error" + (if (errors > 1) "s" else "")); } } diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index d26816d6cc49..3a7caec241db 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -426,11 +426,11 @@ object Test { } catch { case exception: Throwable => Console.print("Exception in thread \"" + Thread.currentThread + "\" " + exception); - Console.println; + Console.println(); errors += 1 } Console.println(">>> bug " + bug) - Console.println + Console.println() } def main(args: Array[String]): Unit = { @@ -459,7 +459,7 @@ object Test { test(399, Bug399Test.test(args)); if (errors > 0) { - Console.println; + Console.println(); Console.println(s"$errors error" + (if (errors > 1) "s" else "")); } } diff --git a/test/files/run/constant-optimization.scala b/test/files/run/constant-optimization.scala index d7d59f8022ce..56855fbc1c1c 100644 --- a/test/files/run/constant-optimization.scala +++ b/test/files/run/constant-optimization.scala @@ -1,6 +1,6 @@ object Test extends App { def testBothReachable(): Unit = { - val i = util.Random.nextInt + val i = util.Random.nextInt() val x = if (i % 2 == 0) null else "good" val y = if (x == null) "good" else x + "" println(s"testBothReachable: $y") @@ -14,7 +14,7 @@ object Test extends App { } def testAllReachable(): Unit = { - val i = util.Random.nextInt + val i = util.Random.nextInt() val y = (i % 2) match { case 0 => "good" case 1 => "good" @@ -24,7 +24,7 @@ object Test extends App { } def testOneUnreachable(): Unit = { - val i = util.Random.nextInt + val i = util.Random.nextInt() val x = if (i % 2 == 0) { 1 } else { @@ -39,7 +39,7 @@ object Test extends App { } def testDefaultUnreachable(): Unit = { - val i = util.Random.nextInt + val i = util.Random.nextInt() val x = if (i % 2 == 0) { 1 } else { diff --git a/test/files/run/contrib674.scala b/test/files/run/contrib674.scala index bb9dad3686a9..e19932eabb66 100644 --- a/test/files/run/contrib674.scala +++ b/test/files/run/contrib674.scala @@ -15,5 +15,5 @@ object Test extends App { 1 } - bad + bad() } diff --git a/test/files/run/deeps.scala b/test/files/run/deeps.scala index 0412403623d6..4e9c9b092531 100644 --- a/test/files/run/deeps.scala +++ b/test/files/run/deeps.scala @@ -12,14 +12,14 @@ object Test { println(Array(1) == Array(1)) println(Array(1) equals Array(1)) println(Array(1).deep == Array(1).deep) - println + println() } def testEquals2: Unit = { println(Array(Array(1), Array(2)) == Array(Array(1), Array(2))) println(Array(Array(1), Array(2)) equals Array(Array(1), Array(2))) println(Array(Array(1), Array(2)).deep equals Array(Array(1), Array(2)).deep) - println + println() } def testEquals3: Unit = { @@ -35,7 +35,7 @@ object Test { println(x == y) println(x equals y) println(x.deep == y.deep) - println + println() } test(a1, b1) test(a2, b2) @@ -65,7 +65,7 @@ object Test { println(a.deep.toString) println(a.deep.mkString("[", ";", "]")) println(a.deep.mkString(";")) - println + println() } val ba1 = Array(true, false) @@ -94,7 +94,7 @@ object Test { println(Array(Array(true, false), Array(false)).deep.mkString("[", "; ", "]")) println(Array(Array('1', '2'), Array('3')).deep.mkString("[", "; ", "]")) println(Array(Array(1, 2), Array(3)).deep.mkString("[", "; ", "]")) - println + println() } def testToString3: Unit = { diff --git a/test/files/run/enums.scala b/test/files/run/enums.scala index 4a9f27ac1410..4bb3a8c82475 100644 --- a/test/files/run/enums.scala +++ b/test/files/run/enums.scala @@ -145,7 +145,7 @@ object Test { exception.printStackTrace(); } } - Console.println; + Console.println() } def main(args: Array[String]): Unit = { @@ -153,9 +153,9 @@ object Test { check_success("Test2", Test2.run, 5); check_success("Test3", Test3.run, 1); check_success("Test4", Test4.run, 0); - Console.println; + Console.println() Test5.run; - Console.println; + Console.println() SerializationTest.run; } } diff --git a/test/files/run/exceptions.scala b/test/files/run/exceptions.scala index f0fe76946b5c..63ef2ed61b57 100644 --- a/test/files/run/exceptions.scala +++ b/test/files/run/exceptions.scala @@ -22,8 +22,8 @@ object exceptions { if (value == "\u0000") value = "\\u0000"; Console.print(": " + what + " = " + value); if (!success) Console.print(" != " + expected); - Console.println; - Console.flush; + Console.println() + Console.flush() } def test: Unit = { diff --git a/test/files/run/fors.scala b/test/files/run/fors.scala index 7bc06fb2f6f8..bb098d59ebbb 100644 --- a/test/files/run/fors.scala +++ b/test/files/run/fors.scala @@ -18,29 +18,29 @@ object Test extends App { println("\ntestOld") // lists - for (x <- xs) print(s"$x "); println + for (x <- xs) print(s"$x "); println() for (x <- xs; - if x % 2 == 0) print(s"$x "); println + if x % 2 == 0) print(s"$x "); println() for {x <- xs - if x % 2 == 0} print(s"$x "); println + if x % 2 == 0} print(s"$x "); println() var n = 0 for (_ <- xs) n += 1; println(n) - for ((x, y) <- xs zip ys) print(s"$x "); println - for (p @ (x, y) <- xs zip ys) print(s"${p._1} "); println + for ((x, y) <- xs zip ys) print(s"$x "); println() + for (p @ (x, y) <- xs zip ys) print(s"${p._1} "); println() // iterators - for (x <- it) print(s"$x "); println + for (x <- it) print(s"$x "); println() for (x <- it; - if x % 2 == 0) print(s"$x "); println + if x % 2 == 0) print(s"$x "); println() for {x <- it - if x % 2 == 0} print(s"$x "); println + if x % 2 == 0} print(s"$x "); println() // arrays - for (x <- ar) print(s"$x "); println + for (x <- ar) print(s"$x "); println() for (x <- ar; - if x.toInt > 97) print(s"$x "); println + if x.toInt > 97) print(s"$x "); println() for {x <- ar - if x.toInt > 97} print(s"$x "); println + if x.toInt > 97} print(s"$x "); println() } @@ -52,28 +52,28 @@ object Test extends App { // lists var n = 0 for (_ <- xs) n += 1; println(n) - for ((x, y) <- xs zip ys) print(s"$x "); println - for (p @ (x, y) <- xs zip ys) print(s"${p._1} "); println + for ((x, y) <- xs zip ys) print(s"$x "); println() + for (p @ (x, y) <- xs zip ys) print(s"${p._1} "); println() // iterators - for (x <- it) print(s"$x "); println - for (x <- it if x % 2 == 0) print(s"$x "); println - for (x <- it; if x % 2 == 0) print(s"$x "); println + for (x <- it) print(s"$x "); println() + for (x <- it if x % 2 == 0) print(s"$x "); println() + for (x <- it; if x % 2 == 0) print(s"$x "); println() for (x <- it; - if x % 2 == 0) print(s"$x "); println + if x % 2 == 0) print(s"$x "); println() for (x <- it - if x % 2 == 0) print(s"$x "); println + if x % 2 == 0) print(s"$x "); println() for {x <- it - if x % 2 == 0} print(s"$x "); println + if x % 2 == 0} print(s"$x "); println() for (x <- it; y = 2 - if x % y == 0) print(s"$x "); println + if x % y == 0) print(s"$x "); println() for {x <- it y = 2 - if x % y == 0} print(s"$x "); println + if x % y == 0} print(s"$x "); println() // arrays - for (x <- ar) print(s"$x "); println + for (x <- ar) print(s"$x "); println() } diff --git a/test/files/run/imports.scala b/test/files/run/imports.scala index 4bdbef9f95f2..5becd83d96d5 100644 --- a/test/files/run/imports.scala +++ b/test/files/run/imports.scala @@ -7,11 +7,11 @@ object checker { def check(location: String, what: String, value: Any): Unit = { Console.print("In " + location + ", " + what + ".toString() returns "); - Console.flush; + Console.flush() val string: String = if (value == null) "null" else value.toString(); val test = if (string == location) "ok" else "KO"; Console.println(string + " -> " + test); - Console.flush; + Console.flush() } } @@ -31,7 +31,7 @@ class C_ico() { check("C_ico", "v_ico ", v_ico); check("C_ico", "field ", field); check("C_ico", "method", method); - Console.println; + Console.println() } object o_ico { @@ -58,7 +58,7 @@ class C_ioc() { check("C_ioc", "v_ioc ", v_ioc); check("C_ioc", "field ", field); check("C_ioc", "method", method); - Console.println; + Console.println() } //############################################################################ @@ -79,7 +79,7 @@ class C_oic() { check("C_oic", "v_oic ", v_oic); check("C_oic", "field ", field); check("C_oic", "method", method); - Console.println; + Console.println() } //############################################################################ diff --git a/test/files/run/iq.scala b/test/files/run/iq.scala index 7d2dae918813..e082300725af 100644 --- a/test/files/run/iq.scala +++ b/test/files/run/iq.scala @@ -95,7 +95,7 @@ object iq { */ Console.print("Elements: "); q6.iterator.foreach(e => Console.print(" "+ e + " ")) - Console.println; + Console.println() /* Testing mkString * Expected: String: <1-2-3-4-5-6-7-8-9> diff --git a/test/files/run/iterator3444.scala b/test/files/run/iterator3444.scala index 0a8f94291c3b..43037a440cf1 100644 --- a/test/files/run/iterator3444.scala +++ b/test/files/run/iterator3444.scala @@ -6,11 +6,11 @@ object Test { def main(args: Array[String]): Unit = { val it = (1 to 12).toSeq.iterator - assert(it.next == 1) + assert(it.next() == 1) assert(it.take(2).toList == List(2, 3)) val jt = (4 to 12).toSeq.iterator - assert(jt.next == 4) + assert(jt.next() == 4) assert(jt.drop(5).toList == List(10, 11, 12)) val kt = (1 until 10).toSeq.iterator diff --git a/test/files/run/kmpSliceSearch.scala b/test/files/run/kmpSliceSearch.scala index 66ed7f310b9e..e9d0c032d0a0 100644 --- a/test/files/run/kmpSliceSearch.scala +++ b/test/files/run/kmpSliceSearch.scala @@ -16,13 +16,13 @@ object Test { for (h <- Array(2,5,1000)) { for (i <- 0 to 100) { for (j <- 0 to 10) { - val xs = (0 to j).map(_ => (rng.nextInt & 0x7FFFFFFF) % h) + val xs = (0 to j).map(_ => (rng.nextInt() & 0x7FFFFFFF) % h) val xsa = xs.toArray val xsv = Vector() ++ xs val xsl = xs.toList val xss = Vector[Seq[Int]](xs,xsa.toIndexedSeq,xsv,xsl) for (k <- 0 to 5) { - val ys = (0 to k).map(_ => (rng.nextInt & 0x7FFFFFFF) % h) + val ys = (0 to k).map(_ => (rng.nextInt() & 0x7FFFFFFF) % h) val ysa = ys.toArray val ysv = Vector() ++ ys val ysl = ys.toList diff --git a/test/files/run/lisp.scala b/test/files/run/lisp.scala index 17f1857f7ce7..59611a6fd9c1 100644 --- a/test/files/run/lisp.scala +++ b/test/files/run/lisp.scala @@ -245,10 +245,10 @@ object LispCaseClasses extends Lisp { else SYM(token) } def parseList: Data = { - val token = it.next; + val token = it.next(); if (token == ")") NIL() else CONS(parse(token), parseList) } - parse(it.next) + parse(it.next()) } def lisp2string(d: Data): String = d.toString(); @@ -437,10 +437,10 @@ object LispAny extends Lisp { else Symbol(token) } def parseList: List[Data] = { - val token = it.next; + val token = it.next(); if (token == ")") Nil else parse(token) :: parseList } - parse(it.next) + parse(it.next()) } } @@ -457,14 +457,14 @@ class LispUser(lisp: Lisp) { Console.println(string2lisp("(lambda (x) (+ (* x x) 1))").asInstanceOf[AnyRef]); Console.println(lisp2string(string2lisp("(lambda (x) (+ (* x x) 1))"))); - Console.println; + Console.println() Console.println("( '(1 2 3)) = " + evaluate(" (quote(1 2 3))")); Console.println("(car '(1 2 3)) = " + evaluate("(car (quote(1 2 3)))")); Console.println("(cdr '(1 2 3)) = " + evaluate("(cdr (quote(1 2 3)))")); Console.println("(null? '(2 3)) = " + evaluate("(null? (quote(2 3)))")); Console.println("(null? '()) = " + evaluate("(null? (quote()))")); - Console.println; + Console.println() Console.println("faculty(10) = " + evaluate( "(def (faculty n) " + @@ -500,7 +500,7 @@ class LispUser(lisp: Lisp) { "(val v3 (+ (+ (foo 3) (foo 4)) (foo 5)) " + "(val v4 (foo 6) " + "(cons v1 (cons v2 (cons v3 (cons v4 nil))))))))))")); - Console.println; + Console.println() } } diff --git a/test/files/run/misc.scala b/test/files/run/misc.scala index bbef7b57b1ba..9bcea7aa44c9 100644 --- a/test/files/run/misc.scala +++ b/test/files/run/misc.scala @@ -9,11 +9,11 @@ object Test { Console.print("### fib("); Console.print(n); Console.print(") = "); - Console.flush; + Console.flush() val v = fib(n); Console.print(v); - Console.println; - Console.flush; + Console.println() + Console.flush() v } @@ -57,7 +57,7 @@ object Test { Console.print("### "); Console.println(17); Console.println("### Bye"); - Console.println; + Console.println() val x = 13; x; // !!! why are DefDef replaced by Block(Tree[0])? we should use Empty! @@ -99,10 +99,10 @@ object Test { val mySub = new MySubclass(); Console.println(mySub); myObj.test(); - Console.println; + Console.println() Console.println(apply_any(id_any, "identity").toString()); - Console.println; + Console.println() }; foobar; @@ -135,13 +135,13 @@ case class Y(y: Int, z: Int) extends X(y + z) { Console.println("A.a = " + a.getA); Console.println("B.a = " + b.getA); Console.println("B.b = " + b.getB); - Console.println; + Console.println() Console.println("X.a = " + x.getX); Console.println("Y.a = " + y.getX); Console.println("Y.b = " + y.getY); Console.println("Y.b = " + y.y); - Console.println; + Console.println() } //############################################################################ @@ -168,10 +168,10 @@ val x: X = new X(); val y: X = new Y(); x.foo; -Console.println; +Console.println() y.foo; -Console.println; +Console.println() } //############################################################################ @@ -210,7 +210,7 @@ class O(a: Int) { Console.println(new O(1).foo) } -Console.println; +Console.println() case class Bar(); diff --git a/test/files/run/overloads.scala b/test/files/run/overloads.scala index e84fef021365..aab67762fd5e 100644 --- a/test/files/run/overloads.scala +++ b/test/files/run/overloads.scala @@ -40,8 +40,8 @@ object overloads { if (value == "\u0000") value = "\\u0000"; Console.print(": " + what + " = " + value); if (!success) Console.print(" != " + expected); - Console.println; - Console.flush; + Console.println() + Console.flush() } def - = 0; diff --git a/test/files/run/partialfun.scala b/test/files/run/partialfun.scala index 796b3457bc89..a75b1aacfc49 100644 --- a/test/files/run/partialfun.scala +++ b/test/files/run/partialfun.scala @@ -6,7 +6,7 @@ object Test { val repr: Repr = _this.asInstanceOf[Repr] val b = bf.newBuilder(repr) _this foreach { x => if (pf isDefinedAt x) b += pf(x) } - b.result + b.result() } def collectRW[A, B, CC[_], Repr, That](_this: IterableOps[A, CC, Repr])(pf: PartialFunction[A, B])(implicit bf: BuildFrom[Repr, B, That]): That = { @@ -14,7 +14,7 @@ object Test { val b = bf.newBuilder(repr) val f = pf runWith { b += _ } _this foreach f - b.result + b.result() } var cnt = 0 diff --git a/test/files/run/patmat-exprs.scala b/test/files/run/patmat-exprs.scala index 2416d265c42f..bece2d04a1ac 100644 --- a/test/files/run/patmat-exprs.scala +++ b/test/files/run/patmat-exprs.scala @@ -97,7 +97,7 @@ trait Pattern { val i1 = a.iterator val i2 = b.iterator while (i1.hasNext && i2.hasNext) - if (!similar(i1.next, i2.next)) + if (!similar(i1.next(), i2.next())) return false; true; } @@ -212,22 +212,22 @@ trait Pattern { private def reduce(implicit num: NumericOps[T]): Expr[T] = { this match { case Add(Seq(Neg(x), Neg(y), Neg(z))) => Neg(Add(List(x, y, z))) - case Add(Seq(Mul(x, y), z)) if (x == z) => Mul(x, Add(List(y, One[T]))) - case Add(Seq(Mul(x, y), z)) if (y == z) => Mul(y, Add(List(z, One[T]))) + case Add(Seq(Mul(x, y), z)) if (x == z) => Mul(x, Add(List(y, One[T]()))) + case Add(Seq(Mul(x, y), z)) if (y == z) => Mul(y, Add(List(z, One[T]()))) case Add(Seq(Mul(x, y), Mul(u, w))) if (x == u) => Mul(x, Add(List(y, w))) case Add(Seq(Mul(x, y), Mul(u, w))) if (y == w) => Mul(y, Add(List(x, u))) case Add(Seq(Add(x), Add(y))) => Add(x.toList ::: y.toList).simplify case Add(Seq(Add(x), y)) => Add(y :: x.toList).simplify case Add(Seq(x, Add(y))) => Add(x :: y.toList).simplify case Add(x) => { - val noZeros = x.filter(_ != Zero[T]) + val noZeros = x.filter(_ != Zero[T]()) val noOnes = noZeros.map { case y: One[_] => Const(num.one); case y => y } val constant = num.sum(noOnes.collect { case c: Const[T] => c.value }) val rest = noOnes.filter(x => !x.isInstanceOf[Const[_]]).toList val reduced = reduceComponents(rest) val args = if (num.similar(constant, num.zero)) reduced else reduced ::: Const(constant) :: Nil args.size match { - case 0 => Zero[T] + case 0 => Zero[T]() case 1 => args.head case 2 => Add2(args(0), args(1)) case 3 => Add3(args(0), args(1), args(2)) @@ -236,20 +236,20 @@ trait Pattern { } case Sub(x: Zero[_], y) => Neg(y) case Sub(x, y: Zero[_]) => x - case Sub(x, y) if x == y => Zero[T] - case Sub(Mul(x, y), z) if (x == z) => Mul(x, Sub(y, One[T])) - case Sub(Mul(x, y), z) if (y == z) => Mul(y, Sub(z, One[T])) + case Sub(x, y) if x == y => Zero[T]() + case Sub(Mul(x, y), z) if (x == z) => Mul(x, Sub(y, One[T]())) + case Sub(Mul(x, y), z) if (y == z) => Mul(y, Sub(z, One[T]())) case Sub(Mul(x, y), Mul(u, w)) if (x == u) => Mul(x, Sub(y, w)) case Sub(Mul(x, y), Mul(u, w)) if (y == w) => Mul(y, Sub(x, u)) - case Mul(x: Zero[_], y) => Zero[T] - case Mul(x, y: Zero[_]) => Zero[T] + case Mul(x: Zero[_], y) => Zero[T]() + case Mul(x, y: Zero[_]) => Zero[T]() case Mul(x: One[_], y) => y case Mul(x, y: One[_]) => x case Mul(Neg(x: One[_]), y) => Neg(y) case Mul(x, Neg(y: One[_])) => Neg(x) case Mul(x, y) if (x == y) => Sqr(x) - case Div(x: Zero[_], y) => Zero[T] // warning: possibly extends domain + case Div(x: Zero[_], y) => Zero[T]() // warning: possibly extends domain case Div(x, y: One[_]) => x case Div(Sqr(x), y) if x == y => x case Div(Mul(x, y), z) if (x == z) => y @@ -263,12 +263,12 @@ trait Pattern { case Div(x: One[_], y) => Inv(y) case Div(x, Sqr(y)) if x == y => Inv(y) case Div(Mul(x, y), Sqr(Mul(u, w))) if x == u && y == w => Inv(Mul(x, y)) - case Div(x, y) if x == y => One[T] + case Div(x, y) if x == y => One[T]() case Mul(Neg(a), Neg(b)) => Mul(a, b) case Div(Neg(a), Neg(b)) => Div(a, b) - case Neg(x: Zero[_]) => Zero[T] + case Neg(x: Zero[_]) => Zero[T]() case Neg(x: One[_]) => Const(num.neg(num.one)) case Sub(Const(x), Const(y)) => const(num.sub(x, y)) case Mul(Const(x), Const(y)) => const(num.mul(x, y)) @@ -281,8 +281,8 @@ trait Pattern { case Mul(Mul(Const(y), z), Const(x)) => Mul(const(num.mul(x, y)), z) case Mul(Mul(y, Const(z)), Const(x)) => Mul(const(num.mul(x, z)), y) - case Const(x) if x == num.one => One[T] - case Const(x) if x == num.zero => Zero[T] + case Const(x) if x == num.one => One[T]() + case Const(x) if x == num.zero => Zero[T]() case Sub(x, Neg(y)) => Add(List(x, y)) case Sub(Neg(x), y) => Neg(Add(List(x, y))) @@ -340,26 +340,26 @@ trait Pattern { trait NonZero[T] extends Expr[T] case class Const[T](value: T)(implicit num: NumericOps[T]) extends Leaf[T] with NonZero[T] { - def derivative(variable: Var[T]) = Zero[T] + def derivative(variable: Var[T]) = Zero[T]() def eval(f: Any => Any) = value override def toString = value.toString } case class Zero[T]()(implicit num: NumericOps[T]) extends Leaf[T] { - def derivative(variable: Var[T]) = Zero[T] + def derivative(variable: Var[T]) = Zero[T]() def eval(f: Any => Any) = num.zero override def toString = "0" } case class One[T]()(implicit num: NumericOps[T]) extends Leaf[T] { - def derivative(variable: Var[T]) = Zero[T] + def derivative(variable: Var[T]) = Zero[T]() def eval(f: Any => Any) = num.one override def toString = "1" } abstract class Var[T](implicit num: NumericOps[T]) extends Leaf[T] { - def derivative(variable: Var[T]) = if (variable == this) One[T] else Zero[T] + def derivative(variable: Var[T]) = if (variable == this) One[T]() else Zero[T]() def eval(f: Any => Any) = f(this).asInstanceOf[T] } @@ -565,7 +565,7 @@ trait Pattern { object Expr { /** Creates a constant expression */ def const[T](value: T)(implicit num: NumericOps[T]): Leaf[T] = - if (num.zero == value) Zero[T] + if (num.zero == value) Zero[T]() else Const(value) implicit def double2Constant[T](d: Double)(implicit num: NumericOps[T]): Leaf[T] = diff --git a/test/files/run/patmat-mix-case-extractor.scala b/test/files/run/patmat-mix-case-extractor.scala index 138216fdb0ab..6baff641450d 100644 --- a/test/files/run/patmat-mix-case-extractor.scala +++ b/test/files/run/patmat-mix-case-extractor.scala @@ -51,7 +51,7 @@ class A { object Test { def main(args: Array[String]): Unit = { - (new A).run + (new A).run() } } diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala index 00f48aba8437..6ea6fdaea843 100644 --- a/test/files/run/patmatnew.scala +++ b/test/files/run/patmatnew.scala @@ -344,7 +344,7 @@ object Test { case n :: ls => flips((l take n reverse) ::: (l drop n)) + 1 } - def run(): Unit = { assertEquals("both", (Var("x"), Var("y")), f) } + def run(): Unit = { assertEquals("both", (Var("x"), Var("y")), f()) } } object TestUnbox { diff --git a/test/files/run/primitive-sigs-2-new.scala b/test/files/run/primitive-sigs-2-new.scala index 7de9b1c8ca8c..d76707cb00e9 100644 --- a/test/files/run/primitive-sigs-2-new.scala +++ b/test/files/run/primitive-sigs-2-new.scala @@ -30,7 +30,7 @@ object Test { def main(args: Array[String]): Unit = { println(c2.getGenericInterfaces.map(_.toString).sorted mkString " ") println(c1m ++ c2m sorted) - println(new C f) + println(new C().f()) c3m.sorted foreach println } } diff --git a/test/files/run/primitive-sigs-2-old.scala b/test/files/run/primitive-sigs-2-old.scala index 1d6181a98cb7..95dd4bfd7273 100644 --- a/test/files/run/primitive-sigs-2-old.scala +++ b/test/files/run/primitive-sigs-2-old.scala @@ -37,7 +37,7 @@ object Test { def main(args: Array[String]): Unit = { println(c2.getGenericInterfaces.map(_.toString).sorted mkString " ") println(c1m ++ c2m sorted) - println(new C f) + println(new C().f()) c3m.sorted foreach println } } diff --git a/test/files/run/reify_fors_newpatmat.scala b/test/files/run/reify_fors_newpatmat.scala index e01f0f6c6f39..5387590053ff 100644 --- a/test/files/run/reify_fors_newpatmat.scala +++ b/test/files/run/reify_fors_newpatmat.scala @@ -82,7 +82,7 @@ object Test extends App { print("Persons over 20:") olderThan20(persons) foreach { x => print(" " + x) } - println + println() import Numeric._ @@ -90,7 +90,7 @@ object Test extends App { print("findNums(15) =") findNums(15) foreach { x => print(" " + x) } - println + println() val xs = List(3.5, 5.0, 4.5) println("average(" + xs + ") = " + sum(xs) / xs.length) diff --git a/test/files/run/reify_fors_oldpatmat.scala b/test/files/run/reify_fors_oldpatmat.scala index e01f0f6c6f39..5387590053ff 100644 --- a/test/files/run/reify_fors_oldpatmat.scala +++ b/test/files/run/reify_fors_oldpatmat.scala @@ -82,7 +82,7 @@ object Test extends App { print("Persons over 20:") olderThan20(persons) foreach { x => print(" " + x) } - println + println() import Numeric._ @@ -90,7 +90,7 @@ object Test extends App { print("findNums(15) =") findNums(15) foreach { x => print(" " + x) } - println + println() val xs = List(3.5, 5.0, 4.5) println("average(" + xs + ") = " + sum(xs) / xs.length) diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index 099a353e8988..d2185f1cff54 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -43,8 +43,8 @@ object Test extends App { val Literal(Constant(s_format: String)) = format val paramsStack = scala.collection.mutable.Stack(params: _*) val parsed = s_format.split("(?<=%[\\w%])|(?=%[\\w%])") map { - case "%d" => createTempValDef( paramsStack.pop, typeOf[Int] ) - case "%s" => createTempValDef( paramsStack.pop, typeOf[String] ) + case "%d" => createTempValDef( paramsStack.pop(), typeOf[Int] ) + case "%s" => createTempValDef( paramsStack.pop(), typeOf[String] ) case "%%" => { (None:Option[Tree], Literal(Constant("%"))) } diff --git a/test/files/run/repl-save.scala b/test/files/run/repl-save.scala index bc9229597978..42074d2f3401 100644 --- a/test/files/run/repl-save.scala +++ b/test/files/run/repl-save.scala @@ -19,6 +19,6 @@ s"""| override def stripMargins: Boolean = true override def show() = { checkSession() - Console print saveto.toFile.slurp + Console print saveto.toFile.slurp() } } diff --git a/test/files/run/richs.scala b/test/files/run/richs.scala index e5c1d07880dc..9b5e0778c806 100644 --- a/test/files/run/richs.scala +++ b/test/files/run/richs.scala @@ -27,7 +27,7 @@ object RichCharTest1 extends RichTest { // private val it = s.iterator // private var c: Char = _ // def ch(): Char = c -// def nextch(): Unit = { c = if (it.hasNext) it.next else ';' } +// def nextch(): Unit = { c = if (it.hasNext) it.next() else ';' } // def err(msg: String) = println(msg) // nextch() // } diff --git a/test/files/run/runtime.scala b/test/files/run/runtime.scala index 007951c8d8c6..ca1fe858c81f 100644 --- a/test/files/run/runtime.scala +++ b/test/files/run/runtime.scala @@ -15,7 +15,7 @@ object Test0Test { i = i + 1; } Console.print("]"); - Console.println; + Console.println() } def test(args: Array[String]): Unit = { @@ -51,7 +51,7 @@ package test1.bar { class PrintStream() { def println(): Unit = { - Console.println; + Console.println() } } @@ -60,13 +60,13 @@ package test1.bar { object Test1Test { def test(args: Array[String]): Unit = { - {Console.print(10)}; Console.println; + {Console.print(10)}; Console.println(); // {System.out.print(11); java}.lang.System.out.println(); // {System.out.print(12); java.lang}.System.out.println(); // {System.out.print(13); java.lang.System}.out.println(); - {Console.print(14); Console}.println; - {Console.print(15); (() => Console.println):(() => Unit)}.apply(); - {Console.print(16); Console.println}; + {Console.print(14); Console}.println(); + {Console.print(15); (() => Console.println()):(() => Unit)}.apply(); + {Console.print(16); Console.println()}; {Console.print(20)}; test1.bar.System.out.println(); // {System.out.print(21); test1}.bar.System.out.println(); @@ -113,10 +113,10 @@ package test2 { object Test2Test { def test(args: Array[String]): Unit = { - test2.M0N0.run; Console.println; - test2.N0M0.run; Console.println; - test2.M1N0.run; Console.println; - test2.N1M0.run; Console.println; + test2.M0N0.run; Console.println() + test2.N0M0.run; Console.println() + test2.M1N0.run; Console.println() + test2.N1M0.run; Console.println() } } @@ -174,12 +174,12 @@ object Test { case exception: Throwable => { //val name: String = Thread.currentThread().getName(); Console.print("Exception in thread \"" + name + "\" " + exception); - Console.println; + Console.println() errors = errors + 1; } } Console.println(">>> " + name); - Console.println; + Console.println() } def main(args: Array[String]): Unit = { @@ -190,7 +190,7 @@ object Test { test("Test3" , Test3Test.test(args)); if (errors > 0) { - Console.println; + Console.println() Console.println(s"$errors error" + (if (errors > 1) "s" else "")); } } diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala index 8d83caf68fc6..cd8e24eb2445 100644 --- a/test/files/run/settings-parse.scala +++ b/test/files/run/settings-parse.scala @@ -4,7 +4,7 @@ import scala.tools.nsc._ object Test { val tokens = "" :: "-deprecation" :: "foo.scala" :: Nil - val permutations0 = tokens.toSet.subsets.flatMap(_.toList.permutations).toList.distinct + val permutations0 = tokens.toSet.subsets().flatMap(_.toList.permutations).toList.distinct def runWithCp(cp: String) = { val permutations = permutations0 flatMap ("-cp CPTOKEN" :: _ permutations) diff --git a/test/files/run/sip23-no-constant-folding.scala b/test/files/run/sip23-no-constant-folding.scala index 17cc9f1d8913..5b83fb888004 100644 --- a/test/files/run/sip23-no-constant-folding.scala +++ b/test/files/run/sip23-no-constant-folding.scala @@ -5,7 +5,7 @@ object Test extends App { x } - def testNoConstantFolding(): 23 = { + def testNoConstantFolding: 23 = { println("panda") 23 } diff --git a/test/files/run/slices.scala b/test/files/run/slices.scala index be55acdd9419..6bd7b1a41ffe 100644 --- a/test/files/run/slices.scala +++ b/test/files/run/slices.scala @@ -9,21 +9,21 @@ object Test extends App { println(List(1, 2, 3, 4).slice(-1, 1)) println(List(1, 2, 3, 4).slice(1, -1)) println(List(1, 2, 3, 4).slice(-2, 2)) - println + println() println(List(1, 2, 3, 4) take 3) println(List(1, 2, 3) take 3) println(List(1, 2) take 3) println((List(): List[Int]) take 3) println(List[Nothing]() take 3) - println + println() println(List(1, 2, 3, 4) drop 3) println(List(1, 2, 3) drop 3) println(List(1, 2) drop 3) println((List(): List[Int]) drop 3) println(List[Nothing]() drop 3) - println + println() // arrays println(Array(1, 2, 3, 4).slice(1, 2).deep) @@ -31,19 +31,19 @@ object Test extends App { println(Array(1, 2, 3, 4).slice(-1, 1).deep) println(Array(1, 2, 3, 4).slice(1, -1).deep) println(Array(1, 2, 3, 4).slice(-2, 2).deep) - println + println() println(Array(1, 2, 3, 4) take 3 deep) println(Array(1, 2, 3) take 3 deep) println(Array(1, 2) take 3 deep) println((Array(): Array[Int]) take 3 deep) // println(Array[Nothing]() take 3) // contrib #757 - println + println() println(Array(1, 2, 3, 4) drop 3 deep) println(Array(1, 2, 3) drop 3 deep) println(Array(1, 2) drop 3 deep) println((Array(): Array[Int]) drop 3 deep) // println(Array[Nothing]() drop 3) - println + println() } diff --git a/test/files/run/streams.scala b/test/files/run/streams.scala index 06342650b88c..6966c9290e60 100644 --- a/test/files/run/streams.scala +++ b/test/files/run/streams.scala @@ -7,7 +7,7 @@ object Test extends App { println(s0.lengthCompare(-5) > 0) println(s0.lengthCompare(0) == 0) println(s0.lengthCompare(5) < 0) - println + println() val s1 = LazyList.cons(1, LazyList.empty) println(s1.toArray.deep) @@ -21,7 +21,7 @@ object Test extends App { println(s1.lengthCompare(0) > 0) println(s1.lengthCompare(1) == 0) println(s1.lengthCompare(5) < 0) - println + println() val s2 = s1.lazyAppendedAll(LazyList.cons(2, LazyList.empty)) println(s2.toArray.deep) @@ -34,7 +34,7 @@ object Test extends App { println(s2.lengthCompare(1) > 0) println(s2.lengthCompare(2) == 0) println(s2.lengthCompare(5) < 0) - println + println() val s3 = LazyList.range(1, 1000) //100000 (ticket #153: Stackoverflow) println(s3.length) @@ -58,7 +58,7 @@ object Test extends App { val arr = new Array[Int](size) LazyList.from(1).take(size).copyToArray(arr, 0) - println + println() // ticket #6415 lazy val x = { println("evaluated"); 1 } diff --git a/test/files/run/t0325.scala b/test/files/run/t0325.scala index ea6180306f0e..35b97a97f3b0 100644 --- a/test/files/run/t0325.scala +++ b/test/files/run/t0325.scala @@ -33,11 +33,11 @@ object Test { for (c <- badChars) test(("a"+c+"b").split(c),"RichString split('"+ c + "')") - println + println() for (c <- badChars) test(RS("a"+c+"b").split(c),"RS split('"+ c + "')") - println + println() val badCases = List( ']' -> "x]", '&' -> "&&",'\\' -> "\\x", '[' -> "[x", @@ -45,7 +45,7 @@ object Test { ) for ((c,str) <- badCases) test(("a"+c+"b").split(str.toArray),"RichString split(\""+ str + "\")") - println + println() for ((c,str) <- badCases) test(RS("a"+c+"b").split(str.toArray),"RS split(\""+ str + "\")") diff --git a/test/files/run/t10513.scala b/test/files/run/t10513.scala index 28518b1220b1..3e8f3b427696 100644 --- a/test/files/run/t10513.scala +++ b/test/files/run/t10513.scala @@ -18,7 +18,7 @@ object Test { val numFutures = 4000 val rng = new Random() - val longStandingPromise = Promise[Nothing] + val longStandingPromise = Promise[Nothing]() val futures = List.tabulate(numFutures) { i => val arr = new Array[Int](arrSz) diff --git a/test/files/run/t1195-new.scala b/test/files/run/t1195-new.scala index 95d0e6259287..322bb33bb136 100644 --- a/test/files/run/t1195-new.scala +++ b/test/files/run/t1195-new.scala @@ -3,13 +3,13 @@ import scala.language.{ existentials } import scala.reflect.runtime.universe._ object Test { - def f() = { case class Bar(x: Int); Bar } - def g() = { case class Bar(x: Int); Bar(5) } - def h() = { case object Bar ; Bar } + def f = { case class Bar(x: Int); Bar } + def g = { case class Bar(x: Int); Bar(5) } + def h = { case object Bar ; Bar } - val f1 = f() - val g1 = g() - val h1 = h() + val f1 = f + val g1 = g + val h1 = h def m[T: WeakTypeTag](x: T) = println(weakTypeOf[T].toString + ", underlying = " + weakTypeOf[T].typeSymbol.info) diff --git a/test/files/run/t1195-old.scala b/test/files/run/t1195-old.scala index f80734c22868..5e0b3dc1ef68 100644 --- a/test/files/run/t1195-old.scala +++ b/test/files/run/t1195-old.scala @@ -2,13 +2,13 @@ import scala.language.{ existentials } object Test { - def f() = { case class Bar(x: Int); Bar } - def g() = { case class Bar(x: Int); Bar(5) } - def h() = { case object Bar ; Bar } + def f = { case class Bar(x: Int); Bar } + def g = { case class Bar(x: Int); Bar(5) } + def h = { case object Bar ; Bar } - val f1 = f() - val g1 = g() - val h1 = h() + val f1 = f + val g1 = g + val h1 = h def m[T: Manifest](x: T) = println(manifest[T]) diff --git a/test/files/run/t1535.scala b/test/files/run/t1535.scala index b0163a9710d5..1089c0b809b3 100644 --- a/test/files/run/t1535.scala +++ b/test/files/run/t1535.scala @@ -9,7 +9,7 @@ class ClassDecl extends BlockStmt { } object Test extends App { - val n = new ClassDecl () - println (n.x) - println (n.y) + val n = new ClassDecl() + println(n.x) + println(n.y) } diff --git a/test/files/run/t1909b.scala b/test/files/run/t1909b.scala index 89b2af57dc6e..5f662b234d84 100644 --- a/test/files/run/t1909b.scala +++ b/test/files/run/t1909b.scala @@ -1,7 +1,7 @@ class Ticket1909 (x: Int) { def this() = this({ def bar() = 5 - bar + bar() }) } object Test extends App { diff --git a/test/files/run/t2333.scala b/test/files/run/t2333.scala index de405a8edc2a..3b2444a52d58 100644 --- a/test/files/run/t2333.scala +++ b/test/files/run/t2333.scala @@ -11,6 +11,6 @@ class A { object Test { def main(a: Array[String]): Unit = { val a = new A - a.whatever + a.whatever() } } diff --git a/test/files/run/t2552.scala b/test/files/run/t2552.scala index 0c6b4f005be1..d93d7fa54c1e 100644 --- a/test/files/run/t2552.scala +++ b/test/files/run/t2552.scala @@ -9,9 +9,9 @@ object Test extends App { println(zeroTo1.hasNext) println(zeroTo1.hasNext) - println(zeroTo1.next) + println(zeroTo1.next()) println(zeroTo1.hasNext) - println(zeroTo1.next) + println(zeroTo1.next()) println(zeroTo1.hasNext) println(zeroTo1.hasNext) } @@ -23,7 +23,7 @@ object Test extends App { println(evens.hasNext) println(evens.hasNext) - println(evens.next) + println(evens.next()) evens.foreach(println _) } diff --git a/test/files/run/t3242b.scala b/test/files/run/t3242b.scala index 7a296aac1556..22d22ac546bc 100644 --- a/test/files/run/t3242b.scala +++ b/test/files/run/t3242b.scala @@ -6,7 +6,7 @@ object Test { var vb = new VectorBuilder[Int] for (i <- 0 until n) vb += i - val v = vb.result + val v = vb.result() assert(v == (0 until n), "not same as (0 until " + n + "): " + v) } diff --git a/test/files/run/t3269.scala b/test/files/run/t3269.scala index 17e42cdb0e94..187098790ba2 100644 --- a/test/files/run/t3269.scala +++ b/test/files/run/t3269.scala @@ -1,7 +1,7 @@ object Test { def main(args: Array[String]): Unit = { val it = List(1).iterator ++ { println("Hello"); Iterator.empty } - println(it.next) + println(it.next()) it.hasNext it.hasNext it.hasNext diff --git a/test/files/run/t3346e.scala b/test/files/run/t3346e.scala index 4e032e324804..350e5a615ebb 100644 --- a/test/files/run/t3346e.scala +++ b/test/files/run/t3346e.scala @@ -28,7 +28,7 @@ class QuickSort[Coll](a: Coll) { b ++= new QuickSort(lower).quickSortAnything b ++= same b ++= new QuickSort(upper).quickSortAnything - b.result + b.result() } } } diff --git a/test/files/run/t3530.scala b/test/files/run/t3530.scala index 62b7c836e3b3..a567d1a8982d 100644 --- a/test/files/run/t3530.scala +++ b/test/files/run/t3530.scala @@ -22,7 +22,7 @@ object Test { f(List(1,2,3,4,5)) f(null) - println + println() f2(List(1, 2)) f2(List('a', 'b', 'c')) diff --git a/test/files/run/t4054.scala b/test/files/run/t4054.scala index b57c08361573..f5b5af4c4f7a 100644 --- a/test/files/run/t4054.scala +++ b/test/files/run/t4054.scala @@ -10,16 +10,16 @@ object Test { def main(args: Array[String]): Unit = { val it = Iterator.from(1).map(n => n * n).scanLeft(0)(_+_) - assert(it.next == 0) - assert(it.next == 1) - assert(it.next == 5) - assert(it.next == 14) - assert(it.next == 30) - assert(it.next == 55) - assert(it.next == 91) - assert(it.next == 140) - assert(it.next == 204) - assert(it.next == 285) - assert(it.next == 385) + assert(it.next() == 0) + assert(it.next() == 1) + assert(it.next() == 5) + assert(it.next() == 14) + assert(it.next() == 30) + assert(it.next() == 55) + assert(it.next() == 91) + assert(it.next() == 140) + assert(it.next() == 204) + assert(it.next() == 285) + assert(it.next() == 385) } } diff --git a/test/files/run/t4225d.scala b/test/files/run/t4225d.scala index 9fb80e0fdb26..4b506b911415 100644 --- a/test/files/run/t4225d.scala +++ b/test/files/run/t4225d.scala @@ -27,14 +27,14 @@ object Test extends App { } f0.op0(effect) - println + println() object f1 extends Foo { println("f1") } f1.op1(effect) - println + println() } { @@ -52,13 +52,13 @@ object Test extends App { } f0.op0(effect) - println + println() object f1 extends Foo { println("f1") } f1.op1(effect) - println + println() } } diff --git a/test/files/run/t4225e.scala b/test/files/run/t4225e.scala index 39c702d3f804..0b1455c1a0e0 100644 --- a/test/files/run/t4225e.scala +++ b/test/files/run/t4225e.scala @@ -18,16 +18,16 @@ object Test extends App { mkBarString andThen_: mkFoo - println + println() mkFoo.andThen_:(mkBarString) - println + println() // bar should be deferred but isn't due to scala/bug#10693 mkBarString andThenByName_: mkFoo - println + println() mkFoo.andThenByName_:(mkBarString) } diff --git a/test/files/run/t4671.check b/test/files/run/t4671.check index a2b873510f92..c6d1061644fe 100644 --- a/test/files/run/t4671.check +++ b/test/files/run/t4671.check @@ -5,7 +5,7 @@ object o scala> val s = scala.io.Source.fromFile(o.file) val s: scala.io.BufferedSource = -scala> println(s.getLines.mkString("\n")) +scala> println(s.getLines().mkString("\n")) import scala.tools.partest.ReplTest object Test extends ReplTest { @@ -13,7 +13,7 @@ object Test extends ReplTest { def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } val s = scala.io.Source.fromFile(o.file) -println(s.getLines.mkString("\n")) +println(s.getLines().mkString("\n")) val s = scala.io.Source.fromFile(o.file) println(s.mkString("")) @@ -33,7 +33,7 @@ object Test extends ReplTest { def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } val s = scala.io.Source.fromFile(o.file) -println(s.getLines.mkString("\n")) +println(s.getLines().mkString("\n")) val s = scala.io.Source.fromFile(o.file) println(s.mkString("")) diff --git a/test/files/run/t4671.scala b/test/files/run/t4671.scala index 6170104c33b5..766d7ae138cb 100644 --- a/test/files/run/t4671.scala +++ b/test/files/run/t4671.scala @@ -5,7 +5,7 @@ object Test extends ReplTest { def code = """ object o { val file = sys.props("partest.cwd") + "/t4671.scala" } val s = scala.io.Source.fromFile(o.file) -println(s.getLines.mkString("\n")) +println(s.getLines().mkString("\n")) val s = scala.io.Source.fromFile(o.file) println(s.mkString("")) diff --git a/test/files/run/t4809.scala b/test/files/run/t4809.scala index 9c66458050db..f26d17c5b3df 100644 --- a/test/files/run/t4809.scala +++ b/test/files/run/t4809.scala @@ -8,7 +8,7 @@ object Test { def main(args: Array[String]): Unit = { val x = tryBreakable { - break + break() 2 } catchBreak { 3 @@ -23,7 +23,7 @@ object Test { assert(y == 2, y) val z = tryBreakable { - break + break() 1.0 } catchBreak { 2 diff --git a/test/files/run/t5577.scala b/test/files/run/t5577.scala index a51ec94320f9..9ccc52d6fc67 100644 --- a/test/files/run/t5577.scala +++ b/test/files/run/t5577.scala @@ -15,7 +15,7 @@ object Test { iteratorBuilder.sizeHint(10) iteratorBuilder ++= (0 until 10) - iteratorBuilder.result.foreach(println) + iteratorBuilder.result().foreach(println) } } diff --git a/test/files/run/t5612.scala b/test/files/run/t5612.scala index 08d006f88276..950f38fb0d6a 100644 --- a/test/files/run/t5612.scala +++ b/test/files/run/t5612.scala @@ -11,7 +11,7 @@ class Foo { x match { case L.One => println("ONE"); return case L.Two => println("TWO") - case L.Three => println("THREE"); break + case L.Three => println("THREE"); break() } } } diff --git a/test/files/run/t5907.check b/test/files/run/t5907.check index bc23692679dc..41b5a3a0d184 100644 --- a/test/files/run/t5907.check +++ b/test/files/run/t5907.check @@ -22,8 +22,6 @@ c8: 1, 82, 2111, schtring c8: -1, 92, 29, lken c9: 1, 271, ehebab c9: 1, 299, enag -c9: 1, 299, enag -c9: 1, 299, enag c9: -42, 99, flae c9: 10, 298, 27 c9: elkn, en, emn diff --git a/test/files/run/t5907.scala b/test/files/run/t5907.scala index 7a559f799d3b..3920aa3eef4e 100644 --- a/test/files/run/t5907.scala +++ b/test/files/run/t5907.scala @@ -66,8 +66,6 @@ object Test extends App { { implicit val s = "enag" - println(c9.copy()(299)) - println(c9.copy()(299)()) println(c9.copy()(299)()()) println(c9.copy(x = -42)(99)()()("flae")) } diff --git a/test/files/run/t5923b/Test.scala b/test/files/run/t5923b/Test.scala index 483830954bad..0d50fe7726bc 100644 --- a/test/files/run/t5923b/Test.scala +++ b/test/files/run/t5923b/Test.scala @@ -1,7 +1,7 @@ object Test extends App { import scala.collection.Factory val cbf = implicitly[Factory[Nothing, Array[Nothing]]] - println(cbf.newBuilder.result.getClass) + println(cbf.newBuilder.result().getClass) println(new Array[Nothing](0).getClass) println(Array[Nothing]().getClass) } diff --git a/test/files/run/t6240-universe-code-gen.scala b/test/files/run/t6240-universe-code-gen.scala index 6a1d5d91ca26..215c7f773c96 100644 --- a/test/files/run/t6240-universe-code-gen.scala +++ b/test/files/run/t6240-universe-code-gen.scala @@ -76,7 +76,7 @@ object Test extends App { val testFile = new File(sys.props("partest.test-path")) val actualFile = new java.io.File(testFile.getParent + "/../../../src/reflect/scala/reflect/runtime/JavaUniverseForce.scala").getCanonicalFile val actual = scala.io.Source.fromFile(actualFile) - val actualLines = actual.getLines.toList + val actualLines = actual.getLines().toList val generatedLines = code.linesIterator.toList if (actualLines != generatedLines) { val msg = s"""|${actualFile} must be updated. diff --git a/test/files/run/t6669.scala b/test/files/run/t6669.scala index fd1fa1124a2f..4bb3a41da191 100644 --- a/test/files/run/t6669.scala +++ b/test/files/run/t6669.scala @@ -14,7 +14,7 @@ object Test extends App { //val currentLocationCpFragment = File.pathSeparator + "." // let's assume dirs don't normally have dots - def hasCurrentDir(s: String): Boolean = s.linesIterator.next.split("[ ,:;]").exists(_.endsWith(".")) + def hasCurrentDir(s: String): Boolean = s.linesIterator.next().split("[ ,:;]").exists(_.endsWith(".")) // now make sure we saw the '.' in the classpath val msg1 = baos.toString() diff --git a/test/files/run/t6863.check b/test/files/run/t6863.check index 9e9c52bdaa99..a271f47256cb 100644 --- a/test/files/run/t6863.check +++ b/test/files/run/t6863.check @@ -1,12 +1,12 @@ t6863.scala:41: warning: comparing values of types Unit and Unit using `==` will always yield true - assert({ () => x}.apply == u) - ^ + assert({ () => x}.apply() == u) + ^ t6863.scala:45: warning: comparing values of types Unit and Unit using `==` will always yield true - assert({ () => x}.apply == u) - ^ + assert({ () => x}.apply() == u) + ^ t6863.scala:49: warning: comparing values of types Unit and Unit using `==` will always yield true - assert({ () => x}.apply == u) - ^ + assert({ () => x}.apply() == u) + ^ t6863.scala:62: warning: comparing values of types Unit and Unit using `==` will always yield true - assert({ () => x }.apply == u) - ^ + assert({ () => x }.apply() == u) + ^ diff --git a/test/files/run/t6863.scala b/test/files/run/t6863.scala index b784f20407f7..b93af897354c 100644 --- a/test/files/run/t6863.scala +++ b/test/files/run/t6863.scala @@ -6,84 +6,84 @@ object Test { def lazyVal() = { // internally lazy vals become vars which are initialized with "_", so they need to be tested just like vars do lazy val x = "42" - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def ident() = { val y = "42" var x = y - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def apply() = { def y(x : Int) = x.toString var x = y(42) - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def literal() = { var x = "42" - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def `new`() = { var x = new String("42") - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def select() = { object Foo{val bar = "42"} var x = Foo.bar - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def `throw`() = { var x = if (true) "42" else throw new Exception("42") - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def assign() = { var y = 1 var x = y = 42 - assert({ () => x}.apply == u) + assert({ () => x}.apply() == u) } def valDef() = { var x = {val y = 42} - assert({ () => x}.apply == u) + assert({ () => x}.apply() == u) } def `return`(): String = { var x = if (true) return "42" else () - assert({ () => x}.apply == u) + assert({ () => x}.apply() == u) "42" } def tryFinally() = { var x = try { "42" } finally () - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def tryCatch() = { var x = try { "42" } catch { case _: Throwable => "43" } - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def `if`() = { var x = if (true) () - assert({ () => x }.apply == u) + assert({ () => x }.apply() == u) } def ifElse() = { var x = if(true) "42" else "43" - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def matchCase() = { var x = 100 match { case 100 => "42" case _ => "43" } - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def block() = { var x = { val y = 42 "42" } - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def labelDef() = { var x = 100 match { case 100 => try "42" finally () } - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def nested() = { var x = { @@ -91,7 +91,7 @@ object Test { if(true) try "42" catch {case _: Throwable => "43"} else "44" } - assert({ () => x }.apply == "42") + assert({ () => x }.apply() == "42") } def main(args: Array[String]): Unit = { lazyVal() diff --git a/test/files/run/t8153.scala b/test/files/run/t8153.scala index 0cbfb5b5a6cf..f3063bdc7bfc 100644 --- a/test/files/run/t8153.scala +++ b/test/files/run/t8153.scala @@ -2,7 +2,7 @@ object Test { def f() = { val lb = scala.collection.mutable.ListBuffer[Int](1, 2) val it = lb.iterator - if (it.hasNext) it.next + if (it.hasNext) it.next() val xs = lb.toList lb += 3 it.mkString diff --git a/test/files/run/t9178a.scala b/test/files/run/t9178a.scala index 2f64104de4d6..6b359e80e683 100644 --- a/test/files/run/t9178a.scala +++ b/test/files/run/t9178a.scala @@ -3,7 +3,7 @@ abstract class Test { def foo(): Sam // no parens, instantiateToMethodType would wrap in a `new Sam { def apply = foo }` // rather than applying to an empty param list() */ - val f: Sam = foo + val f: Sam = foo() } object Test extends Test { diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala index 1930321376f8..f5bba10d3d78 100644 --- a/test/files/run/tailcalls.scala +++ b/test/files/run/tailcalls.scala @@ -294,7 +294,7 @@ object Test { print(" raised exception " + exception) } } - println + println() } def check_success_b(name: String, closure: => Boolean, expected: Boolean): Unit = { @@ -311,7 +311,7 @@ object Test { Console.print(" raised exception " + exception); } } - println + println() } def check_overflow(name: String, closure: => Int): Unit = { @@ -325,7 +325,7 @@ object Test { print(" raised exception " + exception) } } - println + println() } def calibrate: Int = { @@ -361,7 +361,7 @@ object Test { check_success("SubClass .f", SubClass .f(max, max), max) check_success("Sealed .f", Sealed .f(max, max), 0) check_success("SubSealed.f", SubSealed.f(max, max), max) - println + println() // test tail calls in nested classes/objects val c: C = new C @@ -395,7 +395,7 @@ object Test { check_success("c.c.O.c.f", c.c.O.c.f(max, max), 0) check_success("c.c.c.O.f", c.c.c.O.f(max, max), 0) check_success("c.c.c.c.f", c.c.c.c.f(max, max), 0) - println + println() // test tail calls with different signatures val TailCall = new TailCall("S") @@ -406,7 +406,7 @@ object Test { check_success("TailCall.g2", TailCall.g2(max, max ), 0) check_success("TailCall.g3", TailCall.g3(max, max, Nil), 0) check_success("TailCall.h1", TailCall.h1(max, max ), 0) - println + println() val NonTailCall = new NonTailCall check_success("NonTailCall.f1", NonTailCall.f1(2), 0) diff --git a/test/files/run/try.scala b/test/files/run/try.scala index 785f0153a7a5..35987aeaf72a 100644 --- a/test/files/run/try.scala +++ b/test/files/run/try.scala @@ -123,7 +123,7 @@ object Test extends AnyRef with App { try4; try5; try6; - Console.println; + Console.println() new A(); () } diff --git a/test/files/run/type-currying.scala b/test/files/run/type-currying.scala index 98357cd042b9..0c5f4609195f 100644 --- a/test/files/run/type-currying.scala +++ b/test/files/run/type-currying.scala @@ -17,10 +17,10 @@ object Partial { def apply[CC[K, V] <: collection.Map[K, V]] : KnownContainer[CC] = new { def values[V] : KnownValues[CC, V] = new { - def apply[K](implicit cbf: Factory[(K, V), CC[K, V]]) = cbf.newBuilder.result + def apply[K](implicit cbf: Factory[(K, V), CC[K, V]]) = cbf.newBuilder.result() } def apply[K] = new { - def apply[V](implicit cbf: Factory[(K, V), CC[K, V]]) = cbf.newBuilder.result + def apply[V](implicit cbf: Factory[(K, V), CC[K, V]]) = cbf.newBuilder.result() } } } diff --git a/test/files/run/unittest_iterator.scala b/test/files/run/unittest_iterator.scala index 3e179255ba64..f1e43f590967 100644 --- a/test/files/run/unittest_iterator.scala +++ b/test/files/run/unittest_iterator.scala @@ -23,7 +23,7 @@ object Test { // testing by-name padding val padIt = it - assertThat(4, List(10, 1, 2)) { it grouped 3 withPadding padIt.next } + assertThat(4, List(10, 1, 2)) { it grouped 3 withPadding padIt.next() } // sliding assertThat(8, List(8, 9, 10)) { it sliding 3 } @@ -40,9 +40,9 @@ object Test { // make sure it throws past the end val thrown = try { val it = List(1,2,3).sliding(2) - it.next - it.next - it.next + it.next() + it.next() + it.next() false } catch { diff --git a/test/files/run/unreachable.scala b/test/files/run/unreachable.scala index bb907c92bf62..1fc43e4b866c 100644 --- a/test/files/run/unreachable.scala +++ b/test/files/run/unreachable.scala @@ -9,14 +9,14 @@ object Test extends App { def unreachableIf: Int = { return 42 - if (nextInt % 2 == 0) + if (nextInt() % 2 == 0) 0 else 1 } def unreachableIfBranches: Int = { - if (nextInt % 2 == 0) + if (nextInt() % 2 == 0) return 42 else return 42 @@ -25,14 +25,14 @@ object Test extends App { } def unreachableOneLegIf: Int = { - if (nextInt % 2 == 0) + if (nextInt() % 2 == 0) return 42 return 42 } def unreachableLeftBranch: Int = { - val result = if (nextInt % 2 == 0) + val result = if (nextInt() % 2 == 0) return 42 else 42 @@ -41,7 +41,7 @@ object Test extends App { } def unreachableRightBranch: Int = { - val result = if (nextInt % 2 == 0) + val result = if (nextInt() % 2 == 0) 42 else return 42 @@ -92,7 +92,7 @@ object Test extends App { def unreachableSwitch: Int = { return 42 - val x = nextInt % 2 + val x = nextInt() % 2 x match { case 0 => return 0 case 1 => return 1 @@ -102,7 +102,7 @@ object Test extends App { } def unreachableAfterSwitch: Int = { - val x = nextInt % 2 + val x = nextInt() % 2 x match { case 0 => return 42 case 1 => return 41 + x diff --git a/test/files/run/vector1.scala b/test/files/run/vector1.scala index d0154dfaba5e..32eec3653494 100644 --- a/test/files/run/vector1.scala +++ b/test/files/run/vector1.scala @@ -15,7 +15,7 @@ object Test { for (i <- 0 until n) a += (label + i) - val res = a.result + val res = a.result() assertVector(res, label, 0, n) } diff --git a/test/files/specialized/arrays-traits.scala b/test/files/specialized/arrays-traits.scala index 528adab8bb5a..b0d1097f14dd 100644 --- a/test/files/specialized/arrays-traits.scala +++ b/test/files/specialized/arrays-traits.scala @@ -18,13 +18,13 @@ class BaseG[T](val arr: Array[T]) extends SuperG[T] { } object Test { def main(args: Array[String]): Unit = { - (new BaseS(new Array[String](1)): SuperS[String]).foo + (new BaseS(new Array[String](1)): SuperS[String]).foo() println(arrayApplyCount) (new BaseS(new Array[String](1)): SuperS[String]).bar(new Array[String](1)) println(arrayApplyCount) println(arrayUpdateCount) - (new BaseG(new Array[String](1)): SuperG[String]).foo + (new BaseG(new Array[String](1)): SuperG[String]).foo() println(arrayApplyCount) (new BaseG(new Array[String](1)): SuperG[String]).bar(new Array[String](1)) println(arrayApplyCount) diff --git a/test/files/specialized/fft.scala b/test/files/specialized/fft.scala index 455c00b56f49..e9feba316391 100644 --- a/test/files/specialized/fft.scala +++ b/test/files/specialized/fft.scala @@ -125,8 +125,8 @@ object Test { def setUp: Unit = { // print("Loading from %s.. ".format(inputFileName)) val f = io.Source.fromFile(inputFileName) - val lines = f.getLines - val n = lines.next.toInt + val lines = f.getLines() + val n = lines.next().toInt data = new Array[Complex](n) var i = 0 for (line <- lines if line != "") { diff --git a/test/files/specialized/spec-matrix-new.scala b/test/files/specialized/spec-matrix-new.scala index f20058881b27..752e8a23bc2a 100644 --- a/test/files/specialized/spec-matrix-new.scala +++ b/test/files/specialized/spec-matrix-new.scala @@ -42,7 +42,7 @@ object Test { val r = new util.Random(10) val x = new Matrix[Double](n, m) for (i <- 0 until n; j <- 0 until m) - x(i, j) = (r.nextInt % 1000).toDouble + x(i, j) = (r.nextInt() % 1000).toDouble x } @@ -50,7 +50,7 @@ object Test { for (i <- 0 until m.rows) { for (j <- 0 until m.cols) print("%5.3f ".format(m(i, j))) - println + println() } } diff --git a/test/files/specialized/spec-matrix-old.scala b/test/files/specialized/spec-matrix-old.scala index ca77b3696ecf..c66ab0daeae1 100644 --- a/test/files/specialized/spec-matrix-old.scala +++ b/test/files/specialized/spec-matrix-old.scala @@ -43,7 +43,7 @@ class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { val r = new util.Random(10) val x = new Matrix[Double](n, m) for (i <- 0 until n; j <- 0 until m) - x(i, j) = (r.nextInt % 1000).toDouble + x(i, j) = (r.nextInt() % 1000).toDouble x } @@ -51,7 +51,7 @@ class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { for (i <- 0 until m.rows) { for (j <- 0 until m.cols) print("%5.3f ".format(m(i, j))) - println + println() } } diff --git a/test/files/specialized/spec-super.scala b/test/files/specialized/spec-super.scala index a3024e930c46..3d309efeda47 100644 --- a/test/files/specialized/spec-super.scala +++ b/test/files/specialized/spec-super.scala @@ -3,10 +3,10 @@ object Test { def main(args: Array[String]): Unit = { val s = new Extended("s") - println(s.foo) //works + println(s.foo()) //works val i = new Extended(1) - println(i.foo) //infinite loop with StackOverflowError + println(i.foo()) //infinite loop with StackOverflowError println(runtime.BoxesRunTime.integerBoxCount) } @@ -16,5 +16,5 @@ class Base[@specialized(Int) T](val t: T) { def foo() :T = t } class Extended [@specialized(Int) T](t: T) extends Base[T](t) { - override def foo() :T = super.foo + override def foo() :T = super.foo() } diff --git a/test/junit/scala/collection/IteratorTest.scala b/test/junit/scala/collection/IteratorTest.scala index 2877be8b23a7..624872597f23 100644 --- a/test/junit/scala/collection/IteratorTest.scala +++ b/test/junit/scala/collection/IteratorTest.scala @@ -370,7 +370,7 @@ class IteratorTest { private def knownSizeDecreases[A](it: Iterator[A]): Unit = { val size = it.knownSize - it.next + it.next() assertEquals(size - 1, it.knownSize) } diff --git a/test/junit/scala/collection/SetMapConsistencyTest.scala b/test/junit/scala/collection/SetMapConsistencyTest.scala index afd80aabf804..466fc5bd56da 100644 --- a/test/junit/scala/collection/SetMapConsistencyTest.scala +++ b/test/junit/scala/collection/SetMapConsistencyTest.scala @@ -500,7 +500,7 @@ class SetMapConsistencyTest { it.hasNext xs.clear() - if (it.hasNext) Some(it.next) + if (it.hasNext) Some(it.next()) else None } assert(f() match { diff --git a/test/junit/scala/collection/immutable/RangeTest.scala b/test/junit/scala/collection/immutable/RangeTest.scala index 08c2b395095f..fb4ed05154b9 100644 --- a/test/junit/scala/collection/immutable/RangeTest.scala +++ b/test/junit/scala/collection/immutable/RangeTest.scala @@ -59,7 +59,7 @@ class RangeTest { val it = test.iterator it.drop(1) - assertEquals(11, it.next) + assertEquals(11, it.next()) } @Test def dropToEnd2(): Unit = { @@ -67,7 +67,7 @@ class RangeTest { val it = test.iterator it.drop(0) - assertEquals(10, it.next) + assertEquals(10, it.next()) } @Test(expected = classOf[IllegalArgumentException]) diff --git a/test/junit/scala/collection/immutable/VectorTest.scala b/test/junit/scala/collection/immutable/VectorTest.scala index 6724ad6d8805..99bc8dcc6569 100644 --- a/test/junit/scala/collection/immutable/VectorTest.scala +++ b/test/junit/scala/collection/immutable/VectorTest.scala @@ -112,23 +112,23 @@ class VectorTest { { var it = underlying.iterator.drop(start) assertFalse(it.hasNext) - intercept[NoSuchElementException](it.next) + intercept[NoSuchElementException](it.next()) it = it.drop(0) assertFalse(it.hasNext) it = it.drop(1) assertFalse(it.hasNext) it = it.drop(99) assertFalse(it.hasNext) - intercept[NoSuchElementException](it.next) + intercept[NoSuchElementException](it.next()) } { var it = underlying.iterator.drop(start) - intercept[NoSuchElementException](it.next) + intercept[NoSuchElementException](it.next()) it = it.drop(0) it = it.drop(1) it = it.drop(99) - intercept[NoSuchElementException](it.next) + intercept[NoSuchElementException](it.next()) } } } diff --git a/test/junit/scala/concurrent/FutureTest.scala b/test/junit/scala/concurrent/FutureTest.scala index c28871a02c7b..ef2177547329 100644 --- a/test/junit/scala/concurrent/FutureTest.scala +++ b/test/junit/scala/concurrent/FutureTest.scala @@ -16,8 +16,8 @@ class FutureTest { @Test def `bug/issues#10513 firstCompletedOf must not leak references`: Unit = { import ExecutionContext.Implicits._ - val unfulfilled = Promise[AnyRef] - val quick = Promise[AnyRef] + val unfulfilled = Promise[AnyRef]() + val quick = Promise[AnyRef]() val result = new AnyRef val first = Future.firstCompletedOf(List(quick.future, unfulfilled.future)) assertNotReachable(result, unfulfilled) { diff --git a/test/junit/scala/io/SourceTest.scala b/test/junit/scala/io/SourceTest.scala index a0f46ee4deb4..b3f107c22170 100644 --- a/test/junit/scala/io/SourceTest.scala +++ b/test/junit/scala/io/SourceTest.scala @@ -26,7 +26,7 @@ class SourceTest { private def in = new ByteArrayInputStream(sampler.getBytes) @Test def canIterateLines() = { - assertEquals(sampler.linesIterator.size, (Source fromString sampler).getLines.size) + assertEquals(sampler.linesIterator.size, (Source fromString sampler).getLines().size) } @Test def loadFromResource() = { val res = Source.fromResource("rootdoc.txt") diff --git a/test/junit/scala/tools/nsc/reporters/ConsoleReporterTest.scala b/test/junit/scala/tools/nsc/reporters/ConsoleReporterTest.scala index fe763fb5c205..c5b01182ca55 100644 --- a/test/junit/scala/tools/nsc/reporters/ConsoleReporterTest.scala +++ b/test/junit/scala/tools/nsc/reporters/ConsoleReporterTest.scala @@ -47,9 +47,9 @@ class ConsoleReporterTest { else if (!pos.isDefined) assertEquals(severity + msg, buf.linesIterator.next) else { val it = buf.linesIterator - assertEquals(source + ":1: " + severity + msg, it.next) - assertEquals(content, it.next) - assertEquals(" ^", it.next) + assertEquals(source + ":1: " + severity + msg, it.next()) + assertEquals(content, it.next()) + assertEquals(" ^", it.next()) } } finally writerOut.reset() @@ -147,8 +147,8 @@ class ConsoleReporterTest { val reporter = createConsoleReporter("s", writerOut, echoWriterOut) reporter.displayPrompt() val it = writerOut.toString.linesIterator - assertTrue(it.next.isEmpty) - assertEquals(output + "java.lang.Throwable", it.next) + assertTrue(it.next().isEmpty) + assertEquals(output + "java.lang.Throwable", it.next()) assertTrue(it.hasNext) /** Check for no stack trace */ diff --git a/test/scalacheck/treemap.scala b/test/scalacheck/treemap.scala index 398c2e5ad09d..b0d53fb6503a 100644 --- a/test/scalacheck/treemap.scala +++ b/test/scalacheck/treemap.scala @@ -18,7 +18,7 @@ object TreeMapTest extends Properties("TreeMap") { val it = subject.iterator var consistent = true subject.foreach { element => - consistent &&= it.hasNext && element == it.next + consistent &&= it.hasNext && element == it.next() } consistent } @@ -36,7 +36,7 @@ object TreeMapTest extends Properties("TreeMap") { val values = (1 to highest).reverse val subject = TreeMap(values zip values: _*) val it = subject.iterator - try { while (it.hasNext) it.next; true } catch { case _: Throwable => false } + try { while (it.hasNext) it.next(); true } catch { case _: Throwable => false } } property("sorted") = forAll { (subject: TreeMap[Int, String]) => (subject.size >= 3) ==> { diff --git a/test/scalacheck/treeset.scala b/test/scalacheck/treeset.scala index 37922320bca1..4f27bc3cde50 100644 --- a/test/scalacheck/treeset.scala +++ b/test/scalacheck/treeset.scala @@ -16,7 +16,7 @@ object TreeSetTest extends Properties("TreeSet") { val it = subject.iterator var consistent = true subject.foreach { element => - consistent &&= it.hasNext && element == it.next + consistent &&= it.hasNext && element == it.next() } consistent } @@ -34,7 +34,7 @@ object TreeSetTest extends Properties("TreeSet") { val values = (1 to highest).reverse val subject = TreeSet(values: _*) val it = subject.iterator - try { while (it.hasNext) it.next; true } catch { case _: Throwable => false } + try { while (it.hasNext) it.next(); true } catch { case _: Throwable => false } } property("sorted") = forAll { (subject: TreeSet[Int]) => (subject.size >= 3) ==> {