diff options
367 files changed, 1397 insertions, 525 deletions
diff --git a/src/partest/scala/tools/partest/nest/Runner.scala b/src/partest/scala/tools/partest/nest/Runner.scala index 01e4f50981..1034d724d2 100644 --- a/src/partest/scala/tools/partest/nest/Runner.scala +++ b/src/partest/scala/tools/partest/nest/Runner.scala @@ -14,7 +14,7 @@ import scala.collection.mutable.ListBuffer import scala.concurrent.duration.Duration import scala.io.Codec import scala.reflect.internal.FatalError -import scala.sys.process.Process +import scala.sys.process.{ Process, ProcessLogger } import scala.tools.nsc.Properties.{ envOrElse, isWin, jdkHome, javaHome, propOrElse, propOrEmpty, setProp } import scala.tools.nsc.{ Settings, CompilerCommand, Global } import scala.tools.nsc.io.{ AbstractFile, PlainFile } @@ -222,7 +222,25 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te * error out to output file. */ private def runCommand(args: Seq[String], outFile: File): Boolean = { - (Process(args) #> outFile !) == 0 + //(Process(args) #> outFile !) == 0 or (Process(args) ! pl) == 0 + val pl = ProcessLogger(outFile) + val nonzero = 17 // rounding down from 17.3 + def run: Int = { + val p = Process(args) run pl + try p.exitValue + catch { + case e: InterruptedException => + NestUI verbose s"Interrupted waiting for command to finish (${args mkString " "})" + p.destroy + nonzero + case t: Throwable => + NestUI verbose s"Exception waiting for command to finish: $t (${args mkString " "})" + p.destroy + throw t + } + finally pl.close() + } + (pl buffer run) == 0 } private def execTest(outDir: File, logFile: File): Boolean = { @@ -272,11 +290,17 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te val prefix = "#partest" val margin = "> " val leader = margin + prefix - // use lines in block so labeled? Default to sure, go ahead. - def retainOn(f: String) = f match { - case "java7" => javaVersion startsWith "1.7" - case "java6" => javaVersion startsWith "1.6" - case _ => true + // use lines in block so labeled? Default to sorry, Charlie. + def retainOn(f: String) = { + val (invert, token) = + if (f startsWith "!") (true, f drop 1) else (false, f) + val cond = token match { + case "java7" => javaVersion startsWith "1.7" + case "java6" => javaVersion startsWith "1.6" + case "true" => true + case _ => false + } + if (invert) !cond else cond } if (d contains prefix) { val sb = new StringBuilder @@ -314,23 +338,62 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te catch { case t: Exception => None } } - /** This does something about absolute paths and file separator - * chars before diffing. + /** Normalize the log output by applying test-specific filters + * and fixing filesystem-specific paths. + * + * Line filters are picked up from `filter: pattern` at the top of sources. + * The filtered line is detected with a simple "contains" test, + * and yes, "filter" means "filter out" in this context. + * + * File paths are detected using the absolute path of the test root. + * A string that looks like a file path is normalized by replacing + * the leading segments (the root) with "$ROOT" and by replacing + * any Windows backslashes with the one true file separator char. */ def normalizeLog() { - // squashing // in paths also munges line comments, so save this innovation for another time. - // (There are line comments in the "stub implementations" error output.) - //val slashes = """[/\\]+""".r - //def squashSlashes(s: String) = slashes replaceAllIn (s, "/") - def squashSlashes(s: String) = s replace ('\\', '/') - val base = squashSlashes(parentFile.getAbsolutePath + File.separator) - val quoted = """\Q%s\E""" format base - val baseless = (if (isWin) "(?i)" + quoted else quoted).r - def canonicalize(s: String) = baseless replaceAllIn (squashSlashes(s), "") - logFile mapInPlace canonicalize + // Apply judiciously; there are line comments in the "stub implementations" error output. + val slashes = """[/\\]+""".r + def squashSlashes(s: String) = slashes replaceAllIn (s, "/") + + // this string identifies a path and is also snipped from log output. + // to preserve more of the path, could use fileManager.testRootPath + val elided = parentFile.getAbsolutePath + + // something to mark the elision in the log file (disabled) + val ellipsis = "" //".../" // using * looks like a comment + + // no spaces in test file paths below root, because otherwise how to detect end of path string? + val pathFinder = raw"""(?i)\Q${elided}${File.separator}\E([\${File.separator}\w]*)""".r + def canonicalize(s: String): String = ( + pathFinder replaceAllIn (s, m => ellipsis + squashSlashes(m group 1)) + ) + + def masters = { + val files = List(new File(parentFile, "filters"), new File(PathSettings.srcDir.path, "filters")) + files filter (_.exists) flatMap (_.fileLines) map (_.trim) filter (s => !(s startsWith "#")) + } + val filters = toolArgs("filter", split = false) ++ masters + val elisions = ListBuffer[String]() + //def lineFilter(s: String): Boolean = !(filters exists (s contains _)) + def lineFilter(s: String): Boolean = ( + filters map (_.r) forall { r => + val res = (r findFirstIn s).isEmpty + if (!res) elisions += s + res + } + ) + + logFile.mapInPlace(canonicalize)(lineFilter) + if (isPartestVerbose && elisions.nonEmpty) { + import NestUI.color._ + val emdash = bold(yellow("--")) + pushTranscript(s"filtering ${logFile.getName}$EOL${elisions mkString (emdash, EOL + emdash, EOL)}") + } } def diffIsOk: Boolean = { + // always normalize the log first + normalizeLog() val diff = currentDiff // if diff is not empty, is update needed? val updating: Option[Boolean] = ( @@ -372,16 +435,21 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te } /** Grouped files in group order, and lex order within each group. */ - def groupedFiles(files: List[File]): List[List[File]] = ( - if (files.tail.nonEmpty) { - val grouped = files filter (_.isJavaOrScala) groupBy (_.group) + def groupedFiles(sources: List[File]): List[List[File]] = ( + if (sources.tail.nonEmpty) { + val grouped = sources groupBy (_.group) grouped.keys.toList.sorted map (k => grouped(k) sortBy (_.getName)) } - else List(files) + else List(sources) ) /** Source files for the given test file. */ - def sources(file: File): List[File] = if (file.isDirectory) file.listFiles.toList else List(file) + def sources(file: File): List[File] = ( + if (file.isDirectory) + file.listFiles.toList filter (_.isJavaOrScala) + else + List(file) + ) def newCompiler = new DirectCompiler(fileManager) @@ -403,6 +471,23 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te perTest ++ perGroup } + def toolArgs(tool: String, split: Boolean = true): List[String] = { + def argsplitter(s: String) = if (split) words(s) filter (_.nonEmpty) else List(s) + def argsFor(f: File): List[String] = { + import scala.util.matching.Regex + val p = new Regex(s"(?:.*\\s)?${tool}:(?:\\s*)(.*)?", "args") + val max = 10 + val src = Path(f).toFile.chars(codec) + val args = try { + src.getLines take max collectFirst { + case s if (p findFirstIn s).nonEmpty => for (m <- p findFirstMatchIn s) yield m group "args" + } + } finally src.close() + args.flatten map argsplitter getOrElse Nil + } + sources(testFile) flatMap argsFor + } + abstract class CompileRound { def fs: List[File] def result: TestState @@ -455,7 +540,7 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te // or, OK, we'll let you crash the compiler with a FatalError if you supply a check file def checked(r: CompileRound) = r.result match { case Crash(_, t, _) if !checkFile.canRead || !t.isInstanceOf[FatalError] => false - case _ => normalizeLog(); diffIsOk + case _ => diffIsOk } failing map (checked) getOrElse nextTestActionFailing("expected compilation failure") @@ -529,22 +614,6 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te } val logWriter = new PrintStream(new FileOutputStream(logFile), true) - def toolArgs(tool: String): List[String] = { - def argsplitter(s: String) = words(s) filter (_.nonEmpty) - def argsFor(f: File): List[String] = { - import scala.util.matching.Regex - val p = new Regex(s"(?:.*\\s)?${tool}:(.*)?", "args") - val max = 10 - val src = Path(f).toFile.chars(codec) - val args = try { - src.getLines take max collectFirst { - case s if (p findFirstIn s).nonEmpty => for (m <- p findFirstMatchIn s) yield m group "args" - } - } finally src.close() - args.flatten map argsplitter getOrElse Nil - } - sources(testFile) flatMap argsFor - } def runInFramework(): Boolean = { import org.scalatools.testing._ val f: Framework = loader.instantiate[Framework]("org.scalacheck.ScalaCheckFramework") @@ -647,7 +716,6 @@ class Runner(val testFile: File, fileManager: FileManager, val testRunParams: Te if (!Output.withRedirected(logWriter)(try loop() finally resReader.close())) setLastState(genPass()) - normalizeLog // put errors in a normal form (diffIsOk, LogContext(logFile, swr, wr)) } diff --git a/src/partest/scala/tools/partest/package.scala b/src/partest/scala/tools/partest/package.scala index 4a516d620b..5a1afeb77f 100644 --- a/src/partest/scala/tools/partest/package.scala +++ b/src/partest/scala/tools/partest/package.scala @@ -56,8 +56,8 @@ package object partest { f.toString split """[/\\]+""" takeRight 2 mkString "/" // e.g. pos/t1234 } - def mapInPlace(mapFn: String => String): Unit = - writeAll(fileLines.map(x => mapFn(x) + "\n"): _*) + def mapInPlace(mapFn: String => String)(filterFn: String => Boolean = _ => true): Unit = + writeAll(fileLines filter filterFn map (x => mapFn(x) + EOL): _*) def appendAll(strings: String*): Unit = sf.appendAll(strings: _*) def writeAll(strings: String*): Unit = sf.writeAll(strings: _*) diff --git a/test/files/continuations-run/basics.scala b/test/files/continuations-run/basics.scala index b63710bc64..ed1782d77a 100755 --- a/test/files/continuations-run/basics.scala +++ b/test/files/continuations-run/basics.scala @@ -13,7 +13,7 @@ object Test { 2 * shift((k:Int => Int) => k(k(7))) } - def main(args: Array[String]) = { + def main(args: Array[String]) { println(reset(m0())) println(reset(m1())) diff --git a/test/files/continuations-run/function1.scala b/test/files/continuations-run/function1.scala index fbd413ed9d..ec7ebb66a5 100644 --- a/test/files/continuations-run/function1.scala +++ b/test/files/continuations-run/function1.scala @@ -5,7 +5,7 @@ import scala.util.continuations._ object Test { - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { val f = () => shift { k: (Int=>Int) => k(7) } val g: () => Int @cps[Int] = f @@ -13,4 +13,4 @@ object Test { println(reset(g())) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/function4.scala b/test/files/continuations-run/function4.scala index 2ccd0b4ff2..232b1ec3a6 100644 --- a/test/files/continuations-run/function4.scala +++ b/test/files/continuations-run/function4.scala @@ -5,11 +5,11 @@ import scala.util.continuations._ object Test { - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { val g: () => Int @cps[Int] = () => shift { k: (Int=>Int) => k(7) } println(reset(g())) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/function5.scala b/test/files/continuations-run/function5.scala index fe528e14e7..17ae08c98e 100644 --- a/test/files/continuations-run/function5.scala +++ b/test/files/continuations-run/function5.scala @@ -5,11 +5,11 @@ import scala.util.continuations._ object Test { - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { val g: () => Int @cps[Int] = () => 7 println(reset(g())) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/function6.scala b/test/files/continuations-run/function6.scala index 54a6ffcc93..6b4c5adc41 100644 --- a/test/files/continuations-run/function6.scala +++ b/test/files/continuations-run/function6.scala @@ -5,7 +5,7 @@ import scala.util.continuations._ object Test { - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { val g: PartialFunction[Int, Int @cps[Int]] = { case x => 7 } @@ -13,4 +13,4 @@ object Test { } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/ifelse0.scala b/test/files/continuations-run/ifelse0.scala index 2facab4b98..2c40f64959 100644 --- a/test/files/continuations-run/ifelse0.scala +++ b/test/files/continuations-run/ifelse0.scala @@ -10,9 +10,9 @@ object Test { else shift { k: (Int=>Int) => k(x) } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/ifelse1.scala b/test/files/continuations-run/ifelse1.scala index c624b84b75..6f52a8c1e3 100644 --- a/test/files/continuations-run/ifelse1.scala +++ b/test/files/continuations-run/ifelse1.scala @@ -15,11 +15,11 @@ object Test { else shift { k: (Int=>Int) => k(k(k(x))) } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { println(reset(1 + test1(7))) println(reset(1 + test1(8))) println(reset(1 + test2(7))) println(reset(1 + test2(8))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/ifelse2.scala b/test/files/continuations-run/ifelse2.scala index 506acc4d00..f7f8328703 100644 --- a/test/files/continuations-run/ifelse2.scala +++ b/test/files/continuations-run/ifelse2.scala @@ -8,9 +8,9 @@ object Test { def test(x:Int) = if (x <= 7) shift { k: (Unit=>Unit) => println("abort") } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { println(reset{ test(7); println("alive") }) println(reset{ test(8); println("alive") }) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/ifelse3.scala b/test/files/continuations-run/ifelse3.scala index 54566a421c..7b85770be9 100644 --- a/test/files/continuations-run/ifelse3.scala +++ b/test/files/continuations-run/ifelse3.scala @@ -13,9 +13,9 @@ object Test { x + 1 - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { println(reset(test(7))) println(reset(test(8))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/ifelse4.scala b/test/files/continuations-run/ifelse4.scala index 8360375283..a0dbcafc57 100644 --- a/test/files/continuations-run/ifelse4.scala +++ b/test/files/continuations-run/ifelse4.scala @@ -22,10 +22,10 @@ object Test { if (sh(x1)==45) x1 else sh(x1) } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { println(reset(1 + testA(7))) println(reset(1 + testB(9))) println(reset(1 + testC(9))) println(reset(1 + testD(7))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/infer1.scala b/test/files/continuations-run/infer1.scala index 10822508e7..1196bd40a8 100644 --- a/test/files/continuations-run/infer1.scala +++ b/test/files/continuations-run/infer1.scala @@ -17,7 +17,7 @@ object Test { def util() = shift { k: (String => String) => "7" } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { test { shift { k: (Int => String) => 9 } } test { shift { k: (Int => String) => 9 }; 2 } // test { shift { k: (Int => String) => 9 }; util() } <-- doesn't work @@ -30,4 +30,4 @@ object Test { } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/match0.scala b/test/files/continuations-run/match0.scala index b65d343c07..63b73bf21e 100644 --- a/test/files/continuations-run/match0.scala +++ b/test/files/continuations-run/match0.scala @@ -10,9 +10,9 @@ object Test { case 8 => shift { k: (Int=>Int) => k(x) } } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/match1.scala b/test/files/continuations-run/match1.scala index 20671f26ba..62d639ee72 100644 --- a/test/files/continuations-run/match1.scala +++ b/test/files/continuations-run/match1.scala @@ -10,9 +10,9 @@ object Test { case _ => x } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/patvirt.scala b/test/files/continuations-run/patvirt.scala index 5b4d312f20..7d769d46fe 100644 --- a/test/files/continuations-run/patvirt.scala +++ b/test/files/continuations-run/patvirt.scala @@ -25,7 +25,7 @@ object Test { o7.get } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { println(reset(1 + test(7))) println(reset(1 + test(8))) } diff --git a/test/files/continuations-run/t1820.scala b/test/files/continuations-run/t1820.scala index 893ddab6d1..7de6ccabef 100644 --- a/test/files/continuations-run/t1820.scala +++ b/test/files/continuations-run/t1820.scala @@ -10,5 +10,5 @@ object Test { if (b) shifted } } - def main(args: Array[String]) = test1(true) -}
\ No newline at end of file + def main(args: Array[String]): Unit = test1(true) +} diff --git a/test/files/continuations-run/t1821.scala b/test/files/continuations-run/t1821.scala index 0d5fb553be..55bf7b6f12 100644 --- a/test/files/continuations-run/t1821.scala +++ b/test/files/continuations-run/t1821.scala @@ -11,10 +11,10 @@ object Test { def test3[A](x: A): A @suspendable = x match { case x => x } def test4[A](x: List[A]): A @suspendable = x match { case List(x) => x } - def main(args: Array[String]) = { + def main(args: Array[String]) { println(reset(test1())) println(reset(test2(List(())))) println(reset(test3())) println(reset(test4(List(())))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/t3199b.scala b/test/files/continuations-run/t3199b.scala index 2122c963ac..fe1ecafe72 100644 --- a/test/files/continuations-run/t3199b.scala +++ b/test/files/continuations-run/t3199b.scala @@ -4,8 +4,8 @@ object Test { java.util.Arrays.asList(Array(1,2,3):_*) } - def main(args: Array[String]) = { + def main(args: Array[String]) { println(test()) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/t3223.scala b/test/files/continuations-run/t3223.scala index efed1ff581..fda61f41ea 100644 --- a/test/files/continuations-run/t3223.scala +++ b/test/files/continuations-run/t3223.scala @@ -6,7 +6,7 @@ object Test { throw new Exception shiftUnit0[Int,Int](7) } catch { - case ex => + case ex: Throwable => val g = (a:Int)=>a 9 } @@ -16,4 +16,4 @@ object Test { println(reset(foo(0))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/t3225.scala b/test/files/continuations-run/t3225.scala index 5b6259c43f..bc6d635c88 100644 --- a/test/files/continuations-run/t3225.scala +++ b/test/files/continuations-run/t3225.scala @@ -48,7 +48,7 @@ object Test { // TODO: check whether this also applies to a::shift { k => ... } - def main(args: Array[String]) = { + def main(args: Array[String]) { testMono() testPoly() } diff --git a/test/files/continuations-run/t5314.check b/test/files/continuations-run/t5314.check index 4b35d8e6d0..61f5b25dc7 100644 --- a/test/files/continuations-run/t5314.check +++ b/test/files/continuations-run/t5314.check @@ -1,3 +1,9 @@ +t5314.scala:34: warning: expression 7 is cps-transformed unexpectedly + def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) } + ^ +t5314.scala:35: warning: expression 7 is cps-transformed unexpectedly + def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) } + ^ 7 7 7 diff --git a/test/files/continuations-run/t5472.check b/test/files/continuations-run/t5472.check index d42e80c18e..3192c746eb 100644 --- a/test/files/continuations-run/t5472.check +++ b/test/files/continuations-run/t5472.check @@ -1 +1,15 @@ +t5472.scala:12: warning: expression case4(){ + if (x1.ne(null)) + matchEnd3(true) + else + case5() +} is cps-transformed unexpectedly + (location, accessors) <- new ContinuationizedParallelIterable(map) + ^ +t5472.scala:12: warning: expression matchEnd3(x: Int){ + x +} is cps-transformed unexpectedly + (location, accessors) <- new ContinuationizedParallelIterable(map) + ^ +warning: there were 1 deprecation warning(s); re-run with -deprecation for details List(23, 23) diff --git a/test/files/continuations-run/t5472.scala b/test/files/continuations-run/t5472.scala index 3e3c76b32a..060d267544 100644 --- a/test/files/continuations-run/t5472.scala +++ b/test/files/continuations-run/t5472.scala @@ -2,6 +2,7 @@ import scala.annotation._ import scala.util.continuations._ import java.util.concurrent.atomic._ +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]) { val map = Map("foo" -> 1, "bar" -> 2) @@ -15,7 +16,6 @@ object Test { println(mapped.toList) } } -} final class ContinuationizedParallelIterable[+A](protected val underline: Iterable[A]) { def toList = underline.toList.sortBy(_.toString) @@ -76,7 +76,7 @@ final class ContinuationizedParallelIterable[+A](protected val underline: Iterab new AtomicInteger(underline.size) with ((ContinuationizedParallelIterable[B] => Unit) => Unit) { override final def apply(continue: ContinuationizedParallelIterable[B] => Unit) { val results = new Array[B](super.get) - for ((element, i) <- underline.view zipWithIndex) { + for ((element, i) <- underline.view.zipWithIndex) { reset { val result = f(element) results(i) = result @@ -88,3 +88,4 @@ final class ContinuationizedParallelIterable[+A](protected val underline: Iterab } }) } +} diff --git a/test/files/continuations-run/t5506.scala b/test/files/continuations-run/t5506.scala index 2b5c1118f7..4b3703c725 100644 --- a/test/files/continuations-run/t5506.scala +++ b/test/files/continuations-run/t5506.scala @@ -42,7 +42,7 @@ z } -def main(args: Array[String]) = { +def main(args: Array[String]) { reset { println(fp10) println(fp11) diff --git a/test/files/continuations-run/t5538.check b/test/files/continuations-run/t5538.check index 457721d5e0..d9d873663d 100644 --- a/test/files/continuations-run/t5538.check +++ b/test/files/continuations-run/t5538.check @@ -1 +1,2 @@ +warning: there were 1 feature warning(s); re-run with -feature for details Future(Future(Future(Future(Future(List(1, 2, 3, 4, 5)))))) diff --git a/test/files/continuations-run/t5538.scala b/test/files/continuations-run/t5538.scala index 42f8163caf..6713cecf2f 100644 --- a/test/files/continuations-run/t5538.scala +++ b/test/files/continuations-run/t5538.scala @@ -1,6 +1,8 @@ import scala.util.continuations._ import scala.collection.generic.CanBuildFrom +import scala.language.{ implicitConversions } + object Test { class ExecutionContext @@ -43,8 +45,8 @@ object Test { } - def main(args: Array[String]) = { + def main(args: Array[String]) { val p = new PromiseStream[Int] println(Future.flow(p << (Future(1), Future(2), Future(3), Future(4), Future(5)))) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/trycatch0.scala b/test/files/continuations-run/trycatch0.scala index ec39863f3f..feb7f7182b 100644 --- a/test/files/continuations-run/trycatch0.scala +++ b/test/files/continuations-run/trycatch0.scala @@ -7,14 +7,14 @@ object Test { def foo = try { shift((k: Int=>Int) => k(7)) } catch { - case ex => + case ex: Throwable => 9 } def bar = try { 7 } catch { - case ex => + case ex: Throwable => shiftUnit0[Int,Int](9) } @@ -22,4 +22,4 @@ object Test { println(reset { foo + 3 }) println(reset { bar + 3 }) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/trycatch1.check b/test/files/continuations-run/trycatch1.check index a028d2b1e1..061ecdcd54 100644 --- a/test/files/continuations-run/trycatch1.check +++ b/test/files/continuations-run/trycatch1.check @@ -1,4 +1,10 @@ +trycatch1.scala:34: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 7 + ^ +trycatch1.scala:18: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + shift((k: Int=>Int) => k(7)) + ^ +12 12 12 12 -12
\ No newline at end of file diff --git a/test/files/continuations-run/trycatch1.scala b/test/files/continuations-run/trycatch1.scala index 10dfd30bb2..b00a87d059 100644 --- a/test/files/continuations-run/trycatch1.scala +++ b/test/files/continuations-run/trycatch1.scala @@ -10,7 +10,7 @@ object Test { fatal shift((k: Int=>Int) => k(7)) } catch { - case ex => + case ex: Throwable => 9 } @@ -18,7 +18,7 @@ object Test { shift((k: Int=>Int) => k(7)) fatal } catch { - case ex => + case ex: Throwable => 9 } @@ -26,7 +26,7 @@ object Test { fatal 7 } catch { - case ex => + case ex: Throwable => shiftUnit0[Int,Int](9) // regular shift causes no-symbol doesn't have owner } @@ -34,7 +34,7 @@ object Test { 7 fatal } catch { - case ex => + case ex: Throwable => shiftUnit0[Int,Int](9) // regular shift causes no-symbol doesn't have owner } @@ -45,4 +45,4 @@ object Test { println(reset { bar2 + 3 }) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/while0.scala b/test/files/continuations-run/while0.scala index 46005a4a77..542408fb24 100644 --- a/test/files/continuations-run/while0.scala +++ b/test/files/continuations-run/while0.scala @@ -15,8 +15,8 @@ object Test { println(x) } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { reset(test()) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/while1.scala b/test/files/continuations-run/while1.scala index fd41ab36ee..351d52c27a 100644 --- a/test/files/continuations-run/while1.scala +++ b/test/files/continuations-run/while1.scala @@ -15,8 +15,8 @@ object Test { println(x) } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { reset(test()) } -}
\ No newline at end of file +} diff --git a/test/files/continuations-run/while2.scala b/test/files/continuations-run/while2.scala index 63f9cb99fe..f4991dea61 100644 --- a/test/files/continuations-run/while2.scala +++ b/test/files/continuations-run/while2.scala @@ -16,8 +16,8 @@ object Test { println(x) } - def main(args: Array[String]): Any = { + def main(args: Array[String]): Unit = { reset(test()) } -}
\ No newline at end of file +} diff --git a/test/files/filters b/test/files/filters new file mode 100644 index 0000000000..9a9b439784 --- /dev/null +++ b/test/files/filters @@ -0,0 +1,3 @@ +# +#Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28). +Java HotSpot\(TM\) .* warning: diff --git a/test/files/jvm/actor-exceptions.scala b/test/files/jvm/actor-exceptions.scala index 3ee4db9ed2..bdd983a0e8 100644 --- a/test/files/jvm/actor-exceptions.scala +++ b/test/files/jvm/actor-exceptions.scala @@ -1,4 +1,7 @@ + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.{Actor, Exit} import Actor._ @@ -58,7 +61,6 @@ object Slave extends Actor { case object A -object Test { def main(args: Array[String]) { Master.start() } diff --git a/test/files/jvm/actor-executor.scala b/test/files/jvm/actor-executor.scala index b1f9caebdd..0fc28b4d85 100644 --- a/test/files/jvm/actor-executor.scala +++ b/test/files/jvm/actor-executor.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import java.util.concurrent.Executors import scala.actors.{Actor, SchedulerAdapter} import Actor._ @@ -50,7 +54,6 @@ object Two extends AdaptedActor { } } -object Test { val executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()) diff --git a/test/files/jvm/actor-executor2.scala b/test/files/jvm/actor-executor2.scala index f8fcaef69f..5badf2ae7e 100644 --- a/test/files/jvm/actor-executor2.scala +++ b/test/files/jvm/actor-executor2.scala @@ -1,3 +1,8 @@ + + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.{Actor, SchedulerAdapter, Exit} import Actor._ import java.util.concurrent.{Executors, RejectedExecutionException} @@ -48,7 +53,6 @@ trait AdaptedActor extends Actor { Test.scheduler } -object Test { val NUM_MSG = 100000 val executor = diff --git a/test/files/jvm/actor-executor3.scala b/test/files/jvm/actor-executor3.scala index 4fde2c6c5f..f8b57d84b3 100644 --- a/test/files/jvm/actor-executor3.scala +++ b/test/files/jvm/actor-executor3.scala @@ -1,3 +1,8 @@ + + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.Actor import scala.actors.scheduler.ExecutorScheduler import java.util.concurrent.Executors @@ -48,7 +53,6 @@ trait AdaptedActor extends Actor { Test.scheduler } -object Test { val NUM_MSG = 100000 val executor = diff --git a/test/files/jvm/actor-getstate.scala b/test/files/jvm/actor-getstate.scala index a6e15a8721..425efbe5e6 100644 --- a/test/files/jvm/actor-getstate.scala +++ b/test/files/jvm/actor-getstate.scala @@ -1,7 +1,9 @@ -import scala.actors.{Reactor, Actor, TIMEOUT} -import Actor._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.{Reactor, Actor, TIMEOUT} + import Actor._ def assert(cond: => Boolean, hint: String) { if (!cond) diff --git a/test/files/jvm/actor-link-getstate.scala b/test/files/jvm/actor-link-getstate.scala index c24daf2eff..d8b8ada1e6 100644 --- a/test/files/jvm/actor-link-getstate.scala +++ b/test/files/jvm/actor-link-getstate.scala @@ -1,5 +1,9 @@ -import scala.actors.{Actor, Exit} -import scala.actors.Actor._ + + +@deprecated("Suppress warnings", since="2.11") +object Test { + import scala.actors.{Actor, Exit} + import scala.actors.Actor._ case class MyException(text: String) extends Exception(text) { override def fillInStackTrace() = this @@ -39,7 +43,6 @@ object Master extends Actor { } } -object Test { def main(args: Array[String]) { actor { diff --git a/test/files/jvm/actor-looping.scala b/test/files/jvm/actor-looping.scala index 475d4754ce..7bc6f1e5c5 100644 --- a/test/files/jvm/actor-looping.scala +++ b/test/files/jvm/actor-looping.scala @@ -1,7 +1,8 @@ -import scala.actors.Actor._ +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Actor._ case object A def main(args: Array[String]) { diff --git a/test/files/jvm/actor-normal-exit.scala b/test/files/jvm/actor-normal-exit.scala index 20863d5bb0..90495866e2 100644 --- a/test/files/jvm/actor-normal-exit.scala +++ b/test/files/jvm/actor-normal-exit.scala @@ -1,7 +1,9 @@ -import scala.actors.{Actor, Exit} + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.{Actor, Exit} object Master extends Actor { trapExit = true def act() { diff --git a/test/files/jvm/actor-receivewithin.scala b/test/files/jvm/actor-receivewithin.scala index a5c87c2722..5982462502 100644 --- a/test/files/jvm/actor-receivewithin.scala +++ b/test/files/jvm/actor-receivewithin.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.{Actor, TIMEOUT} object A extends Actor { @@ -62,7 +66,6 @@ object B extends Actor { } } -object Test { def main(args:Array[String]) { B.start() } diff --git a/test/files/jvm/actor-sync-send-timeout.scala b/test/files/jvm/actor-sync-send-timeout.scala index 21e624bd0a..42e0be4a8c 100644 --- a/test/files/jvm/actor-sync-send-timeout.scala +++ b/test/files/jvm/actor-sync-send-timeout.scala @@ -1,8 +1,9 @@ +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.Actor /* This test is a regression test for SI-4759. */ -object Test { val Runs = 5 def main(args: Array[String]) = { @@ -14,7 +15,6 @@ object Test { } //println("done sending to A1") } -} object A2 extends Actor { this.start() @@ -45,3 +45,4 @@ object A1 extends Actor { } } } +} diff --git a/test/files/jvm/actor-termination.scala b/test/files/jvm/actor-termination.scala index d8e44a2797..4a6bf92d48 100644 --- a/test/files/jvm/actor-termination.scala +++ b/test/files/jvm/actor-termination.scala @@ -1,8 +1,9 @@ -import scala.actors.Actor /* Test that an actor that hasn't finished prevents termination */ +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Actor def main(args: Array[String]) { Actor.actor { try { diff --git a/test/files/jvm/actor-uncaught-exception.scala b/test/files/jvm/actor-uncaught-exception.scala index 5ae66de640..5285b7519f 100644 --- a/test/files/jvm/actor-uncaught-exception.scala +++ b/test/files/jvm/actor-uncaught-exception.scala @@ -1,10 +1,11 @@ +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.{Actor, Exit} class MyException(msg: String) extends Exception(msg) { override def fillInStackTrace() = this } -object Test { case object StartError extends Actor { def act() { diff --git a/test/files/jvm/actor-uncaught-exception2.check b/test/files/jvm/actor-uncaught-exception2.check index 870a5d32f9..a54f374aed 100644 --- a/test/files/jvm/actor-uncaught-exception2.check +++ b/test/files/jvm/actor-uncaught-exception2.check @@ -1,2 +1,2 @@ -UncaughtException(StartError,None,None,MyException: I don't want to run!) -UncaughtException(MessageError,Some('ping),Some(Supervisor),MyException: No message for me!) +UncaughtException(StartError,None,None,Test$MyException: I don't want to run!) +UncaughtException(MessageError,Some('ping),Some(Supervisor),Test$MyException: No message for me!) diff --git a/test/files/jvm/actor-uncaught-exception2.scala b/test/files/jvm/actor-uncaught-exception2.scala index 0364cbeb03..f56217c187 100644 --- a/test/files/jvm/actor-uncaught-exception2.scala +++ b/test/files/jvm/actor-uncaught-exception2.scala @@ -1,11 +1,11 @@ +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.{Actor, Exit, Debug} class MyException(msg: String) extends Exception(msg) { override def fillInStackTrace() = this } -object Test { - case object StartError extends Actor { def act() { try { diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala index 77a45fae89..c42eceef4c 100644 --- a/test/files/jvm/annotations.scala +++ b/test/files/jvm/annotations.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, reflectiveCalls } + object Test1 { class Foo { @remote diff --git a/test/files/jvm/daemon-actor-termination.scala b/test/files/jvm/daemon-actor-termination.scala index 6ddfc3139d..40acd8583e 100644 --- a/test/files/jvm/daemon-actor-termination.scala +++ b/test/files/jvm/daemon-actor-termination.scala @@ -1,8 +1,10 @@ -import scala.actors.{Actor, DaemonActor} /* Test that a daemon Actor that hasn't finished does not prevent termination */ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.{Actor, DaemonActor} class MyDaemon extends DaemonActor { def act() { try { diff --git a/test/files/jvm/deprecation.check b/test/files/jvm/deprecation.check new file mode 100644 index 0000000000..e263e4909d --- /dev/null +++ b/test/files/jvm/deprecation.check @@ -0,0 +1,3 @@ +warning: there were 5 deprecation warning(s); re-run with -deprecation for details +Note: deprecation/Use_2.java uses or overrides a deprecated API. +Note: Recompile with -Xlint:deprecation for details. diff --git a/test/files/jvm/duration-tck.scala b/test/files/jvm/duration-tck.scala index b2573448c7..3bc8a2c100 100644 --- a/test/files/jvm/duration-tck.scala +++ b/test/files/jvm/duration-tck.scala @@ -6,6 +6,8 @@ import scala.concurrent.duration._ import scala.reflect._ import scala.tools.partest.TestUtil.intercept +import scala.language.{ postfixOps } + object Test extends App { implicit class Assert(val left: Any) extends AnyVal { diff --git a/test/files/jvm/future-alarm.scala b/test/files/jvm/future-alarm.scala index 8ee902b5ea..3e71fa681c 100644 --- a/test/files/jvm/future-alarm.scala +++ b/test/files/jvm/future-alarm.scala @@ -1,6 +1,8 @@ -import scala.actors.Futures + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Futures def main(args: Array[String]) { try { for (i <- 1 to 100000) { diff --git a/test/files/jvm/future-awaitall-zero.scala b/test/files/jvm/future-awaitall-zero.scala index cd6ba172cc..56f4bab16f 100644 --- a/test/files/jvm/future-awaitall-zero.scala +++ b/test/files/jvm/future-awaitall-zero.scala @@ -1,7 +1,9 @@ -import scala.actors.Futures._ -import scala.actors.Actor._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Futures._ + import scala.actors.Actor._ def main(args: Array[String]) { try { val ft1 = future { reactWithin(10000) { diff --git a/test/files/jvm/future-spec/main.scala b/test/files/jvm/future-spec/main.scala index 90048ccda0..e000431dda 100644 --- a/test/files/jvm/future-spec/main.scala +++ b/test/files/jvm/future-spec/main.scala @@ -17,6 +17,12 @@ object Test { } +trait Features { + implicit def implicitously = scala.language.implicitConversions + implicit def reflectively = scala.language.reflectiveCalls + implicit def postulously = scala.language.postfixOps +} + trait Output { val buffer = new StringBuilder @@ -27,7 +33,7 @@ trait Output { } -trait MinimalScalaTest extends Output { +trait MinimalScalaTest extends Output with Features { val throwables = mutable.ArrayBuffer[Throwable]() @@ -70,7 +76,7 @@ trait MinimalScalaTest extends Output { throw new Exception("Exception of type %s was not thrown".format(manifest[T])) } catch { case t: Throwable => - if (manifest[T].erasure != t.getClass) throw t + if (manifest[T].runtimeClass != t.getClass) throw t else t.asInstanceOf[T] } } diff --git a/test/files/jvm/future-termination.scala b/test/files/jvm/future-termination.scala index f51642cb7a..668b3f74ba 100644 --- a/test/files/jvm/future-termination.scala +++ b/test/files/jvm/future-termination.scala @@ -1,8 +1,10 @@ -import scala.actors.Futures /* Test that unevaluated futures do not prevent program termination */ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Futures def main(args: Array[String]) { try { val meaningOfLife = Futures.future { diff --git a/test/files/jvm/reactor-exceptionOnSend.scala b/test/files/jvm/reactor-exceptionOnSend.scala index 3d9a042131..6d79fc9d13 100644 --- a/test/files/jvm/reactor-exceptionOnSend.scala +++ b/test/files/jvm/reactor-exceptionOnSend.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.Reactor import scala.actors.Actor._ @@ -48,7 +52,6 @@ object B extends Reactor[Any] { } } -object Test { def main(args: Array[String]) { B.start() } diff --git a/test/files/jvm/reactor-producer-consumer.scala b/test/files/jvm/reactor-producer-consumer.scala index 8a6b17c3ad..ec34febe01 100644 --- a/test/files/jvm/reactor-producer-consumer.scala +++ b/test/files/jvm/reactor-producer-consumer.scala @@ -1,6 +1,8 @@ -import scala.actors.Reactor + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Reactor case class Stop() case class Get(from: Reactor[Any]) case class Put(x: Int) diff --git a/test/files/jvm/reactor.scala b/test/files/jvm/reactor.scala index dbc9a6bdda..91ded27f07 100644 --- a/test/files/jvm/reactor.scala +++ b/test/files/jvm/reactor.scala @@ -1,3 +1,11 @@ +/** + * Ping pong example for Reactor. + * + * @author Philipp Haller + */ + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.Reactor @@ -5,19 +13,12 @@ case class Ping(from: Reactor[Any]) case object Pong case object Stop -/** - * Ping pong example for Reactor. - * - * @author Philipp Haller - */ -object Test { def main(args: Array[String]) { val pong = new PongActor val ping = new PingActor(100000, pong) ping.start pong.start } -} class PingActor(count: Int, pong: Reactor[Any]) extends Reactor[Any] { def act() { @@ -68,3 +69,4 @@ class PongActor extends Reactor[Any] { } } } +} diff --git a/test/files/jvm/replyablereactor.scala b/test/files/jvm/replyablereactor.scala index e1fabc98da..4c4e13d9ab 100644 --- a/test/files/jvm/replyablereactor.scala +++ b/test/files/jvm/replyablereactor.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.ReplyReactor class MyActor extends ReplyReactor { @@ -18,7 +22,6 @@ class MyActor extends ReplyReactor { } } -object Test { def main(args: Array[String]) { val a = new MyActor a.start() diff --git a/test/files/jvm/replyablereactor2.scala b/test/files/jvm/replyablereactor2.scala index da9e0e269e..21f33cce56 100644 --- a/test/files/jvm/replyablereactor2.scala +++ b/test/files/jvm/replyablereactor2.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors._ import scala.actors.Actor._ @@ -19,7 +23,6 @@ class MyActor extends ReplyReactor { } } -object Test { def main(args: Array[String]) { val a = new MyActor a.start() diff --git a/test/files/jvm/replyablereactor3.scala b/test/files/jvm/replyablereactor3.scala index 2c26b8a176..5810ed053f 100644 --- a/test/files/jvm/replyablereactor3.scala +++ b/test/files/jvm/replyablereactor3.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors._ import scala.actors.Actor._ @@ -19,7 +23,6 @@ class MyActor extends ReplyReactor { } } -object Test { def main(args: Array[String]) { val a = new MyActor a.start() diff --git a/test/files/jvm/replyablereactor4.scala b/test/files/jvm/replyablereactor4.scala index 8776cf63f0..95d63684dd 100644 --- a/test/files/jvm/replyablereactor4.scala +++ b/test/files/jvm/replyablereactor4.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors._ import scala.actors.Actor._ @@ -19,7 +23,6 @@ class MyActor extends ReplyReactor { } } -object Test { def main(args: Array[String]) { val a = new MyActor a.start() diff --git a/test/files/jvm/replyreactor-react-sender.scala b/test/files/jvm/replyreactor-react-sender.scala index c9884295f6..fdcea09035 100644 --- a/test/files/jvm/replyreactor-react-sender.scala +++ b/test/files/jvm/replyreactor-react-sender.scala @@ -1,7 +1,9 @@ -import scala.actors.ReplyReactor -import scala.actors.Actor._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.ReplyReactor + import scala.actors.Actor._ val NUM = 2000 diff --git a/test/files/jvm/replyreactor.scala b/test/files/jvm/replyreactor.scala index 0cecf29ec7..7512fb0eb2 100644 --- a/test/files/jvm/replyreactor.scala +++ b/test/files/jvm/replyreactor.scala @@ -1,6 +1,8 @@ -import scala.actors.ReplyReactor + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.ReplyReactor def main(args: Array[String]) { val a = new ReplyReactor { def act() { diff --git a/test/files/jvm/scala-concurrent-tck.check b/test/files/jvm/scala-concurrent-tck.check new file mode 100644 index 0000000000..18fc456acb --- /dev/null +++ b/test/files/jvm/scala-concurrent-tck.check @@ -0,0 +1,3 @@ +scala-concurrent-tck.scala:429: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f + ^ diff --git a/test/files/jvm/scala-concurrent-tck.scala b/test/files/jvm/scala-concurrent-tck.scala index b2b4183564..438ee310e6 100644 --- a/test/files/jvm/scala-concurrent-tck.scala +++ b/test/files/jvm/scala-concurrent-tck.scala @@ -728,7 +728,7 @@ trait Blocking extends TestBase { Await.result(f, Duration(500, "ms")) assert(false) } catch { - case t => + case t: Throwable => assert(t == cause) done() } diff --git a/test/files/jvm/scheduler-adapter.scala b/test/files/jvm/scheduler-adapter.scala index d6a8a446a0..1c9cfe7019 100644 --- a/test/files/jvm/scheduler-adapter.scala +++ b/test/files/jvm/scheduler-adapter.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.{Actor, SchedulerAdapter} trait AdaptedActor extends Actor { @@ -36,7 +40,6 @@ object Two extends AdaptedActor { } } -object Test { val adapted = new SchedulerAdapter { def execute(block: => Unit) { diff --git a/test/files/jvm/serialization.scala b/test/files/jvm/serialization.scala index f2c47aad77..a64b7115fa 100644 --- a/test/files/jvm/serialization.scala +++ b/test/files/jvm/serialization.scala @@ -281,6 +281,7 @@ object Test2_immutable { //############################################################################ // Test classes in package "scala.collection.mutable" +@deprecated("Suppress warnings", since="2.11") object Test3_mutable { import scala.reflect.ClassManifest import scala.collection.mutable.{ @@ -593,6 +594,7 @@ object Test8 { //############################################################################ // Test code +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]) { Test1_scala @@ -678,7 +680,7 @@ object Test10_util { import scala.util.Random def rep[A](n: Int)(f: => A) { if (n > 0) { f; rep(n-1)(f) } } - try { + { val random = new Random(345) val random2: Random = read(write(random)) rep(5) { assert(random.nextInt == random2.nextInt) } diff --git a/test/files/jvm/stringbuilder.scala b/test/files/jvm/stringbuilder.scala index 54951d657b..1fbf61aeab 100644 --- a/test/files/jvm/stringbuilder.scala +++ b/test/files/jvm/stringbuilder.scala @@ -2,6 +2,7 @@ * * @author Stephane Micheloud */ +import scala.language.{ postfixOps } object Test { def main(args: Array[String]) { Test1.run() //ctor, reverse diff --git a/test/files/jvm/t1449.scala b/test/files/jvm/t1449.scala index 3822cf7dd5..7917d6f6d5 100644 --- a/test/files/jvm/t1449.scala +++ b/test/files/jvm/t1449.scala @@ -1,7 +1,10 @@ -import scala.actors.Actor._ -import scala.actors.Future -import scala.actors.Futures._ + + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Actor._ + import scala.actors.Future + import scala.actors.Futures._ def main(args: Array[String]) { val a = actor { try { diff --git a/test/files/jvm/t1948.scala b/test/files/jvm/t1948.scala index 084c956398..95777b8037 100644 --- a/test/files/jvm/t1948.scala +++ b/test/files/jvm/t1948.scala @@ -1,7 +1,9 @@ -import scala.actors._ -import scala.actors.Actor._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors._ + import scala.actors.Actor._ def main (args: Array[String]) { val actors = (1 to 1000).toList map { x => actor { diff --git a/test/files/jvm/t2163/t2163.scala b/test/files/jvm/t2163/t2163.scala index f73b520cbe..fdf19c4e25 100644 --- a/test/files/jvm/t2163/t2163.scala +++ b/test/files/jvm/t2163/t2163.scala @@ -1,5 +1,10 @@ + +import scala.language.{ higherKinds } + class T2163Scala[CC[X]](x: CC[Int]) { def bar[DD[X]](meh: DD[Int]): CC[Int] = x } -object Test extends App {} +object Test extends App { + new t2163().test() +} diff --git a/test/files/jvm/t2359.scala b/test/files/jvm/t2359.scala index 69c69d7b3b..76b78d44f7 100644 --- a/test/files/jvm/t2359.scala +++ b/test/files/jvm/t2359.scala @@ -1,6 +1,8 @@ -import scala.actors.Futures._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Futures._ def main(args: Array[String]) { val x = future { try { diff --git a/test/files/jvm/t2530.scala b/test/files/jvm/t2530.scala index c2925a92d1..b41661e623 100644 --- a/test/files/jvm/t2530.scala +++ b/test/files/jvm/t2530.scala @@ -1,6 +1,8 @@ -import scala.actors.{Future, Futures} + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.{Future, Futures} def main(args:Array[String]) : Unit = { //scala.actors.Debug.level = 3 @@ -29,7 +31,6 @@ object Test { } println("Test done with no deadlock. Try again, it will not occur...") } -} case class Matrix(numRows: Int, numCols: Int, values: Array[Double]) { @@ -94,3 +95,4 @@ case class Matrix(numRows: Int, numCols: Int, values: Array[Double]) { } } +} diff --git a/test/files/jvm/t3102.scala b/test/files/jvm/t3102.scala index fbcf2e60e6..d0e0704859 100644 --- a/test/files/jvm/t3102.scala +++ b/test/files/jvm/t3102.scala @@ -1,7 +1,10 @@ -import scala.actors.{Actor, TIMEOUT} -import Actor._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.{Actor, TIMEOUT} + import Actor._ + def main(args: Array[String]) { val a = actor { try { diff --git a/test/files/jvm/t3356.scala b/test/files/jvm/t3356.scala index a9e83fe503..53bfd737cd 100644 --- a/test/files/jvm/t3356.scala +++ b/test/files/jvm/t3356.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.{Actor, Exit, !, UncaughtException} import Actor._ @@ -10,7 +14,6 @@ case class ImageInfo(text: String) { case class ImageData(text: String) case class Download(info: ImageInfo) -object Test { def scanForImageInfo(url: String): List[ImageInfo] = List(ImageInfo("A"), ImageInfo("B")) diff --git a/test/files/jvm/t3365.scala b/test/files/jvm/t3365.scala index b94e804e63..8321428093 100644 --- a/test/files/jvm/t3365.scala +++ b/test/files/jvm/t3365.scala @@ -1,3 +1,7 @@ + + +@deprecated("Suppress warnings", since="2.11") +object Test { import scala.actors.{ReplyReactor, Channel, Actor, Future} case class ChannelMsg(chan: Channel[Any]) @@ -27,7 +31,6 @@ class MyActor extends Actor { } } -object Test { def main(args: Array[String]) { val a = new MyActor a.start() diff --git a/test/files/jvm/t3407.scala b/test/files/jvm/t3407.scala index 6c2ce85c71..757fa3a438 100644 --- a/test/files/jvm/t3407.scala +++ b/test/files/jvm/t3407.scala @@ -1,6 +1,8 @@ -import scala.actors._, scala.actors.Actor._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors._, scala.actors.Actor._ def main(args: Array[String]) { for (i <- 1 to 10) { diff --git a/test/files/jvm/t3412-channel.scala b/test/files/jvm/t3412-channel.scala index fcc439b488..af319d2303 100644 --- a/test/files/jvm/t3412-channel.scala +++ b/test/files/jvm/t3412-channel.scala @@ -1,6 +1,8 @@ -import scala.actors._, scala.actors.Actor._, scala.actors.Futures._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors._, scala.actors.Actor._, scala.actors.Futures._ def main(args: Array[String]) { diff --git a/test/files/jvm/t3412.scala b/test/files/jvm/t3412.scala index ced15ab5dc..fde6c04cb7 100644 --- a/test/files/jvm/t3412.scala +++ b/test/files/jvm/t3412.scala @@ -1,6 +1,8 @@ -import scala.actors._, scala.actors.Actor._, scala.actors.Futures._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors._, scala.actors.Actor._, scala.actors.Futures._ def main(args: Array[String]) { diff --git a/test/files/jvm/t3470.scala b/test/files/jvm/t3470.scala index 5e4242cdd7..bcb1d4f8de 100644 --- a/test/files/jvm/t3470.scala +++ b/test/files/jvm/t3470.scala @@ -1,6 +1,8 @@ -import scala.actors._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors._ def expectActorState(a: Reactor[T] forSome { type T }, s: Actor.State.Value) { var done = false diff --git a/test/files/jvm/t3838.scala b/test/files/jvm/t3838.scala index ba8f15fc31..a1a71d1049 100644 --- a/test/files/jvm/t3838.scala +++ b/test/files/jvm/t3838.scala @@ -1,6 +1,8 @@ -import scala.actors.Actor._ + +@deprecated("Suppress warnings", since="2.11") object Test { + import scala.actors.Actor._ def main(args: Array[String]) { actor { try { diff --git a/test/files/jvm/t560bis.scala b/test/files/jvm/t560bis.scala index b04303c8a0..21eb8dde28 100644 --- a/test/files/jvm/t560bis.scala +++ b/test/files/jvm/t560bis.scala @@ -6,7 +6,7 @@ import scala.xml._; case _ => Console.println("bah") } def foo(args: List[String]) = - Elem(null,"bla",Null, TopScope, (args map {x => Text(x)}):_*) match { + Elem(null,"bla",Null, TopScope, minimizeEmpty = true, (args map {x => Text(x)}):_*) match { case Elem(_,_,_,_,Text("1"),_*) => Console.println("cool!") case _ => diff --git a/test/files/jvm/t6941/Analyzed_1.flags b/test/files/jvm/t6941/Analyzed_1.flags new file mode 100644 index 0000000000..ad51758c39 --- /dev/null +++ b/test/files/jvm/t6941/Analyzed_1.flags @@ -0,0 +1 @@ +-nowarn diff --git a/test/files/jvm/t7006.check b/test/files/jvm/t7006.check new file mode 100644 index 0000000000..7c99eba30c --- /dev/null +++ b/test/files/jvm/t7006.check @@ -0,0 +1,28 @@ +[running phase parser on Foo_1.scala] +[running phase namer on Foo_1.scala] +[running phase packageobjects on Foo_1.scala] +[running phase typer on Foo_1.scala] +[running phase patmat on Foo_1.scala] +[running phase superaccessors on Foo_1.scala] +[running phase extmethods on Foo_1.scala] +[running phase pickler on Foo_1.scala] +[running phase refchecks on Foo_1.scala] +[running phase uncurry on Foo_1.scala] +[running phase tailcalls on Foo_1.scala] +[running phase specialize on Foo_1.scala] +[running phase explicitouter on Foo_1.scala] +[running phase erasure on Foo_1.scala] +[running phase posterasure on Foo_1.scala] +[running phase lazyvals on Foo_1.scala] +[running phase lambdalift on Foo_1.scala] +[running phase constructors on Foo_1.scala] +[running phase flatten on Foo_1.scala] +[running phase mixin on Foo_1.scala] +[running phase cleanup on Foo_1.scala] +[running phase icode on Foo_1.scala] +[running phase inliner on Foo_1.scala] +[running phase inlinehandlers on Foo_1.scala] +[running phase closelim on Foo_1.scala] +[running phase constopt on Foo_1.scala] +[running phase dce on Foo_1.scala] +[running phase jvm on icode] diff --git a/test/files/jvm/t7146.scala b/test/files/jvm/t7146.scala index 2bd03d6d02..aaa3dc7ca4 100644 --- a/test/files/jvm/t7146.scala +++ b/test/files/jvm/t7146.scala @@ -1,3 +1,5 @@ + +import scala.language.{ reflectiveCalls } import java.util.concurrent.Executor import scala.concurrent._ import scala.util.control.NoStackTrace diff --git a/test/files/jvm/try-type-tests.scala b/test/files/jvm/try-type-tests.scala index 17811f64c5..e5e53ee737 100644 --- a/test/files/jvm/try-type-tests.scala +++ b/test/files/jvm/try-type-tests.scala @@ -49,6 +49,7 @@ trait TryStandard { n match { case Success(v) => assert(false) case Failure(e: NoSuchElementException) => assert(true) + case _ => assert(false) } } @@ -141,4 +142,4 @@ object Test extends App with TryStandard { System.exit(0) -}
\ No newline at end of file +} diff --git a/test/files/jvm/unreachable/Foo_1.scala b/test/files/jvm/unreachable/Foo_1.scala index d17421c516..c223718097 100644 --- a/test/files/jvm/unreachable/Foo_1.scala +++ b/test/files/jvm/unreachable/Foo_1.scala @@ -1,3 +1,5 @@ +import scala.sys.error + class Foo_1 { def unreachableNormalExit: Int = { return 42 @@ -107,4 +109,4 @@ class Foo_1 { } 2 } -}
\ No newline at end of file +} diff --git a/test/files/jvm/xml01.scala b/test/files/jvm/xml01.scala index 75777a5b94..2b456f5ff5 100644 --- a/test/files/jvm/xml01.scala +++ b/test/files/jvm/xml01.scala @@ -4,6 +4,8 @@ import org.xml.sax.InputSource import scala.xml._ object Test extends App { + def Elem(prefix: String, label: String, attributes: MetaData, scope: NamespaceBinding, child: Node*): Elem = + scala.xml.Elem.apply(prefix, label, attributes, scope, minimizeEmpty = true, child: _*) val e: scala.xml.MetaData = Null //Node.NoAttributes val sc: scala.xml.NamespaceBinding = TopScope diff --git a/test/files/jvm/xml03syntax.check b/test/files/jvm/xml03syntax.check index edcdbdd2ba..599cbad686 100755 --- a/test/files/jvm/xml03syntax.check +++ b/test/files/jvm/xml03syntax.check @@ -24,3 +24,4 @@ true node=<elem key="<b>hello</b>"/>, key=Some(<b>hello</b>) node=<elem/>, key=None +<a>Å </a> diff --git a/test/files/jvm/xml03syntax.scala b/test/files/jvm/xml03syntax.scala index 2c93f7c176..41663681c7 100644 --- a/test/files/jvm/xml03syntax.scala +++ b/test/files/jvm/xml03syntax.scala @@ -91,7 +91,7 @@ object Test { } val parsed = parser.element(TopScope) // parse the source as element // alternatively, we could call document() - parsed + println(parsed) } } diff --git a/test/files/neg/t4584.check b/test/files/neg/t4584.check index 419f5704b1..97d07afa0e 100644 --- a/test/files/neg/t4584.check +++ b/test/files/neg/t4584.check @@ -1,7 +1,7 @@ t4584.scala:1: error: error in unicode escape -class A { val /u2 +class A { val \u2 ^ -t4584.scala:1: error: illegal character '/uffff' -class A { val /u2 +t4584.scala:1: error: illegal character '\uffff' +class A { val \u2 ^ two errors found diff --git a/test/files/neg/unicode-unterminated-quote.check b/test/files/neg/unicode-unterminated-quote.check index 5085505fb4..166488710b 100644 --- a/test/files/neg/unicode-unterminated-quote.check +++ b/test/files/neg/unicode-unterminated-quote.check @@ -1,7 +1,7 @@ unicode-unterminated-quote.scala:2: error: unclosed string literal - val x = /u0022 + val x = \u0022 ^ unicode-unterminated-quote.scala:2: error: '}' expected but eof found. - val x = /u0022 + val x = \u0022 ^ two errors found diff --git a/test/files/presentation/doc/doc.scala b/test/files/presentation/doc/doc.scala index a64a423cc5..c884b6425b 100755 --- a/test/files/presentation/doc/doc.scala +++ b/test/files/presentation/doc/doc.scala @@ -1,9 +1,9 @@ +import scala.reflect.internal.util.{ BatchSourceFile, SourceFile } import scala.tools.nsc.doc import scala.tools.nsc.doc.base._ import scala.tools.nsc.doc.base.comment._ import scala.tools.nsc.interactive._ import scala.tools.nsc.interactive.tests._ -import scala.tools.nsc.util._ object Test extends InteractiveTest { val tags = Seq( @@ -100,12 +100,11 @@ object Test extends InteractiveTest { println("Couldn't parse") case Some(_) => val sym = compiler.ask { () => - val toplevel = definitions.EmptyPackage.info.decl(newTypeName(name)) + val toplevel = compiler.rootMirror.EmptyPackage.info.decl(TypeName(name)) if (toplevel eq NoSymbol) { - val clazz = definitions.EmptyPackage.info.decl(newTypeName(className)) - - val term = clazz.info.decl(newTermName(name)) - if (term eq NoSymbol) clazz.info.decl(newTypeName(name)) else + val clazz = compiler.rootMirror.EmptyPackage.info.decl(TypeName(className)) + val term = clazz.info.decl(TermName(name)) + if (term eq NoSymbol) clazz.info.decl(TypeName(name)) else if (term.isAccessor) term.accessed else term } else toplevel } @@ -133,7 +132,7 @@ object Test extends InteractiveTest { case c: Comment => existsText(c.body, text) } val (derived, base) = compiler.ask { () => - val derived = definitions.RootPackage.info.decl(newTermName("p")).info.decl(newTypeName("Derived")) + val derived = compiler.rootMirror.RootPackage.info.decl(newTermName("p")).info.decl(newTypeName("Derived")) (derived, derived.ancestors(0)) } val cmt1 = getComment(derived, derivedSource, (base, baseSource)::(derived, derivedSource)::Nil) diff --git a/test/files/presentation/memory-leaks/MemoryLeaksTest.scala b/test/files/presentation/memory-leaks/MemoryLeaksTest.scala index 950569c880..1ddeb6ac4a 100644 --- a/test/files/presentation/memory-leaks/MemoryLeaksTest.scala +++ b/test/files/presentation/memory-leaks/MemoryLeaksTest.scala @@ -2,8 +2,8 @@ import java.io.PrintWriter import java.io.FileOutputStream import java.util.Calendar +import scala.reflect.internal.util.BatchSourceFile import scala.tools.nsc.interactive.tests._ -import scala.tools.nsc.util._ import scala.tools.nsc.io._ import scala.tools.nsc.doc diff --git a/test/files/run/Course-2002-01.check b/test/files/run/Course-2002-01.check index 17b30bf3c2..16b491d6e2 100644 --- a/test/files/run/Course-2002-01.check +++ b/test/files/run/Course-2002-01.check @@ -1,3 +1,6 @@ +Course-2002-01.scala:41: warning: method loop in object M0 does nothing other than call itself recursively + def loop: Int = loop; + ^ 232 667 11 diff --git a/test/files/run/Meter.check b/test/files/run/Meter.check index b7e2eac125..c79c51a294 100644 --- a/test/files/run/Meter.check +++ b/test/files/run/Meter.check @@ -1,3 +1,6 @@ +Meter.scala:72: warning: a.Meter and Int are unrelated: they will never compare equal + println("x == 1: "+(x == 1)) + ^ 2.0 4.0m false diff --git a/test/files/run/MeterCaseClass.check b/test/files/run/MeterCaseClass.check index 2528753657..2782704f9f 100644 --- a/test/files/run/MeterCaseClass.check +++ b/test/files/run/MeterCaseClass.check @@ -1,3 +1,6 @@ +MeterCaseClass.scala:69: warning: comparing values of types a.Meter and Int using `==' will always yield false + println("x == 1: "+(x == 1)) + ^ 2.0 Meter(4.0) false diff --git a/test/files/run/Predef.readLine.scala b/test/files/run/Predef.readLine.scala index 9f07936638..54809f8071 100644 --- a/test/files/run/Predef.readLine.scala +++ b/test/files/run/Predef.readLine.scala @@ -1,4 +1,5 @@ import java.io.StringReader +import scala.io.ReadStdin.readLine object Test extends App { Console.withIn(new StringReader("")) { @@ -7,4 +8,4 @@ object Test extends App { readLine("%s prompt\n", "fancy") readLine("%s %s prompt\n", "immensely", "fancy") } -}
\ No newline at end of file +} diff --git a/test/files/run/SymbolsTest.scala b/test/files/run/SymbolsTest.scala index 53caa5e62f..d5948ea168 100644 --- a/test/files/run/SymbolsTest.scala +++ b/test/files/run/SymbolsTest.scala @@ -1,6 +1,5 @@ - - +import scala.language.reflectiveCalls class Slazz { val s1 = 'myFirstSymbol diff --git a/test/files/run/abstypetags_serialize.scala b/test/files/run/abstypetags_serialize.scala index 93fb5dcd06..6ec97105fe 100644 --- a/test/files/run/abstypetags_serialize.scala +++ b/test/files/run/abstypetags_serialize.scala @@ -1,3 +1,4 @@ +import scala.language.higherKinds import java.io._ import scala.reflect.runtime.universe._ import scala.reflect.runtime.{universe => ru} @@ -30,4 +31,4 @@ object Test extends App { } qwe -}
\ No newline at end of file +} diff --git a/test/files/run/array-existential-bound.scala b/test/files/run/array-existential-bound.scala index bc442d39f7..b397c98111 100644 --- a/test/files/run/array-existential-bound.scala +++ b/test/files/run/array-existential-bound.scala @@ -10,8 +10,8 @@ object Test extends Fooz[Array[Int]] { def main(args: Array[String]): Unit = { println(f1.f0(Array[String]("a", "b"))) - println(f2.f0(1 to 1000 toArray)) + println(f2.f0((1 to 1000).toArray)) println(f3.f0((1 to 1000).toArray[Any])) - println(f4.f0('a' to 'z' toArray)) + println(f4.f0(('a' to 'z').toArray)) } } diff --git a/test/files/run/arrays.check b/test/files/run/arrays.check index b1f7fae1d1..c9a3a87268 100644 --- a/test/files/run/arrays.check +++ b/test/files/run/arrays.check @@ -1 +1,7 @@ +arrays.scala:248: warning: comparing values of types Unit and Unit using `==' will always yield true + check(xs(0) == u0, xs(0), u0); + ^ +arrays.scala:249: warning: comparing values of types Unit and Unit using `==' will always yield true + check(xs(1) == u1, xs(1), u1); + ^ checks: 2302 diff --git a/test/files/run/bitsets.scala b/test/files/run/bitsets.scala index 3bfb8c7ac3..5d49220749 100644 --- a/test/files/run/bitsets.scala +++ b/test/files/run/bitsets.scala @@ -4,6 +4,8 @@ //############################################################################ +import scala.language.postfixOps + object TestMutable { import scala.collection.mutable.BitSet diff --git a/test/files/run/bridges.scala b/test/files/run/bridges.scala index fda86eabc6..eb036bd781 100644 --- a/test/files/run/bridges.scala +++ b/test/files/run/bridges.scala @@ -3588,7 +3588,7 @@ object Test { errors = errors + 1; } } catch { - case exception => { + case exception: Throwable => { Console.print(name + " raised exception " + exception); Console.println; errors = errors + 1; diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala index ca598603bb..9d2be42fb7 100644 --- a/test/files/run/bugs.scala +++ b/test/files/run/bugs.scala @@ -444,7 +444,7 @@ object Test { try { test; } catch { - case exception => + case exception: Throwable => Console.print("Exception in thread \"" + Thread.currentThread + "\" " + exception); Console.println; errors += 1 diff --git a/test/files/run/classmanifests_new_alias.scala b/test/files/run/classmanifests_new_alias.scala index 12bd93bab6..777bd5dd6d 100644 --- a/test/files/run/classmanifests_new_alias.scala +++ b/test/files/run/classmanifests_new_alias.scala @@ -1,5 +1,7 @@ + +@deprecated("Suppress warnings", since="2.11") object Test extends App { type CM[T] = ClassManifest[T] println(implicitly[CM[Int]]) println(implicitly[CM[Int]] eq Manifest.Int) -}
\ No newline at end of file +} diff --git a/test/files/run/classmanifests_new_core.scala b/test/files/run/classmanifests_new_core.scala index 63dbfab25c..0a9c58e8e1 100644 --- a/test/files/run/classmanifests_new_core.scala +++ b/test/files/run/classmanifests_new_core.scala @@ -1,4 +1,5 @@ +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[Int]) println(classManifest[Int] eq Manifest.Int) -}
\ No newline at end of file +} diff --git a/test/files/run/collections.scala b/test/files/run/collections.scala index 69c40fae80..1e4e8791ac 100644 --- a/test/files/run/collections.scala +++ b/test/files/run/collections.scala @@ -1,5 +1,6 @@ -import collection._ +import scala.collection._ import scala.compat.Platform.currentTime +import scala.language.postfixOps object Test extends App { diff --git a/test/files/run/colltest1.scala b/test/files/run/colltest1.scala index 54adeb7cda..9d77fc413a 100644 --- a/test/files/run/colltest1.scala +++ b/test/files/run/colltest1.scala @@ -1,4 +1,8 @@ -import collection._ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ +import scala.collection._ +import scala.language.postfixOps object Test extends App { diff --git a/test/files/run/comparable-comparator.scala b/test/files/run/comparable-comparator.scala index ac943c63bb..1707fb6e61 100644 --- a/test/files/run/comparable-comparator.scala +++ b/test/files/run/comparable-comparator.scala @@ -15,7 +15,8 @@ object Test { def compare(p1: C2, p2: C2) = p2.s compareTo p1.s } - val strs = "zip foo bar baz aggle bing bong" split ' ' toList + val words = "zip foo bar baz aggle bing bong" split ' ' + val strs = words.toList val c1s = strs map (x => new C1(x)) val c2s = strs map (x => new C2(x)) diff --git a/test/files/run/compiler-asSeenFrom.scala b/test/files/run/compiler-asSeenFrom.scala index 0d4b504d3c..bd3db0bf66 100644 --- a/test/files/run/compiler-asSeenFrom.scala +++ b/test/files/run/compiler-asSeenFrom.scala @@ -1,6 +1,10 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.tools.nsc._ import scala.tools.partest.CompilerTest import scala.collection.{ mutable, immutable, generic } +import scala.language.postfixOps /** It's too messy but it's better than not having it. */ @@ -117,6 +121,5 @@ package ll { println(sigs.mkString(x + " { // after " + ph + "\n ", "\n ", "\n}\n")) } } - true } } diff --git a/test/files/run/concurrent-stream.scala b/test/files/run/concurrent-stream.scala index 42c695964e..9d5ba0428e 100644 --- a/test/files/run/concurrent-stream.scala +++ b/test/files/run/concurrent-stream.scala @@ -1,32 +1,33 @@ // test concurrent calls to Stream.tail +@deprecated("Suppress warnings", since="2.11") object Test { -def slowRange(from: Int, until: Int, cons: (Int, => Stream[Int]) => Stream[Int]): Stream[Int] = { - var current = from - def next: Stream[Int] = { - Thread.sleep(100) - if (current >= until) Stream.empty - else { - val stream = cons(current, next) - current += 1 - stream + def slowRange(from: Int, until: Int, cons: (Int, => Stream[Int]) => Stream[Int]): Stream[Int] = { + var current = from + def next: Stream[Int] = { + Thread.sleep(100) + if (current >= until) Stream.empty + else { + val stream = cons(current, next) + current += 1 + stream + } } + next } - next -} -def testCons(cons: (Int, => Stream[Int]) => Stream[Int]): Unit = { - import scala.actors.Actor._ + def testCons(cons: (Int, => Stream[Int]) => Stream[Int]): Unit = { + import scala.actors.Actor._ - val stream = slowRange(0, 10, cons) - val main = self - actor { main ! stream.toList } - actor { main ! stream.toList } - val eval0 = receive { case list: List[Int] => list } - val eval1 = receive { case list: List[Int] => list } - println("Evaluation 0: " + eval0) - println("Evaluation 1: " + eval1) -} + val stream = slowRange(0, 10, cons) + val main = self + actor { main ! stream.toList } + actor { main ! stream.toList } + val eval0 = receive { case list: List[Int @unchecked] => list } + val eval1 = receive { case list: List[Int @unchecked] => list } + println("Evaluation 0: " + eval0) + println("Evaluation 1: " + eval1) + } def main(args: Array[String]) { println("Testing standard cons.") diff --git a/test/files/run/contrib674.check b/test/files/run/contrib674.check new file mode 100644 index 0000000000..78325c1810 --- /dev/null +++ b/test/files/run/contrib674.check @@ -0,0 +1,3 @@ +contrib674.scala:15: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1 + ^ diff --git a/test/files/run/contrib674.scala b/test/files/run/contrib674.scala index f6b46d13c6..45c9871fc4 100644 --- a/test/files/run/contrib674.scala +++ b/test/files/run/contrib674.scala @@ -5,11 +5,11 @@ object Test extends App { try { 1 } catch { - case e => + case e: Throwable => } finally { try { } catch { - case e => + case e: Throwable => } } 1 diff --git a/test/files/run/ctries-new/main.scala b/test/files/run/ctries-new/main.scala index d7fe087e4d..34f3ec2ccf 100644 --- a/test/files/run/ctries-new/main.scala +++ b/test/files/run/ctries-new/main.scala @@ -21,6 +21,9 @@ object Test { trait Spec { + implicit def implicitously = scala.language.implicitConversions + implicit def reflectively = scala.language.reflectiveCalls + implicit def str2ops(s: String) = new { def in[U](body: =>U) { // just execute body @@ -37,11 +40,11 @@ trait Spec { var produced = false try body catch { - case e => if (e.getClass == implicitly[ClassTag[T]].runtimeClass) produced = true + case e: Throwable => if (e.getClass == implicitly[ClassTag[T]].runtimeClass) produced = true } finally { assert(produced, "Did not produce exception of type: " + implicitly[ClassTag[T]]) } } } -}
\ No newline at end of file +} diff --git a/test/files/run/ctries-old/concmap.scala b/test/files/run/ctries-old/concmap.scala index 3ec0256afb..fccd4bed3e 100644 --- a/test/files/run/ctries-old/concmap.scala +++ b/test/files/run/ctries-old/concmap.scala @@ -2,6 +2,7 @@ import collection.concurrent.TrieMap +import Test.Spec object ConcurrentMapSpec extends Spec { diff --git a/test/files/run/ctries-old/iterator.scala b/test/files/run/ctries-old/iterator.scala index b953a40e00..585bdc0e48 100644 --- a/test/files/run/ctries-old/iterator.scala +++ b/test/files/run/ctries-old/iterator.scala @@ -5,6 +5,7 @@ import collection._ import collection.concurrent.TrieMap +import Test.Spec object IteratorSpec extends Spec { diff --git a/test/files/run/ctries-old/lnode.scala b/test/files/run/ctries-old/lnode.scala index 92a31088e5..3ff5414ac0 100644 --- a/test/files/run/ctries-old/lnode.scala +++ b/test/files/run/ctries-old/lnode.scala @@ -3,6 +3,7 @@ import collection.concurrent.TrieMap +import Test.Spec object LNodeSpec extends Spec { diff --git a/test/files/run/ctries-old/main.scala b/test/files/run/ctries-old/main.scala index 78ba7f0db1..f714bcdcdc 100644 --- a/test/files/run/ctries-old/main.scala +++ b/test/files/run/ctries-old/main.scala @@ -5,6 +5,7 @@ +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]) { @@ -14,11 +15,13 @@ object Test { SnapshotSpec.test() } -} trait Spec { + implicit def implicitously = scala.language.implicitConversions + implicit def reflectively = scala.language.reflectiveCalls + implicit def str2ops(s: String) = new { def in[U](body: =>U) { // just execute body @@ -35,7 +38,7 @@ trait Spec { var produced = false try body catch { - case e => if (e.getClass == implicitly[ClassManifest[T]].erasure) produced = true + case e: Throwable => if (e.getClass == implicitly[ClassManifest[T]].erasure) produced = true } finally { assert(produced, "Did not produce exception of type: " + implicitly[ClassManifest[T]]) } @@ -43,3 +46,4 @@ trait Spec { } } +} diff --git a/test/files/run/ctries-old/snapshot.scala b/test/files/run/ctries-old/snapshot.scala index 5fe77d445b..768b588f81 100644 --- a/test/files/run/ctries-old/snapshot.scala +++ b/test/files/run/ctries-old/snapshot.scala @@ -5,6 +5,7 @@ import collection._ import collection.concurrent.TrieMap +import Test.Spec object SnapshotSpec extends Spec { diff --git a/test/files/run/delay-bad.check b/test/files/run/delay-bad.check index 9d9c828a03..2ae88267c5 100644 --- a/test/files/run/delay-bad.check +++ b/test/files/run/delay-bad.check @@ -1,3 +1,9 @@ +delay-bad.scala:53: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f(new C { 5 }) + ^ +delay-bad.scala:73: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f(new { val x = 5 } with E() { 5 }) + ^ // new C { } diff --git a/test/files/run/delay-good.check b/test/files/run/delay-good.check index 8eb04c7cff..b4f6b04af7 100644 --- a/test/files/run/delay-good.check +++ b/test/files/run/delay-good.check @@ -1,3 +1,9 @@ +delay-good.scala:53: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f(new C { 5 }) + ^ +delay-good.scala:73: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + f(new { val x = 5 } with E() { 5 }) + ^ // new C { } diff --git a/test/files/run/distinct.scala b/test/files/run/distinct.scala index 09e5a0734a..37bbe7805a 100644 --- a/test/files/run/distinct.scala +++ b/test/files/run/distinct.scala @@ -3,7 +3,7 @@ */ object Test { val alphabet = 'a' to 'z' mkString "" - val alphaList = 'a' to 'z' toList + val alphaList = ('a' to 'z').toList def shuffled = util.Random.shuffle(alphaList) def main(args: Array[String]): Unit = { diff --git a/test/files/run/enrich-gentraversable.scala b/test/files/run/enrich-gentraversable.scala index 52eded55fd..0f79a47030 100644 --- a/test/files/run/enrich-gentraversable.scala +++ b/test/files/run/enrich-gentraversable.scala @@ -1,3 +1,6 @@ +import scala.language.implicitConversions +import scala.language.postfixOps + object Test extends App { import scala.collection.{GenTraversableOnce,GenTraversableLike} import scala.collection.generic._ diff --git a/test/files/run/eta-expand-star2.check b/test/files/run/eta-expand-star2.check index ce01362503..cbf4781255 100644 --- a/test/files/run/eta-expand-star2.check +++ b/test/files/run/eta-expand-star2.check @@ -1 +1,2 @@ +warning: there were 1 deprecation warning(s); re-run with -deprecation for details hello diff --git a/test/files/run/exceptions-2.check b/test/files/run/exceptions-2.check index 9a3044cd4f..4f8244800a 100644 --- a/test/files/run/exceptions-2.check +++ b/test/files/run/exceptions-2.check @@ -1,3 +1,6 @@ +exceptions-2.scala:267: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + try { 1 } catch { case e: java.io.IOException => () } + ^ nested1: Innermost finally Outermost finally diff --git a/test/files/run/exceptions-2.scala b/test/files/run/exceptions-2.scala index f5bbcca210..8d755c3809 100644 --- a/test/files/run/exceptions-2.scala +++ b/test/files/run/exceptions-2.scala @@ -42,7 +42,7 @@ object NoExcep { def method4 = try { Console.println(".."); } catch { - case _ => sys.error(".."); + case _: Throwable => sys.error(".."); } } @@ -136,7 +136,7 @@ object Test { try { sys.error("a"); } catch { - case _ => Console.println("Silently ignore exception in finally"); + case _: Throwable => Console.println("Silently ignore exception in finally"); } } } @@ -146,7 +146,7 @@ object Test { } finally { val fin = "Abc"; Console.println(fin); - }; + } def tryAndValInFinally: Unit = try { @@ -154,8 +154,8 @@ object Test { val fin = "Abc"; try { Console.println(fin); - } catch { case _ => () } - }; + } catch { case _: Throwable => () } + } def returnInBody: Unit = try { try { @@ -249,7 +249,7 @@ object Test { def execute(f: => Unit) = try { f; } catch { - case _ => (); + case _: Throwable => () } diff --git a/test/files/run/exceptions-nest.scala b/test/files/run/exceptions-nest.scala index 841e6b1c67..432d600d13 100644 --- a/test/files/run/exceptions-nest.scala +++ b/test/files/run/exceptions-nest.scala @@ -5,9 +5,9 @@ object Test extends App { println(test3) println(test4) println(test5) - try { println(test6) } catch { case _ => println("OK") } + try { println(test6) } catch { case _: Throwable => println("OK") } println(test7) - try { println(test8) } catch { case _ => println("OK") } + try { println(test8) } catch { case _: Throwable => println("OK") } println(test9) println(test10) println(test11) @@ -19,7 +19,7 @@ object Test extends App { x = 2 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -31,12 +31,12 @@ object Test extends App { try { x = 21 } catch { - case _ => x = 22 + case _: Throwable => x = 22 } x = 23 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -44,10 +44,10 @@ object Test extends App { def test3 = { var x = 1 try { - try{x = 2} catch { case _ => x = 4 } + try{x = 2} catch { case _: Throwable => x = 4 } } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } x } @@ -58,7 +58,7 @@ object Test extends App { x = 2 } catch { case _: NullPointerException => x = 3 - case _ => x = 4 + case _: Throwable => x = 4 } try { x = 5 @@ -73,8 +73,8 @@ object Test extends App { try { x = 2 } catch { - case _: NullPointerException => try { x = 3 } catch { case f => throw f } - case _ => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43 + case _: NullPointerException => try { x = 3 } catch { case f: Throwable => throw f } + case _: Throwable => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43 } x } @@ -87,7 +87,7 @@ object Test extends App { } catch { case e: NullPointerException => throw e - case _ => + case _: Throwable => x = 3 return 1000 } finally { @@ -105,7 +105,7 @@ object Test extends App { try { x = 4 } catch { - case _ => x = 5 + case _: Throwable => x = 5 } } x @@ -116,7 +116,7 @@ object Test extends App { try { throw new NullPointerException } catch { - case e => throw e + case e: Throwable => throw e } x } @@ -124,7 +124,7 @@ object Test extends App { def test9 = { try { "" match { case s: String => 10 - }} catch { case _ => 20 } + }} catch { case _: Throwable => 20 } } var x10 = 1 @@ -135,7 +135,7 @@ object Test extends App { def test11 { try { () } - catch { case e => () } + catch { case e: Throwable => () } } class E1 extends Exception diff --git a/test/files/run/exceptions.scala b/test/files/run/exceptions.scala index 90f681e3c5..f0fe76946b 100644 --- a/test/files/run/exceptions.scala +++ b/test/files/run/exceptions.scala @@ -32,7 +32,7 @@ object exceptions { val value = try { map.lookup(key) } catch { - case e => e.getMessage() + case e: Throwable => e.getMessage() } check("lookup(" + key + ")", value, "KO"); } diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala index 14c25849cb..f5a0aa98d0 100644 --- a/test/files/run/existentials-in-compiler.scala +++ b/test/files/run/existentials-in-compiler.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.tools.nsc._ import scala.tools.partest.CompilerTest import scala.collection.{ mutable, immutable, generic } @@ -71,14 +74,13 @@ package extest { } """ - def check(source: String, unit: global.CompilationUnit) = { - getRequiredPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz => + override def check(source: String, unit: global.CompilationUnit) { + getPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz => exitingTyper { clazz.info println(clazz.defString) println(" " + classExistentialType(clazz) + "\n") } } - true } } diff --git a/test/files/run/existentials.scala b/test/files/run/existentials.scala index 3977d47417..65acfd2ac0 100644 --- a/test/files/run/existentials.scala +++ b/test/files/run/existentials.scala @@ -1,3 +1,6 @@ +import scala.language.existentials +import scala.language.reflectiveCalls + class Foo { class Line { case class Cell[T](var x: T) diff --git a/test/files/run/existentials3-new.scala b/test/files/run/existentials3-new.scala index 110c8eff7a..6112a7b856 100644 --- a/test/files/run/existentials3-new.scala +++ b/test/files/run/existentials3-new.scala @@ -1,3 +1,4 @@ +import scala.language.existentials import scala.reflect.runtime.universe._ object Test { @@ -77,4 +78,4 @@ object Misc { } def g1 = o1.f1 _ def g2 = o1.f2 _ -}
\ No newline at end of file +} diff --git a/test/files/run/existentials3-old.scala b/test/files/run/existentials3-old.scala index 944160ff12..c021c0e71e 100644 --- a/test/files/run/existentials3-old.scala +++ b/test/files/run/existentials3-old.scala @@ -1,3 +1,5 @@ +import scala.language.existentials + object Test { trait ToS { final override def toString = getClass.getName } diff --git a/test/files/run/finally.scala b/test/files/run/finally.scala index 635123cc4d..01180fd217 100644 --- a/test/files/run/finally.scala +++ b/test/files/run/finally.scala @@ -7,7 +7,7 @@ object Test extends App { try { bar } catch { - case e => println(e) + case e: Throwable => println(e) } } @@ -17,7 +17,7 @@ object Test extends App { println("hi") } catch { - case e => println("SHOULD NOT GET HERE") + case e: Throwable => println("SHOULD NOT GET HERE") } finally { println("In Finally") @@ -30,7 +30,7 @@ object Test extends App { try { throw new Exception } catch { - case e => + case e: Throwable => println(e); return } finally println("in finally") @@ -41,7 +41,7 @@ object Test extends App { try { throw new Exception } catch { - case e => + case e: Throwable => println(e); throw e } finally println("in finally") @@ -52,7 +52,7 @@ object Test extends App { try { return } catch { - case e => + case e: Throwable => println(e); throw e } finally println("in finally") @@ -63,7 +63,7 @@ object Test extends App { try { throw new Exception } catch { - case e => + case e: Throwable => println(e); } finally println("in finally") } @@ -89,7 +89,7 @@ object Test extends App { throw new Exception } } catch { - case e => println(e) + case e: Throwable => println(e) } } @@ -99,7 +99,7 @@ object Test extends App { try { return 10 } finally { - try { () } catch { case _ => () } + try { () } catch { case _: Throwable => () } println("in finally 1") } } finally { @@ -111,7 +111,7 @@ object Test extends App { try { m } catch { - case e => println("COUGHT: " + e) + case e: Throwable => println("COUGHT: " + e) } println("-" * 40) } diff --git a/test/files/run/genericValueClass.scala b/test/files/run/genericValueClass.scala index 768e1f86a5..9398390a80 100644 --- a/test/files/run/genericValueClass.scala +++ b/test/files/run/genericValueClass.scala @@ -1,4 +1,6 @@ +import scala.language.implicitConversions + object Test extends App { class ArrowAssocClass[A](val __leftOfArrow: A) extends AnyVal { @inline def -> [B](y: B): Tuple2[A, B] = Tuple2(__leftOfArrow, y) diff --git a/test/files/run/getClassTest-old.scala b/test/files/run/getClassTest-old.scala index 951cc8d931..789dd4d162 100644 --- a/test/files/run/getClassTest-old.scala +++ b/test/files/run/getClassTest-old.scala @@ -50,6 +50,7 @@ class MoreAnyRefs { def f4 = (new A { def bippy() = 5 }).getClass() } +@deprecated("Suppress warnings", since="2.11") object Test { def returnTypes[T: Manifest] = ( manifest[T].erasure.getMethods.toList diff --git a/test/files/run/global-showdef.scala b/test/files/run/global-showdef.scala index 71ba7b8bb3..2a00ee51bd 100644 --- a/test/files/run/global-showdef.scala +++ b/test/files/run/global-showdef.scala @@ -1,6 +1,7 @@ import scala.tools.nsc._ -import io.{ AbstractFile } -import util.{ SourceFile, BatchSourceFile, stringFromStream } +import scala.reflect.io.AbstractFile +import scala.tools.nsc.util.stringFromStream +import scala.reflect.internal.util.{ SourceFile, BatchSourceFile } import scala.tools.nsc.reporters.ConsoleReporter object Test { @@ -53,7 +54,7 @@ object Bippy { val run = new compiler.Run() run.compileSources(List(src)) } - output split "\\n" toList + (output split "\\n").toList } def showClass(name: String) = lines("-Yshow:typer", "-Xshow-class", name) def showObject(name: String) = lines("-Yshow:typer", "-Xshow-object", name) diff --git a/test/files/run/impconvtimes.scala b/test/files/run/impconvtimes.scala index 8c5ab61779..477a16a890 100644 --- a/test/files/run/impconvtimes.scala +++ b/test/files/run/impconvtimes.scala @@ -1,3 +1,5 @@ +import scala.language.implicitConversions + object Test { abstract class Unit object NoUnit extends Unit diff --git a/test/files/run/implicits.scala b/test/files/run/implicits.scala index a30f60f6d0..5681a9d484 100644 --- a/test/files/run/implicits.scala +++ b/test/files/run/implicits.scala @@ -1,3 +1,5 @@ +import scala.language.implicitConversions + object A { object B { implicit def int2string(x: Int) = "["+x.toString+"]" diff --git a/test/files/run/indexedSeq.scala b/test/files/run/indexedSeq.scala index 9744f47f63..29a8be701d 100644 --- a/test/files/run/indexedSeq.scala +++ b/test/files/run/indexedSeq.scala @@ -1,10 +1,11 @@ object Test { - import scala.collection.{ mutable, immutable, generic } + import scala.collection.immutable def checkIdentity[A](xs: immutable.IndexedSeq[A]) = assert(xs.toIndexedSeq eq xs) def main(args: Array[String]): Unit = { - checkIdentity(immutable.Vector(1 to 10: _*)) - checkIdentity(1 to 10 toIndexedSeq) + def r = 1 to 10 + checkIdentity(immutable.Vector(r: _*)) + checkIdentity(r.toIndexedSeq) } } diff --git a/test/files/run/inner-obj-auto.scala b/test/files/run/inner-obj-auto.scala index aa2e29326f..35ca56ba3e 100644 --- a/test/files/run/inner-obj-auto.scala +++ b/test/files/run/inner-obj-auto.scala @@ -25,7 +25,7 @@ class Class2_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -54,7 +54,7 @@ object Object3_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -83,7 +83,7 @@ trait Trait4_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -112,7 +112,7 @@ class Class6_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -141,7 +141,7 @@ object Object7_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -170,7 +170,7 @@ trait Trait8_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -199,7 +199,7 @@ class Class10_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -228,7 +228,7 @@ object Object11_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -257,7 +257,7 @@ trait Trait12_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -286,7 +286,7 @@ class Class14_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -315,7 +315,7 @@ object Object15_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -344,7 +344,7 @@ trait Trait16_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -373,7 +373,7 @@ class Class18_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -402,7 +402,7 @@ object Object19_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -431,7 +431,7 @@ trait Trait20_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -460,7 +460,7 @@ class Class22_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -489,7 +489,7 @@ object Object23_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -518,7 +518,7 @@ trait Trait24_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -548,7 +548,7 @@ class Class26_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -579,7 +579,7 @@ object Object27_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -610,7 +610,7 @@ trait Trait28_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -641,7 +641,7 @@ class Class30_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -672,7 +672,7 @@ object Object31_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -703,7 +703,7 @@ trait Trait32_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -733,7 +733,7 @@ class Class34_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -762,7 +762,7 @@ object Object35_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -791,7 +791,7 @@ trait Trait36_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -820,7 +820,7 @@ class Class38_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -849,7 +849,7 @@ object Object39_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -878,7 +878,7 @@ trait Trait40_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -907,7 +907,7 @@ class Class42_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -936,7 +936,7 @@ object Object43_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -965,7 +965,7 @@ trait Trait44_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -994,7 +994,7 @@ class Class46_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1023,7 +1023,7 @@ object Object47_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1052,7 +1052,7 @@ trait Trait48_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1081,7 +1081,7 @@ class Class50_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1110,7 +1110,7 @@ object Object51_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1139,7 +1139,7 @@ trait Trait52_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("failed "); e.printStackTrace() + case e: Throwable => print("failed "); e.printStackTrace() } } @@ -1172,7 +1172,7 @@ class Class54_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1205,7 +1205,7 @@ object Object55_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1238,7 +1238,7 @@ trait Trait56_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1271,7 +1271,7 @@ class Class58_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1304,7 +1304,7 @@ object Object59_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1337,7 +1337,7 @@ trait Trait60_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1370,7 +1370,7 @@ class Class62_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1403,7 +1403,7 @@ object Object63_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1436,7 +1436,7 @@ trait Trait64_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1469,7 +1469,7 @@ class Class66_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1502,7 +1502,7 @@ object Object67_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1535,7 +1535,7 @@ trait Trait68_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1568,7 +1568,7 @@ class Class70_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1601,7 +1601,7 @@ object Object71_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1634,7 +1634,7 @@ trait Trait72_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1667,7 +1667,7 @@ class Class74_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1700,7 +1700,7 @@ object Object75_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1733,7 +1733,7 @@ trait Trait76_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1767,7 +1767,7 @@ class Class78_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1802,7 +1802,7 @@ object Object79_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1837,7 +1837,7 @@ trait Trait80_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1872,7 +1872,7 @@ class Class82_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1907,7 +1907,7 @@ object Object83_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1942,7 +1942,7 @@ trait Trait84_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -1976,7 +1976,7 @@ class Class90_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } @@ -2009,7 +2009,7 @@ trait Trait92_1 { assert(ObjCounter == 1, "multiple instances: " + ObjCounter) println("ok") } catch { - case e => print("multi-threaded failed "); e.printStackTrace() + case e: Throwable => print("multi-threaded failed "); e.printStackTrace() } } diff --git a/test/files/run/interop_classtags_are_classmanifests.scala b/test/files/run/interop_classtags_are_classmanifests.scala index 91b9d89c6e..62d85c3ce3 100644 --- a/test/files/run/interop_classtags_are_classmanifests.scala +++ b/test/files/run/interop_classtags_are_classmanifests.scala @@ -1,5 +1,6 @@ -import scala.reflect.{ClassTag, classTag} +import scala.reflect.ClassTag +@deprecated("Suppress warnings", since="2.11") object Test extends App { def classTagIsClassManifest[T: ClassTag] = { println(classManifest[T]) @@ -8,4 +9,4 @@ object Test extends App { classTagIsClassManifest[Int] classTagIsClassManifest[String] classTagIsClassManifest[Array[Int]] -}
\ No newline at end of file +} diff --git a/test/files/run/interop_manifests_are_classtags.scala b/test/files/run/interop_manifests_are_classtags.scala index 03479e527a..705038ece7 100644 --- a/test/files/run/interop_manifests_are_classtags.scala +++ b/test/files/run/interop_manifests_are_classtags.scala @@ -1,5 +1,6 @@ import scala.reflect.{ClassTag, classTag} +@deprecated("Suppress warnings", since="2.11") object Test extends App { def classManifestIsClassTag[T: ClassManifest] = { println(classTag[T]) @@ -20,4 +21,4 @@ object Test extends App { manifestIsClassTag[Int] manifestIsClassTag[String] manifestIsClassTag[Array[Int]] -}
\ No newline at end of file +} diff --git a/test/files/run/interpolationArgs.scala b/test/files/run/interpolationArgs.scala index eb13767907..ffb254b63f 100644 --- a/test/files/run/interpolationArgs.scala +++ b/test/files/run/interpolationArgs.scala @@ -1,5 +1,5 @@ object Test extends App { - try { scala.StringContext("p1", "p2", "p3").s("e1") } catch { case ex => println(ex) } - try { scala.StringContext("p1").s("e1") } catch { case ex => println(ex) } + try { scala.StringContext("p1", "p2", "p3").s("e1") } catch { case ex: Throwable => println(ex) } + try { scala.StringContext("p1").s("e1") } catch { case ex: Throwable => println(ex) } } diff --git a/test/files/run/interpolationMultiline2.scala b/test/files/run/interpolationMultiline2.scala index f6a682c3ce..2de4c4b22e 100644 --- a/test/files/run/interpolationMultiline2.scala +++ b/test/files/run/interpolationMultiline2.scala @@ -2,14 +2,15 @@ object Test extends App { def test1(n: Int) = { val old = "old" - try { println(s"""Bob is ${s"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${f"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${s"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${f"$n"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(f"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } - try { println(s"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch { case ex => println(ex) } + val catcher: PartialFunction[Throwable, Unit] = { case e => println(e) } + try { println(s"""Bob is ${s"$n"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${f"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${s"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${f"$n"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(f"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${f"$n%2d"} years ${s"$old"}!""") } catch catcher + try { println(s"""Bob is ${s"$n%2d"} years ${s"$old"}!""") } catch catcher } test1(1) diff --git a/test/files/run/io-position.scala b/test/files/run/io-position.scala index 1093704fa4..b227846fb4 100644 --- a/test/files/run/io-position.scala +++ b/test/files/run/io-position.scala @@ -1,7 +1,5 @@ object Test { - Console.setErr(Console.out) - - def main(args: Array[String]): Unit = { + def main(args: Array[String]): Unit = Console.withErr(Console.out) { try { xml.parsing.ConstructingParser.fromSource(io.Source.fromString("<foo>"), false).document() } catch { diff --git a/test/files/run/is-valid-num.scala b/test/files/run/is-valid-num.scala index 402eff99d6..19a3b9c7c0 100644 --- a/test/files/run/is-valid-num.scala +++ b/test/files/run/is-valid-num.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ object Test { def x = BigInt("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") def y = BigDecimal("" + (Short.MaxValue + 1) + ".0") diff --git a/test/files/run/issue192.scala b/test/files/run/issue192.scala index d8db8b5816..3c3b44a8fb 100644 --- a/test/files/run/issue192.scala +++ b/test/files/run/issue192.scala @@ -1,3 +1,5 @@ +import scala.language.reflectiveCalls + object Test extends App { def f1(p: Any{def unary_+ : Int}) = +p diff --git a/test/files/run/iterator-from.scala b/test/files/run/iterator-from.scala index 8dc6ae4e51..fb33f6b5ed 100644 --- a/test/files/run/iterator-from.scala +++ b/test/files/run/iterator-from.scala @@ -1,4 +1,6 @@ -// This file tests iteratorFrom, keysIteratorFrom, and valueIteratorFrom on various sorted sets and maps +/* This file tests iteratorFrom, keysIteratorFrom, and valueIteratorFrom on various sorted sets and maps + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.util.{Random => R} import scala.collection._ diff --git a/test/files/run/iterator-iterate-lazy.scala b/test/files/run/iterator-iterate-lazy.scala index 73886f192b..92b170062e 100644 --- a/test/files/run/iterator-iterate-lazy.scala +++ b/test/files/run/iterator-iterate-lazy.scala @@ -1,5 +1,5 @@ object Test { def main(args: Array[String]): Unit = { - Iterator.iterate(1 to 5 toList)(_.tail).takeWhile(_.nonEmpty).map(_.head).toList + Iterator.iterate((1 to 5).toList)(_.tail).takeWhile(_.nonEmpty).map(_.head).toList } } diff --git a/test/files/run/iterators.scala b/test/files/run/iterators.scala index b85291cd72..e2d0f93a05 100644 --- a/test/files/run/iterators.scala +++ b/test/files/run/iterators.scala @@ -4,6 +4,8 @@ //############################################################################ +import scala.language.postfixOps + object Test { def check_from: Int = { diff --git a/test/files/run/json.scala b/test/files/run/json.scala index a81f12564c..36e86ac5bb 100644 --- a/test/files/run/json.scala +++ b/test/files/run/json.scala @@ -1,13 +1,17 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.util.parsing.json._ import scala.collection.immutable.TreeMap +@deprecated("Suppress warnings", since="2.11") object Test extends App { /* This method converts parsed JSON back into real JSON notation with objects in * sorted-key order. Not required by the spec, but it allows us to do a stable * toString comparison. */ def jsonToString(in : Any) : String = in match { case l : List[_] => "[" + l.map(jsonToString).mkString(", ") + "]" - case m : Map[String,_] => "{" + m.iterator.toList + case m : Map[String @unchecked,_] => "{" + m.iterator.toList .sortWith({ (x,y) => x._1 < y._1 }) .map({ case (k,v) => "\"" + k + "\": " + jsonToString(v) }) .mkString(", ") + "}" @@ -20,7 +24,7 @@ object Test extends App { */ def sortJSON(in : Any) : Any = in match { case l : List[_] => l.map(sortJSON) - case m : Map[String,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*) + case m : Map[String @unchecked,_] => TreeMap(m.mapValues(sortJSON).iterator.toSeq : _*) // For the object versions, sort their contents, ugly casts and all... case JSONObject(data) => JSONObject(sortJSON(data).asInstanceOf[Map[String,Any]]) case JSONArray(data) => JSONArray(sortJSON(data).asInstanceOf[List[Any]]) diff --git a/test/files/run/lazy-exprs.check b/test/files/run/lazy-exprs.check index e77d204251..2efb8ceb4a 100644 --- a/test/files/run/lazy-exprs.check +++ b/test/files/run/lazy-exprs.check @@ -1,3 +1,11 @@ +lazy-exprs.scala:38: warning: match may not be exhaustive. +It would fail on the following input: Some((x: String forSome x not in Z1)) + t match { + ^ +lazy-exprs.scala:62: warning: match may not be exhaustive. +It would fail on the following input: Some((x: String forSome x not in LazyField)) + t match { + ^ forced <z1> lazy val in scrutinee: ok forced <z1> diff --git a/test/files/run/lazy-locals.check b/test/files/run/lazy-locals.check index d1cc754f2c..9e88a55d18 100644 --- a/test/files/run/lazy-locals.check +++ b/test/files/run/lazy-locals.check @@ -1,3 +1,9 @@ +lazy-locals.scala:153: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + { + ^ +lazy-locals.scala:159: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + { + ^ forced lazy val q q = 10 forced lazy val t diff --git a/test/files/run/lists-run.scala b/test/files/run/lists-run.scala index ccfe5bc260..5ff3ee353e 100644 --- a/test/files/run/lists-run.scala +++ b/test/files/run/lists-run.scala @@ -2,6 +2,8 @@ * * @author Stephane Micheloud */ +import scala.language.postfixOps + object Test { def main(args: Array[String]) { Test_multiset.run() // multiset operations: union, intersect, diff @@ -153,7 +155,7 @@ object Test3 { List.range(1, 10, 0) } catch { case e: IllegalArgumentException => () - case _ => throw new Error("List.range(1, 10, 0)") + case _: Throwable => throw new Error("List.range(1, 10, 0)") } assert(List.range(10, 0, -2) == List(10, 8, 6, 4, 2)) } diff --git a/test/files/run/literals.check b/test/files/run/literals.check index f53c879dea..6be5137994 100644 --- a/test/files/run/literals.check +++ b/test/files/run/literals.check @@ -1,3 +1,4 @@ +warning: there were 13 deprecation warning(s); re-run with -deprecation for details test '\u0024' == '$' was successful test '\u005f' == '_' was successful test 65.asInstanceOf[Char] == 'A' was successful @@ -43,7 +44,6 @@ test 0x8000000000000000L == -9223372036854775808L was successful test 0xffffffffffffffffL == -1L was successful test 1e1f == 10.0f was successful -test 2.f == 2.0f was successful test .3f == 0.3f was successful test 0f == 0.0f was successful test 3.14f == 3.14f was successful @@ -53,8 +53,6 @@ test 1.asInstanceOf[Float] == 1.0 was successful test 1l.asInstanceOf[Float] == 1.0 was successful test 1e1 == 10.0 was successful -test 2. == 2.0 was successful -test 2.d == 2.0 was successful test .3 == 0.3 was successful test 0.0 == 0.0 was successful test 0d == 0.0 was successful diff --git a/test/files/run/literals.scala b/test/files/run/literals.scala index 32bc29fda8..7676125339 100644 --- a/test/files/run/literals.scala +++ b/test/files/run/literals.scala @@ -105,7 +105,7 @@ object Test { // float check_success("1e1f == 10.0f", 1e1f, 10.0f) - check_success("2.f == 2.0f", 2.f, 2.0f) + //check_success("2.f == 2.0f", 2.f, 2.0f) check_success(".3f == 0.3f", .3f, 0.3f) check_success("0f == 0.0f", 0f, 0.0f) check_success("3.14f == 3.14f", 3.14f, 3.14f) @@ -118,8 +118,8 @@ object Test { // double check_success("1e1 == 10.0", 1e1, 10.0) - check_success("2. == 2.0", 2., 2.0) - check_success("2.d == 2.0", 2.d, 2.0) + //check_success("2. == 2.0", 2., 2.0) + //check_success("2.d == 2.0", 2.d, 2.0) check_success(".3 == 0.3", .3, 0.3) check_success("0.0 == 0.0", 0.0, 0.0) check_success("0d == 0.0", 0d, 0.0) diff --git a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala b/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala index 8bd8c172c9..88cd29ae4f 100644 --- a/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala +++ b/test/files/run/macro-declared-in-anonymous/Macros_Test_2.scala @@ -1,4 +1,6 @@ +import scala.language.reflectiveCalls + object Test extends App { val macros = new { def foo = macro Impls.foo } macros.foo -}
\ No newline at end of file +} diff --git a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala b/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala index f746c2da57..ff9a66d58a 100644 --- a/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala +++ b/test/files/run/macro-declared-in-refinement/Macros_Test_2.scala @@ -1,6 +1,9 @@ + +import scala.language.reflectiveCalls + class Base object Test extends App { val macros = new Base { def foo = macro Impls.foo } macros.foo -}
\ No newline at end of file +} diff --git a/test/files/run/macro-duplicate.check b/test/files/run/macro-duplicate.check index e69de29bb2..58781b719a 100644 --- a/test/files/run/macro-duplicate.check +++ b/test/files/run/macro-duplicate.check @@ -0,0 +1,3 @@ +Test_2.scala:5: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + Macros.foo + ^ diff --git a/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala index 81ebd63c5f..22047eeb36 100644 --- a/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala +++ b/test/files/run/macro-expand-implicit-macro-is-implicit/Macros_Test_2.scala @@ -1,4 +1,5 @@ object Macros { + import scala.language.implicitConversions implicit def foo(x: String): Option[Int] = macro Impls.foo } @@ -7,4 +8,4 @@ object Test extends App { println("2": Option[Int]) val s: Int = "2" getOrElse 0 println(s) -}
\ No newline at end of file +} diff --git a/test/files/run/macro-expand-implicit-macro-is-view.flags b/test/files/run/macro-expand-implicit-macro-is-view.flags deleted file mode 100644 index cd66464f2f..0000000000 --- a/test/files/run/macro-expand-implicit-macro-is-view.flags +++ /dev/null @@ -1 +0,0 @@ --language:experimental.macros
\ No newline at end of file diff --git a/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala b/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala index 0ff1fb80ca..0d99f32d7e 100644 --- a/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala +++ b/test/files/run/macro-expand-implicit-macro-is-view/Macros_Test_2.scala @@ -1,4 +1,7 @@ + object Macros { + import scala.language.experimental.macros + import scala.language.implicitConversions implicit def foo(x: String): Option[Int] = macro Impls.foo } @@ -6,4 +9,4 @@ object Test extends App { import Macros._ def bar[T <% Option[Int]](x: T) = println(x) println("2") -}
\ No newline at end of file +} diff --git a/test/files/run/manifests-new.scala b/test/files/run/manifests-new.scala index f1596dee81..8b42e3ca73 100644 --- a/test/files/run/manifests-new.scala +++ b/test/files/run/manifests-new.scala @@ -1,3 +1,6 @@ + + +import scala.language.{ higherKinds, postfixOps } import scala.reflect.runtime.universe._ object Test @@ -146,4 +149,4 @@ object Test } def main(args: Array[String]): Unit = runAllTests -}
\ No newline at end of file +} diff --git a/test/files/run/manifests-old.scala b/test/files/run/manifests-old.scala index 621689a254..d8b1e751d4 100644 --- a/test/files/run/manifests-old.scala +++ b/test/files/run/manifests-old.scala @@ -1,3 +1,6 @@ +import scala.language.{ higherKinds, postfixOps } + +@deprecated("Suppress warnings", since="2.11") object Test { object Variances extends Enumeration { @@ -144,4 +147,4 @@ object Test } def main(args: Array[String]): Unit = runAllTests -}
\ No newline at end of file +} diff --git a/test/files/run/mapConserve.scala b/test/files/run/mapConserve.scala index 013095b1de..330fb34ca1 100644 --- a/test/files/run/mapConserve.scala +++ b/test/files/run/mapConserve.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.annotation.tailrec import scala.collection.mutable.ListBuffer @@ -50,4 +53,4 @@ object Test { checkStackOverflow(); } -}
\ No newline at end of file +} diff --git a/test/files/run/misc.check b/test/files/run/misc.check index 9fa7b72d50..56116f8104 100644 --- a/test/files/run/misc.check +++ b/test/files/run/misc.check @@ -1,3 +1,27 @@ +misc.scala:46: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 42; + ^ +misc.scala:47: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 42l; + ^ +misc.scala:48: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 23.5f; + ^ +misc.scala:49: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 23.5; + ^ +misc.scala:50: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + "Hello"; + ^ +misc.scala:51: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 32 + 45; + ^ +misc.scala:62: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + x; + ^ +misc.scala:74: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1 < 2; + ^ ### Hello ### 17 ### Bye diff --git a/test/files/run/names-defaults.check b/test/files/run/names-defaults.check index f253de71d6..0037822f3b 100644 --- a/test/files/run/names-defaults.check +++ b/test/files/run/names-defaults.check @@ -1,3 +1,7 @@ +names-defaults.scala:269: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + spawn(b = { val ttt = 1; ttt }, a = 0) + ^ +warning: there were 4 deprecation warning(s); re-run with -deprecation for details 1: @ get: $ get: 2 diff --git a/test/files/run/names-defaults.scala b/test/files/run/names-defaults.scala index 220414f02a..05cd4a540c 100644 --- a/test/files/run/names-defaults.scala +++ b/test/files/run/names-defaults.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, existentials } + object Test extends App { def get[T](x: T) = { println("get: "+ x); x } diff --git a/test/files/run/no-pickle-skolems/Test_2.scala b/test/files/run/no-pickle-skolems/Test_2.scala index 90bb4c4f88..8fd6016aea 100644 --- a/test/files/run/no-pickle-skolems/Test_2.scala +++ b/test/files/run/no-pickle-skolems/Test_2.scala @@ -1,3 +1,5 @@ + +import scala.language.reflectiveCalls import scala.reflect.runtime.universe._ object Test { diff --git a/test/files/run/option-fold.scala b/test/files/run/option-fold.scala index d554ba4f9b..7e21403c2e 100644 --- a/test/files/run/option-fold.scala +++ b/test/files/run/option-fold.scala @@ -7,13 +7,14 @@ object Test { def g(x: Option[A]) = x.fold(-1) { case B => 0 case C(x) => x + case _ => ??? } def main(args: Array[String]): Unit = { - println(f(None)) - println(f(Some(5))) - println(g(None)) - println(g(Some(B))) - println(g(Some(C(1)))) + println(f(None)) //List() + println(f(Some(5))) //List(5) + println(g(None)) //-1 + println(g(Some(B))) //0 + println(g(Some(C(1)))) //1 } } diff --git a/test/files/run/patmat-exprs.scala b/test/files/run/patmat-exprs.scala index dfc78e2ca5..56e4e01598 100644 --- a/test/files/run/patmat-exprs.scala +++ b/test/files/run/patmat-exprs.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions } import runtime.ScalaRunTime object Test { @@ -576,4 +578,4 @@ trait Pattern { implicit def long2Constant[T](l: Long)(implicit num: NumericOps[T]): Leaf[T] = const(num.fromDouble(l.toDouble)) } -}
\ No newline at end of file +} diff --git a/test/files/run/patmat_unapp_abstype-new.check b/test/files/run/patmat_unapp_abstype-new.check index 42c54631d2..c5511e9516 100644 --- a/test/files/run/patmat_unapp_abstype-new.check +++ b/test/files/run/patmat_unapp_abstype-new.check @@ -1,3 +1,9 @@ +patmat_unapp_abstype-new.scala:21: warning: abstract type pattern TypesUser.this.TypeRef is unchecked since it is eliminated by erasure + case TypeRef(x) => println("TypeRef") + ^ +patmat_unapp_abstype-new.scala:53: warning: abstract type pattern Intermed.this.Foo is unchecked since it is eliminated by erasure + case Foo(x) => println("Foo") + ^ TypeRef MethodType Bar diff --git a/test/files/run/patmatnew.check b/test/files/run/patmatnew.check index e69de29bb2..56b8ac2f4f 100644 --- a/test/files/run/patmatnew.check +++ b/test/files/run/patmatnew.check @@ -0,0 +1,15 @@ +patmatnew.scala:351: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + case 1 => "OK" + ^ +patmatnew.scala:352: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + case 2 => assert(false); "KO" + ^ +patmatnew.scala:353: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + case 3 => assert(false); "KO" + ^ +patmatnew.scala:670: warning: This catches all Throwables. If this is really intended, use `case e : Throwable` to clear this warning. + case e => { + ^ +patmatnew.scala:489: warning: unreachable code + case _ if false => + ^ diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala index a6f8199457..fb49e0c924 100644 --- a/test/files/run/patmatnew.scala +++ b/test/files/run/patmatnew.scala @@ -1,3 +1,6 @@ + +import scala.language.{ postfixOps } + object Test { def main(args: Array[String]) { diff --git a/test/files/run/pc-conversions.scala b/test/files/run/pc-conversions.scala index 60ee59c3c4..b1ef3d963e 100644 --- a/test/files/run/pc-conversions.scala +++ b/test/files/run/pc-conversions.scala @@ -1,4 +1,6 @@ - +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import collection._ diff --git a/test/files/run/pf-catch.scala b/test/files/run/pf-catch.scala index ba0781fe89..dfe43dc750 100644 --- a/test/files/run/pf-catch.scala +++ b/test/files/run/pf-catch.scala @@ -1,3 +1,5 @@ + +import scala.language.{ postfixOps } object Test { def shortName(x: AnyRef) = x.getClass.getName split '.' last type Handler[+T] = PartialFunction[Throwable, T] @@ -27,7 +29,7 @@ object Test { def main(args: Array[String]): Unit = { try f1 - catch { case x => println(shortName(x) + " slipped by.") } + catch { case x: Throwable => println(shortName(x) + " slipped by.") } f2 } diff --git a/test/files/run/preinits.check b/test/files/run/preinits.check index 5584ab261e..e97a14b77f 100644 --- a/test/files/run/preinits.check +++ b/test/files/run/preinits.check @@ -1,3 +1,9 @@ +preinits.scala:2: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. +trait B extends { override val x = 1 } with A { println("B") } + ^ +preinits.scala:3: warning: Implementation restriction: early definitions in traits are not initialized before the super class is initialized. +trait C extends { override val x = 2 } with A + ^ A B 2 diff --git a/test/files/run/primitive-sigs-2-new.scala b/test/files/run/primitive-sigs-2-new.scala index cf6de9c81b..1f39667b18 100644 --- a/test/files/run/primitive-sigs-2-new.scala +++ b/test/files/run/primitive-sigs-2-new.scala @@ -1,3 +1,5 @@ + +import scala.language.{ postfixOps } import scala.reflect.{ClassTag, classTag} import java.{ lang => jl } @@ -29,4 +31,4 @@ object Test { println(new C f) c3m.sorted foreach println } -}
\ No newline at end of file +} diff --git a/test/files/run/primitive-sigs-2-old.scala b/test/files/run/primitive-sigs-2-old.scala index b7152f7e3d..0a4be93f22 100644 --- a/test/files/run/primitive-sigs-2-old.scala +++ b/test/files/run/primitive-sigs-2-old.scala @@ -1,3 +1,5 @@ + +import scala.language.{ postfixOps } import java.{ lang => jl } trait T[A] { diff --git a/test/files/run/private-inline.check b/test/files/run/private-inline.check index 209e3ef4b6..eee7f2973b 100644 --- a/test/files/run/private-inline.check +++ b/test/files/run/private-inline.check @@ -1 +1,7 @@ +private-inline.scala:24: warning: Could not inline required method wrapper1 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack. + def f1b() = identity(wrapper1(5)) + ^ +private-inline.scala:29: warning: Could not inline required method wrapper2 because callee contains exception handlers / finally clause, and is invoked with non-empty operand stack. + def f2b() = identity(wrapper2(5)) + ^ 20 diff --git a/test/files/run/private-inline.flags b/test/files/run/private-inline.flags index eb4d19bcb9..00d3643fd4 100644 --- a/test/files/run/private-inline.flags +++ b/test/files/run/private-inline.flags @@ -1 +1 @@ --optimise
\ No newline at end of file +-optimise -Yinline-warnings diff --git a/test/files/run/private-inline.scala b/test/files/run/private-inline.scala index a62007779c..72cabaeff0 100644 --- a/test/files/run/private-inline.scala +++ b/test/files/run/private-inline.scala @@ -43,7 +43,7 @@ object Test { val foundClass = ( try Class.forName(clazz) - catch { case _ => null } + catch { case _: Throwable => null } ) assert(foundClass == null, foundClass) diff --git a/test/files/run/programmatic-main.scala b/test/files/run/programmatic-main.scala index 7bc5c5dfcf..08335ca6f6 100644 --- a/test/files/run/programmatic-main.scala +++ b/test/files/run/programmatic-main.scala @@ -1,3 +1,5 @@ + +import scala.language.postfixOps import scala.tools.nsc._ import io.Path diff --git a/test/files/run/records.scala b/test/files/run/records.scala index 96b0b4cb0f..bae0d943ff 100644 --- a/test/files/run/records.scala +++ b/test/files/run/records.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + trait C { def f: Int } diff --git a/test/files/run/reflection-allmirrors-tostring.scala b/test/files/run/reflection-allmirrors-tostring.scala index 0ca387a6b1..41bab5ac0e 100644 --- a/test/files/run/reflection-allmirrors-tostring.scala +++ b/test/files/run/reflection-allmirrors-tostring.scala @@ -1,3 +1,5 @@ + +import scala.language.higherKinds import scala.reflect.runtime.universe._ class C { @@ -40,4 +42,4 @@ object Test extends App { val cc = typeOf[C].member(TypeName("C")).asClass println(cm.reflectClass(c).reflectConstructor(c.typeSignature.member(nme.CONSTRUCTOR).asMethod)) println(im.reflectClass(cc).reflectConstructor(cc.typeSignature.member(nme.CONSTRUCTOR).asMethod)) -}
\ No newline at end of file +} diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala index 0bcb0bc3a0..f2b3ba960c 100644 --- a/test/files/run/reflection-implicit.scala +++ b/test/files/run/reflection-implicit.scala @@ -1,3 +1,5 @@ + +import scala.language.implicitConversions import scala.reflect.runtime.universe._ class C { @@ -12,4 +14,4 @@ object Test extends App { val param = decls.find(_.name.toString == "d").get.asMethod.paramss.last.head param.typeSignature println(param.isImplicit) -}
\ No newline at end of file +} diff --git a/test/files/run/reflection-magicsymbols-vanilla.scala b/test/files/run/reflection-magicsymbols-vanilla.scala index 26b70460eb..2bde3d8874 100644 --- a/test/files/run/reflection-magicsymbols-vanilla.scala +++ b/test/files/run/reflection-magicsymbols-vanilla.scala @@ -1,3 +1,5 @@ +import scala.language.postfixOps + class A { def foo1(x: Int*) = ??? def foo2(x: => Int) = ??? diff --git a/test/files/run/reify-each-node-type.scala b/test/files/run/reify-each-node-type.scala index a827da766d..425061f955 100644 --- a/test/files/run/reify-each-node-type.scala +++ b/test/files/run/reify-each-node-type.scala @@ -1,3 +1,5 @@ + +import scala.language.{ existentials, postfixOps } import scala.reflect.runtime.universe._ object r { diff --git a/test/files/run/reify_ann1b.check b/test/files/run/reify_ann1b.check index bc046a7455..a046dafeab 100644 --- a/test/files/run/reify_ann1b.check +++ b/test/files/run/reify_ann1b.check @@ -1,3 +1,8 @@ +reify_ann1b.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String) extends annotation.ClassfileAnnotation + ^ { @new ann(bar = "1a") @new ann(bar = "1b") class C[@new ann(bar = "2a") @new ann(bar = "2b") T] extends AnyRef { @new ann(bar = "3a") @new ann(bar = "3b") <paramaccessor> private[this] val x: T @ann(bar = "4a") @ann(bar = "4b") = _; diff --git a/test/files/run/reify_classfileann_a.check b/test/files/run/reify_classfileann_a.check index 0c919020a8..51f255b232 100644 --- a/test/files/run/reify_classfileann_a.check +++ b/test/files/run/reify_classfileann_a.check @@ -1,3 +1,8 @@ +reify_classfileann_a.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation + ^ { @new ann(bar = "1", quux = Array("2", "3"), baz = new ann(bar = "4")) class C extends AnyRef { def <init>() = { diff --git a/test/files/run/reify_classfileann_b.check b/test/files/run/reify_classfileann_b.check index c204fa8dc0..05f2e5bfc6 100644 --- a/test/files/run/reify_classfileann_b.check +++ b/test/files/run/reify_classfileann_b.check @@ -1,3 +1,8 @@ +reify_classfileann_b.scala:6: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class ann(bar: String, quux: Array[String] = Array(), baz: ann = null) extends annotation.ClassfileAnnotation + ^ { class C extends AnyRef { def <init>() = { diff --git a/test/files/run/reify_extendbuiltins.scala b/test/files/run/reify_extendbuiltins.scala index a2d546579d..46d5b7e55e 100644 --- a/test/files/run/reify_extendbuiltins.scala +++ b/test/files/run/reify_extendbuiltins.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions, postfixOps } import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval @@ -12,4 +14,4 @@ object Test extends App { println("10! = " + (10!)) }.eval -}
\ No newline at end of file +} diff --git a/test/files/run/reify_implicits-new.scala b/test/files/run/reify_implicits-new.scala index 42a1deef26..1d90d907ea 100644 --- a/test/files/run/reify_implicits-new.scala +++ b/test/files/run/reify_implicits-new.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions, reflectiveCalls } import scala.reflect.{ClassTag, classTag} import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval @@ -13,4 +15,4 @@ object Test extends App { val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) }.eval -}
\ No newline at end of file +} diff --git a/test/files/run/reify_implicits-old.scala b/test/files/run/reify_implicits-old.scala index 8ff256d2d4..a4e90488e5 100644 --- a/test/files/run/reify_implicits-old.scala +++ b/test/files/run/reify_implicits-old.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions, reflectiveCalls } import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval @@ -12,4 +14,4 @@ object Test extends App { val x = Array(2, 3, 1, 4) println("x = "+ x.sort((x: Int, y: Int) => x < y).toList) }.eval -}
\ No newline at end of file +} diff --git a/test/files/run/reify_lazyevaluation.scala b/test/files/run/reify_lazyevaluation.scala index 5b310d95f7..3f2530ddee 100644 --- a/test/files/run/reify_lazyevaluation.scala +++ b/test/files/run/reify_lazyevaluation.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions } import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval diff --git a/test/files/run/reify_lazyunit.check b/test/files/run/reify_lazyunit.check index 1b46c909be..579ecfe8aa 100644 --- a/test/files/run/reify_lazyunit.check +++ b/test/files/run/reify_lazyunit.check @@ -1,3 +1,6 @@ +reify_lazyunit.scala:6: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + lazy val x = { 0; println("12")} + ^ 12 one two diff --git a/test/files/run/reify_printf.check b/test/files/run/reify_printf.check index e69de29bb2..3b18e512db 100644 --- a/test/files/run/reify_printf.check +++ b/test/files/run/reify_printf.check @@ -0,0 +1 @@ +hello world diff --git a/test/files/run/reify_printf.scala b/test/files/run/reify_printf.scala index 9932a58dfa..c4ade79837 100644 --- a/test/files/run/reify_printf.scala +++ b/test/files/run/reify_printf.scala @@ -9,13 +9,13 @@ import scala.reflect.internal.Types import scala.util.matching.Regex object Test extends App { - val output = new ByteArrayOutputStream() - Console.setOut(new PrintStream(output)) + //val output = new ByteArrayOutputStream() + //Console.setOut(new PrintStream(output)) val toolbox = cm.mkToolBox() val tree = tree_printf(reify("hello %s").tree, reify("world").tree) val evaluated = toolbox.eval(tree) - assert(output.toString() == "hello world", output.toString() +" == hello world") + //assert(output.toString() == "hello world", output.toString() +" == hello world") /* // upd. Oh, good old times, our very-very first experiments with macros :) @@ -68,4 +68,4 @@ object Test extends App { ): Tree Block((evals ++ prints).toList, Literal(Constant(()))) } -}
\ No newline at end of file +} diff --git a/test/files/run/repl-backticks.scala b/test/files/run/repl-backticks.scala index 5eaa1ec4c1..ec2691d9c5 100644 --- a/test/files/run/repl-backticks.scala +++ b/test/files/run/repl-backticks.scala @@ -8,7 +8,7 @@ object Test { `yield` </code>.text - def main(args: Array[String]) = { + def main(args: Array[String]) { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") val repl = new interpreter.IMain(settings) diff --git a/test/files/run/resetattrs-this.scala b/test/files/run/resetattrs-this.scala index 12afa3d712..2a55437273 100644 --- a/test/files/run/resetattrs-this.scala +++ b/test/files/run/resetattrs-this.scala @@ -4,8 +4,8 @@ import scala.tools.reflect.ToolBox object Test extends App { val tb = cm.mkToolBox() - val tree = Select(This(cm.staticPackage("scala").moduleClass), newTermName("Predef")) + val tree = Select(This(cm.staticPackage("scala").moduleClass), TermName("Predef")) val ttree = tb.typeCheck(tree) val rttree = tb.resetAllAttrs(ttree) println(tb.eval(rttree) == Predef) -}
\ No newline at end of file +} diff --git a/test/files/run/richs.scala b/test/files/run/richs.scala index 5ee573673d..4b5345757c 100644 --- a/test/files/run/richs.scala +++ b/test/files/run/richs.scala @@ -11,8 +11,8 @@ trait RichTest { val cn = this.getClass().getName() cn.substring(0, cn.length-1) } - def length[A](it: Iterator[A]) = it.toList length - def length[A](it: Iterable[A]) = it.toList length + def length[A](it: Iterator[A]) = it.toList.length + def length[A](it: Iterable[A]) = it.toList.length def run: Unit } object RichCharTest1 extends RichTest { diff --git a/test/files/run/runtime.check b/test/files/run/runtime.check index 990a087da0..d613c9bd42 100644 --- a/test/files/run/runtime.check +++ b/test/files/run/runtime.check @@ -1,3 +1,9 @@ +runtime.scala:141: warning: comparing values of types Null and Null using `eq' will always yield true + check(true , null eq null, null ne null); + ^ +runtime.scala:141: warning: comparing values of types Null and Null using `ne' will always yield false + check(true , null eq null, null ne null); + ^ <<< Test0 [false,true] [0,1,2] diff --git a/test/files/run/runtime.scala b/test/files/run/runtime.scala index a2ac204e8a..89348b294d 100644 --- a/test/files/run/runtime.scala +++ b/test/files/run/runtime.scala @@ -171,7 +171,7 @@ object Test { try { test; } catch { - case exception => { + case exception: Throwable => { //val name: String = Thread.currentThread().getName(); Console.print("Exception in thread \"" + name + "\" " + exception); Console.println; diff --git a/test/files/run/sequenceComparisons.scala b/test/files/run/sequenceComparisons.scala index 5d7958bc7e..f8ef17d77d 100644 --- a/test/files/run/sequenceComparisons.scala +++ b/test/files/run/sequenceComparisons.scala @@ -82,7 +82,7 @@ object Test { val sameElementsInputs = ( List(List(1,2,3,4,5)), - List(Nil, List(1), List(1,2), List(2,3,4), List(2,3,4,5), List(2,3,4,5,1), List(1,2,3,5,4), seq reverse) + List(Nil, List(1), List(1,2), List(2,3,4), List(2,3,4,5), List(2,3,4,5,1), List(1,2,3,5,4), seq.reverse) ) } diff --git a/test/files/run/settings-parse.scala b/test/files/run/settings-parse.scala index 2b04f55b24..2754feb972 100644 --- a/test/files/run/settings-parse.scala +++ b/test/files/run/settings-parse.scala @@ -1,3 +1,5 @@ + +import scala.language.postfixOps import scala.tools.nsc._ object Test { diff --git a/test/files/run/si5045.scala b/test/files/run/si5045.scala index e198b101f3..b0c3a4ddc4 100644 --- a/test/files/run/si5045.scala +++ b/test/files/run/si5045.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + object Test extends App { import scala.util.matching.{ Regex, UnanchoredRegex } diff --git a/test/files/run/slices.scala b/test/files/run/slices.scala index e31ea4046f..107b8e658a 100644 --- a/test/files/run/slices.scala +++ b/test/files/run/slices.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + object Test extends App { // lists diff --git a/test/files/run/spec-nlreturn.scala b/test/files/run/spec-nlreturn.scala index ec5e7229d3..a84160ecca 100644 --- a/test/files/run/spec-nlreturn.scala +++ b/test/files/run/spec-nlreturn.scala @@ -1,7 +1,8 @@ + object Test { def f(): Int = { try { - val g = 1 to 10 map { i => return 16 ; i } sum; + val g = (1 to 10 map { i => return 16 ; i }).sum g } catch { case x: runtime.NonLocalReturnControl[_] => diff --git a/test/files/run/stream_flatmap_odds.scala b/test/files/run/stream_flatmap_odds.scala index 6fb202ca68..1935253595 100644 --- a/test/files/run/stream_flatmap_odds.scala +++ b/test/files/run/stream_flatmap_odds.scala @@ -1,4 +1,4 @@ object Test extends App { lazy val odds: Stream[Int] = Stream(1) append ( odds flatMap {x => Stream(x + 2)} ) - println(odds take 42 force) + Console println (odds take 42).force } diff --git a/test/files/run/stringbuilder-drop.scala b/test/files/run/stringbuilder-drop.scala index a9e5a71762..422fb2bc7c 100644 --- a/test/files/run/stringbuilder-drop.scala +++ b/test/files/run/stringbuilder-drop.scala @@ -1,7 +1,7 @@ object Test { def main(args: Array[String]): Unit = { - val s = (new StringBuilder ++= "hello world") dropRight 1 toString; - assert(s == "hello worl") + val s = (new StringBuilder ++= "hello world") dropRight 1 + assert("" + s == "hello worl") } } diff --git a/test/files/run/stringbuilder.scala b/test/files/run/stringbuilder.scala index ef85fc02a6..a88ea38b92 100644 --- a/test/files/run/stringbuilder.scala +++ b/test/files/run/stringbuilder.scala @@ -1,3 +1,6 @@ + +import scala.language.reflectiveCalls + object Test extends App { val str = "ABCDEFGHIJKLMABCDEFGHIJKLM" val surrogateStr = "an old Turkic letter: \uD803\uDC22" @@ -33,8 +36,8 @@ object Test extends App { sameAnswers(_.lastIndexOf("KLM", 22)) // testing that the "reverse" implementation avoids reversing surrogate pairs - val jsb = new JavaStringBuilder(surrogateStr) reverse - val ssb = new ScalaStringBuilder(surrogateStr) reverseContents ; + val jsb = new JavaStringBuilder(surrogateStr).reverse + val ssb = new ScalaStringBuilder(surrogateStr).reverseContents assert(jsb.toString == ssb.toString) } diff --git a/test/files/run/stringinterpolation_macro-run.scala b/test/files/run/stringinterpolation_macro-run.scala index 9c59c334f8..1138cd0860 100644 --- a/test/files/run/stringinterpolation_macro-run.scala +++ b/test/files/run/stringinterpolation_macro-run.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ object Test extends App { // 'b' / 'B' (category: general) diff --git a/test/files/run/structural.scala b/test/files/run/structural.scala index 3a703d2cf1..2788717ec2 100644 --- a/test/files/run/structural.scala +++ b/test/files/run/structural.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + object test1 { val o1 = new Object { override def toString = "ohone" } @@ -164,7 +167,7 @@ object test3 { } catch { case e: Exc => println("caught") - case e => println(e) + case e: Throwable => println(e) } m(Rec) diff --git a/test/files/run/synchronized.check b/test/files/run/synchronized.check index dd9f4ef424..6e99739633 100644 --- a/test/files/run/synchronized.check +++ b/test/files/run/synchronized.check @@ -1,3 +1,4 @@ +warning: there were 14 inliner warning(s); re-run with -Yinline-warnings for details .|. c1.f1: OK .|. c1.fi: OK .|... c1.fv: OK diff --git a/test/files/run/synchronized.flags b/test/files/run/synchronized.flags index 1182725e86..49d036a887 100644 --- a/test/files/run/synchronized.flags +++ b/test/files/run/synchronized.flags @@ -1 +1 @@ --optimize
\ No newline at end of file +-optimize diff --git a/test/files/run/t0325.scala b/test/files/run/t0325.scala index 92331ab05f..048303206c 100644 --- a/test/files/run/t0325.scala +++ b/test/files/run/t0325.scala @@ -24,7 +24,7 @@ object Test { else println(ret) } catch { - case e@_ => println(which + " failed with " + e.getClass) + case e: Throwable => println(which + " failed with " + e.getClass) } } diff --git a/test/files/run/t0421-old.scala b/test/files/run/t0421-old.scala index 8d51013924..9b88b4789b 100644 --- a/test/files/run/t0421-old.scala +++ b/test/files/run/t0421-old.scala @@ -1,4 +1,6 @@ // ticket #421 + +@deprecated("Suppress warnings", since="2.11") object Test extends App { def transpose[A: ClassManifest](xss: Array[Array[A]]) = { diff --git a/test/files/run/t0432.scala b/test/files/run/t0432.scala index 8ba9015d81..b860a0874f 100644 --- a/test/files/run/t0432.scala +++ b/test/files/run/t0432.scala @@ -1,3 +1,6 @@ + +import scala.language.reflectiveCalls + object Test { type valueType = { def value: this.type } diff --git a/test/files/run/t0528.scala b/test/files/run/t0528.scala index a76f602ed3..68a9975173 100644 --- a/test/files/run/t0528.scala +++ b/test/files/run/t0528.scala @@ -1,3 +1,5 @@ + +import scala.language.{ existentials } trait Sequ[A] { def toArray: Array[T forSome {type T <: A}] } diff --git a/test/files/run/t0677-old.scala b/test/files/run/t0677-old.scala index 6c8a3a7e99..c0f1abae53 100644 --- a/test/files/run/t0677-old.scala +++ b/test/files/run/t0677-old.scala @@ -1,3 +1,6 @@ + + +@deprecated("Suppress warnings", since="2.11") object Test extends App { class X[T: ClassManifest] { val a = Array.ofDim[T](3, 4) diff --git a/test/files/run/t1005.scala b/test/files/run/t1005.scala index 60129bcc51..575ec43565 100644 --- a/test/files/run/t1005.scala +++ b/test/files/run/t1005.scala @@ -1,19 +1,20 @@ +import scala.language.postfixOps object Test { class Foo[T](x : Array[AnyRef]) { def bar = x.asInstanceOf[Array[T]] } class Bar[T](x : Array[T]) { def bar = x.asInstanceOf[Array[AnyRef]] } object FromMono{ - def main(args : Array[String]) = (new Foo[AnyRef](Array[AnyRef]("Halp!"))).bar + def mainer(args : Array[String]) = (new Foo[AnyRef](Array[AnyRef]("Halp!"))).bar } object FromPoly{ - def main(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar + def mainer(args : Array[String]) = (new Bar[AnyRef](Array[AnyRef]("Halp!"))).bar } def main(args: Array[String]): Unit = { - println(FromMono main null mkString) - println(FromPoly main null mkString) + println(FromMono mainer null mkString) + println(FromPoly mainer null mkString) } } diff --git a/test/files/run/t1110.scala b/test/files/run/t1110.scala index 824643868c..81917789c8 100644 --- a/test/files/run/t1110.scala +++ b/test/files/run/t1110.scala @@ -1,8 +1,12 @@ + + +import scala.language.{ reflectiveCalls } + class Stuff { def zoop(p: Any{def &(q: Int): Int}) = p & 7 def floop = new { def & = "Hello" } - assert((floop &) == "Hello") + assert((floop.&) == "Hello") assert(zoop(10) == 2) } diff --git a/test/files/run/t1141.scala b/test/files/run/t1141.scala index ee4f2e7fd2..b907b4798f 100644 --- a/test/files/run/t1141.scala +++ b/test/files/run/t1141.scala @@ -1,3 +1,7 @@ + + +import scala.language.reflectiveCalls + object Test extends App { val foo = new { def apply(args : String*) = args foreach println diff --git a/test/files/run/t1195-new.scala b/test/files/run/t1195-new.scala index 0f62b140c9..4f068c7d42 100644 --- a/test/files/run/t1195-new.scala +++ b/test/files/run/t1195-new.scala @@ -1,3 +1,5 @@ + +import scala.language.{ existentials } import scala.reflect.runtime.universe._ object Test { @@ -25,4 +27,4 @@ class A1[T] { class B1[U] { def f = { case class D(x: Int) extends A1[String] ; new D(5) } } -}
\ No newline at end of file +} diff --git a/test/files/run/t1195-old.scala b/test/files/run/t1195-old.scala index b46a3b70f5..f80734c228 100644 --- a/test/files/run/t1195-old.scala +++ b/test/files/run/t1195-old.scala @@ -1,3 +1,6 @@ + +import scala.language.{ existentials } + object Test { def f() = { case class Bar(x: Int); Bar } def g() = { case class Bar(x: Int); Bar(5) } diff --git a/test/files/run/t1368.check b/test/files/run/t1368.check new file mode 100644 index 0000000000..581e8a4039 --- /dev/null +++ b/test/files/run/t1368.check @@ -0,0 +1,3 @@ +t1368.scala:7: warning: Reference to uninitialized value blurp + def go3 = (new AnyRef with Happy with Sad { override val status = blurp ; val blurp = "happysad" }).status + ^ diff --git a/test/files/run/t1427.check b/test/files/run/t1427.check new file mode 100644 index 0000000000..11a3d2f4a9 --- /dev/null +++ b/test/files/run/t1427.check @@ -0,0 +1,3 @@ +t1427.scala:6: warning: abstract type X in type pattern Bob[_[_] <: Any] is unchecked since it is eliminated by erasure + case x: (Bob[X] forSome { type X[_] }) => true + ^ diff --git a/test/files/run/t1427.scala b/test/files/run/t1427.scala index 21bd71ffef..eeb2603c26 100644 --- a/test/files/run/t1427.scala +++ b/test/files/run/t1427.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds } + class Bob[K[_]] { def foo(other: Any) = other match { case x: (Bob[X] forSome { type X[_] }) => true diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala index 6d2e7ee05f..75a6e31cdf 100644 --- a/test/files/run/t1500.scala +++ b/test/files/run/t1500.scala @@ -16,7 +16,7 @@ object Test { </code>.text - def main(args: Array[String]) = { + def main(args: Array[String]) { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala index a2f7bb3a65..71ad0aeb5c 100644 --- a/test/files/run/t1501.scala +++ b/test/files/run/t1501.scala @@ -27,7 +27,7 @@ object Test { </code>.text - def main(args: Array[String]) = { + def main(args: Array[String]) { val settings = new Settings() settings.classpath.value = System.getProperty("java.class.path") val tool = new interpreter.IMain(settings) diff --git a/test/files/run/t153.scala b/test/files/run/t153.scala index 82492fdbe6..3fdb423865 100644 --- a/test/files/run/t153.scala +++ b/test/files/run/t153.scala @@ -1,5 +1,5 @@ object Test extends App { def powers(x: Int) = if ((x&(x-1))==0) Some(x) else None val res = (Stream.range(1, 500000) flatMap powers).reverse - println(res take 42 force) + println((res take 42).force) } diff --git a/test/files/run/t1766.scala b/test/files/run/t1766.scala index 2afd883755..7d12451092 100644 --- a/test/files/run/t1766.scala +++ b/test/files/run/t1766.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + object Test extends App { class C(s: String) { diff --git a/test/files/run/t2106.check b/test/files/run/t2106.check new file mode 100644 index 0000000000..b14e9d1c41 --- /dev/null +++ b/test/files/run/t2106.check @@ -0,0 +1,3 @@ +t2106.scala:7: warning: Could not inline required method foo because access level required by callee not matched by caller. + def main(args: Array[String]): Unit = x.foo + ^ diff --git a/test/files/run/t2106.flags b/test/files/run/t2106.flags index eb4d19bcb9..00d3643fd4 100644 --- a/test/files/run/t2106.flags +++ b/test/files/run/t2106.flags @@ -1 +1 @@ --optimise
\ No newline at end of file +-optimise -Yinline-warnings diff --git a/test/files/run/t2106.scala b/test/files/run/t2106.scala index e8124dabab..55b89da805 100644 --- a/test/files/run/t2106.scala +++ b/test/files/run/t2106.scala @@ -4,5 +4,5 @@ class A extends Cloneable { object Test { val x = new A - def main(args: Array[String]) = x.foo + def main(args: Array[String]): Unit = x.foo } diff --git a/test/files/run/t2308a.scala b/test/files/run/t2308a.scala index abb568064a..200dee1ef6 100644 --- a/test/files/run/t2308a.scala +++ b/test/files/run/t2308a.scala @@ -1,3 +1,5 @@ + +import scala.language.{ higherKinds } object Test { trait T[M[_]] diff --git a/test/files/run/t2318.scala b/test/files/run/t2318.scala index 47d083eb9d..d7fd9fdd41 100644 --- a/test/files/run/t2318.scala +++ b/test/files/run/t2318.scala @@ -1,5 +1,7 @@ import java.security._ +import scala.language.{ reflectiveCalls } + object Test { trait Bar { def bar: Unit } diff --git a/test/files/run/t2333.scala b/test/files/run/t2333.scala index da43386572..7dc7a92df2 100644 --- a/test/files/run/t2333.scala +++ b/test/files/run/t2333.scala @@ -1,7 +1,7 @@ class A { def whatever() { lazy val a = 1 - lazy val b = try { 2 } catch { case _ => 0 } + lazy val b = try { 2 } catch { case _: Throwable => 0 } a b @@ -13,4 +13,4 @@ object Test { val a = new A a.whatever } -}
\ No newline at end of file +} diff --git a/test/files/run/t2417.scala b/test/files/run/t2417.scala index 2d0bc2d405..18b6c326b5 100644 --- a/test/files/run/t2417.scala +++ b/test/files/run/t2417.scala @@ -8,7 +8,7 @@ object Test { try { block } catch { - case x => failure = x + case x: Throwable => failure = x } } }) diff --git a/test/files/run/t2514.scala b/test/files/run/t2514.scala index 21c4afb472..cf5fa0ea02 100644 --- a/test/files/run/t2514.scala +++ b/test/files/run/t2514.scala @@ -1,3 +1,7 @@ + + +import scala.language.{ implicitConversions, postfixOps, reflectiveCalls } + object Test { implicit def x[A](a: A) = new { def xx = a } @@ -12,4 +16,4 @@ object Test assert(r5 == 24) } -}
\ No newline at end of file +} diff --git a/test/files/run/t2594_tcpoly.scala b/test/files/run/t2594_tcpoly.scala index e759ca8b0f..a9d26693f9 100644 --- a/test/files/run/t2594_tcpoly.scala +++ b/test/files/run/t2594_tcpoly.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds } + trait Monad[M[_]] { def foo[A](a: M[A]): M[A] } @@ -15,4 +18,4 @@ object Test { } def main(as: Array[String]) { BarMonad[Int] foo (new Bar[Int, Int]) } -}
\ No newline at end of file +} diff --git a/test/files/run/t2636.scala b/test/files/run/t2636.scala index 3271f79ffc..6ae2248a26 100644 --- a/test/files/run/t2636.scala +++ b/test/files/run/t2636.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + object Test { type Foo = { def update(x: Int, value: String): Unit } @@ -32,4 +35,4 @@ object Test assert(arrApply(arr, 1) == "o") assert(arrApply(new { def apply(x: Int) = "tom" }, -100) == "tom") } -}
\ No newline at end of file +} diff --git a/test/files/run/t3038d.scala b/test/files/run/t3038d.scala index 9550165235..56cfcdb174 100644 --- a/test/files/run/t3038d.scala +++ b/test/files/run/t3038d.scala @@ -21,7 +21,7 @@ class Bar extends Foo with Serializable { def size = a @transient var second: Any = null - def checkMember { first } + def checkMember { if (first == null) print("") } private def writeObject(out: java.io.ObjectOutputStream) { serializeTo(out) diff --git a/test/files/run/t3050.scala b/test/files/run/t3050.scala index ca9d91e191..65b2674b69 100644 --- a/test/files/run/t3050.scala +++ b/test/files/run/t3050.scala @@ -2,7 +2,7 @@ object Test { def main(args: Array[String]): Unit = { val x = try { ("": Any) match { case List(_*) => true } } - catch { case _ => false } + catch { case _: Throwable => false } assert(!x) } diff --git a/test/files/run/t3175.scala b/test/files/run/t3175.scala index aff2e67d0d..5c6daead38 100644 --- a/test/files/run/t3175.scala +++ b/test/files/run/t3175.scala @@ -1,6 +1,9 @@ /** A bit down the road this test will examine * the bytecode. */ + +import scala.language.reflectiveCalls + object Test { def len(x:{ def length: Int }) = x.length def f1(x:{ def apply(x: Int): Long }) = x(0) diff --git a/test/files/run/t3232.scala b/test/files/run/t3232.scala index feff7e7089..4c6cb1e35c 100644 --- a/test/files/run/t3232.scala +++ b/test/files/run/t3232.scala @@ -15,7 +15,7 @@ object Test { // exception required List(e1, e2) foreach { f => try { f() ; assert(false) } - catch { case _ => () } + catch { case _: Throwable => () } } } } diff --git a/test/files/run/t3242.scala b/test/files/run/t3242.scala index f8defaa5cd..0a449d51f9 100644 --- a/test/files/run/t3242.scala +++ b/test/files/run/t3242.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds } + object Test { def benchmarkA(num: Int) { diff --git a/test/files/run/t3361.scala b/test/files/run/t3361.scala index 7fbc6777f2..f739d17b86 100644 --- a/test/files/run/t3361.scala +++ b/test/files/run/t3361.scala @@ -57,7 +57,7 @@ object Test extends App { DoubleLinkedList().insert(ten) } catch { case _: IllegalArgumentException => require(true) - case _ => require(false) + case _: Throwable => require(false) } val zero = DoubleLinkedList(0) zero.insert(ten) @@ -87,7 +87,7 @@ object Test extends App { DoubleLinkedList().append(ten) } catch { case _: IllegalArgumentException => require(true) - case _ => require(false) + case _: Throwable => require(false) } val zero = DoubleLinkedList(0) zero.append(ten) diff --git a/test/files/run/t3425.scala b/test/files/run/t3425.scala index 6505ee6e24..c61d1071a5 100644 --- a/test/files/run/t3425.scala +++ b/test/files/run/t3425.scala @@ -1,3 +1,4 @@ +import scala.language.reflectiveCalls object Other { abstract class Foo { type R1 <: { def x: Any } diff --git a/test/files/run/t3488.check b/test/files/run/t3488.check index 0d66ea1aee..314dfc7838 100644 --- a/test/files/run/t3488.check +++ b/test/files/run/t3488.check @@ -1,2 +1,8 @@ +t3488.scala:4: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + println(foo { val List(_*)=List(0); 1 } ()) + ^ +t3488.scala:5: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + println(foo { val List(_*)=List(0); 1 } (1)) + ^ 0 1 diff --git a/test/files/run/t3507-new.scala b/test/files/run/t3507-new.scala index f045755b8f..bd16849e8a 100644 --- a/test/files/run/t3507-new.scala +++ b/test/files/run/t3507-new.scala @@ -1,3 +1,5 @@ + +import scala.language.{ existentials } import scala.reflect.runtime.universe._ class A { @@ -14,4 +16,4 @@ object Test extends App { def mani[T: TypeTag](x: T) = println(typeOf[T]) mani/*[object _1.b.c]*/(c) // kaboom in manifestOfType / TreeGen.mkAttributedQualifier // --> _1 is not in scope here -}
\ No newline at end of file +} diff --git a/test/files/run/t3529.scala b/test/files/run/t3529.scala index bb82424bf6..a5977d0a6c 100644 --- a/test/files/run/t3529.scala +++ b/test/files/run/t3529.scala @@ -1,3 +1,4 @@ +import scala.language.postfixOps object Test { def main(args: Array[String]): Unit = { assert(1 to 10 drop 10 isEmpty) diff --git a/test/files/run/t3651.scala b/test/files/run/t3651.scala index 49ae173249..3a6dda0de3 100644 --- a/test/files/run/t3651.scala +++ b/test/files/run/t3651.scala @@ -5,6 +5,6 @@ class LongKlass( override val a: Long ) extends Klass[Long](a) object Test { def main(args: Array[String]) { val lk = new LongKlass(10) - lk.a + val a = lk.a } } diff --git a/test/files/run/t3705.scala b/test/files/run/t3705.scala index fcc020f28c..3ebf6fc95d 100644 --- a/test/files/run/t3705.scala +++ b/test/files/run/t3705.scala @@ -2,16 +2,16 @@ import scala.xml._ object Test { + // guard caused verifyerror in oldpatmat def updateNodes(ns: Seq[Node]): Seq[Node] = for(subnode <- ns) yield subnode match { case <d>{_}</d> if true => <d>abc</d> case Elem(prefix, label, attribs, scope, children @ _*) => - Elem(prefix, label, attribs, scope, updateNodes(children) : _*) + Elem(prefix, label, attribs, scope, minimizeEmpty = true, updateNodes(children) : _*) case other => other } def main(args: Array[String]): Unit = { updateNodes(<b />) - } } diff --git a/test/files/run/t3758-old.scala b/test/files/run/t3758-old.scala index f00254afee..d5e4a6cc1c 100644 --- a/test/files/run/t3758-old.scala +++ b/test/files/run/t3758-old.scala @@ -1,3 +1,5 @@ + +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]): Unit = { assert(classManifest[Array[String]].typeArguments contains classManifest[String]) @@ -7,4 +9,4 @@ object Test { assert(manifest[Array[Int]].typeArguments contains manifest[Int]) assert(manifest[Array[Float]].typeArguments contains manifest[Float]) } -}
\ No newline at end of file +} diff --git a/test/files/run/t3855.scala b/test/files/run/t3855.scala index e55714201f..d8029e16f0 100644 --- a/test/files/run/t3855.scala +++ b/test/files/run/t3855.scala @@ -3,11 +3,11 @@ object Test { def closure[A](f: () => A) = f() def f1(s: String) = { - var n = try { s.toInt } catch { case _ => 1 } + var n = try { s.toInt } catch { case _: Throwable => 1 } byval(n) } def f2(s: String) = { - var n = try { s.toInt } catch { case _ => 1 } + var n = try { s.toInt } catch { case _: Throwable => 1 } closure(() => n) } diff --git a/test/files/run/t3888.check b/test/files/run/t3888.check new file mode 100644 index 0000000000..844ca54682 --- /dev/null +++ b/test/files/run/t3888.check @@ -0,0 +1 @@ +warning: there were 1 deprecation warning(s); re-run with -deprecation for details diff --git a/test/files/run/t3888.scala b/test/files/run/t3888.scala index e0f1453b1d..1914072599 100644 --- a/test/files/run/t3888.scala +++ b/test/files/run/t3888.scala @@ -1,3 +1,6 @@ + +// in a match, which notion of equals prevails? +// extending Tuple doesn't seem to be at issue here. object Test { val T1 = new P @@ -23,4 +26,4 @@ object Test { class P extends Pair(1, 1) { override def equals(x: Any) = true -}
\ No newline at end of file +} diff --git a/test/files/run/t3935.scala b/test/files/run/t3935.scala index c66b1b0599..fa1bbf8d3f 100644 --- a/test/files/run/t3935.scala +++ b/test/files/run/t3935.scala @@ -9,7 +9,7 @@ object Test { try { assert(q.front != null) } catch { - case _ => + case _: Throwable => } } } diff --git a/test/files/run/t3964.scala b/test/files/run/t3964.scala index 80ba361a20..68ff9a44c4 100644 --- a/test/files/run/t3964.scala +++ b/test/files/run/t3964.scala @@ -1,3 +1,6 @@ + +import scala.language.implicitConversions + object Test { class Base object Bob extends Base diff --git a/test/files/run/t4047.check b/test/files/run/t4047.check index 2a942a70e0..3c41e6e244 100644 --- a/test/files/run/t4047.check +++ b/test/files/run/t4047.check @@ -1,3 +1,15 @@ +t4047.scala:23: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + a.foo + ^ +t4047.scala:24: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + a.foo + ^ +t4047.scala:26: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + b.foo + ^ +t4047.scala:27: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + b.foo + ^ Unit: called A.foo Unit: called B.foo Unit: called C.foo diff --git a/test/files/run/t4072.scala b/test/files/run/t4072.scala index 872072a4ce..bff2e0c7d2 100644 --- a/test/files/run/t4072.scala +++ b/test/files/run/t4072.scala @@ -1,5 +1,7 @@ import scala.tools.nsc._ +import scala.language.{ reflectiveCalls } + object Test { class DryRun { val compiler = new Global(new Settings()) { diff --git a/test/files/run/t4080.scala b/test/files/run/t4080.scala index 92740ed776..1d1418847d 100644 --- a/test/files/run/t4080.scala +++ b/test/files/run/t4080.scala @@ -1,4 +1,5 @@ import scala.collection.mutable.LinkedList +import java.util.NoSuchElementException object Test { def main(args: Array[String]) { @@ -6,7 +7,7 @@ object Test { ll.insert(LinkedList(0)) println(ll) val ll2 = LinkedList[Int]() - try println(ll2.head) - catch { case _ => () } + try println("Empty head? " + ll2.head) + catch { case _: NoSuchElementException => () } } } diff --git a/test/files/run/t4148.scala b/test/files/run/t4148.scala index 0739403594..6de0c8fe7a 100644 --- a/test/files/run/t4148.scala +++ b/test/files/run/t4148.scala @@ -1,7 +1,7 @@ object Test { - val x1 = try { "aaa".asInstanceOf[Int] } catch { case _ => "cce1" } - val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _ => "cce2" } - val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _ => "cce3" } + val x1 = try { "aaa".asInstanceOf[Int] } catch { case _: Throwable => "cce1" } + val x2 = try { (5: Any).asInstanceOf[Int] } catch { case _: Throwable => "cce2" } + val x3 = try { (new java.lang.Short(100.toShort).asInstanceOf[Int]) } catch { case _: Throwable => "cce3" } def main(args: Array[String]): Unit = { List(x1, x2, x3) foreach println diff --git a/test/files/run/t4171.scala b/test/files/run/t4171.scala index fba2fb5ed6..7f6dfd48ce 100644 --- a/test/files/run/t4171.scala +++ b/test/files/run/t4171.scala @@ -1,3 +1,6 @@ + +import scala.language.{ reflectiveCalls } + object Test { val c = { class C; new C { def foo = 1 } } val a = { class B { def bar = 5 }; class C extends B; new C } diff --git a/test/files/run/t4398.scala b/test/files/run/t4398.scala index 1d57eb688d..87dc870afc 100644 --- a/test/files/run/t4398.scala +++ b/test/files/run/t4398.scala @@ -1,5 +1,7 @@ +import scala.language.{ postfixOps } + object Test { def main(args: Array[String]) { val x = 1 to 10 toSet diff --git a/test/files/run/t4560.scala b/test/files/run/t4560.scala index 9979199067..ee657e47eb 100644 --- a/test/files/run/t4560.scala +++ b/test/files/run/t4560.scala @@ -7,6 +7,9 @@ // TEST 1 // self-type is other trait + +import scala.language.{ reflectiveCalls } + trait Aa trait Ab diff --git a/test/files/run/t4660.scala b/test/files/run/t4660.scala index e57bb4bf25..9aac10ddfd 100644 --- a/test/files/run/t4660.scala +++ b/test/files/run/t4660.scala @@ -3,7 +3,7 @@ object Test { val traversable = 1 to 20 map (_.toString) def normalize(m: Map[Char, Traversable[String]]) = m.map { case (k,v) => (k, v.toList) } - val groupedFromView = (traversable view).groupBy(_(0)) + val groupedFromView = traversable.view.groupBy(_(0)) val groupedFromStrict = traversable.groupBy(_(0)) assert(normalize(groupedFromView) == normalize(groupedFromStrict)) diff --git a/test/files/run/t4680.check b/test/files/run/t4680.check index b5cfc651f2..b2e5209dc5 100644 --- a/test/files/run/t4680.check +++ b/test/files/run/t4680.check @@ -1,3 +1,9 @@ +t4680.scala:51: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + new C { 5 } + ^ +t4680.scala:69: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + new { val x = 5 } with E() { 5 } + ^ // new C { } diff --git a/test/files/run/t4729/S_2.scala b/test/files/run/t4729/S_2.scala index a80afb0257..f823433ded 100644 --- a/test/files/run/t4729/S_2.scala +++ b/test/files/run/t4729/S_2.scala @@ -1,3 +1,4 @@ +import scala.language.reflectiveCalls // Scala class: class ScalaVarArgs extends J_1 { // -- no problem on overriding it using ordinary class diff --git a/test/files/run/t4766.scala b/test/files/run/t4766.scala index c2a864ddb2..d67431f50e 100644 --- a/test/files/run/t4766.scala +++ b/test/files/run/t4766.scala @@ -1,3 +1,7 @@ + +import scala.language.postfixOps +import scala.language.reflectiveCalls + object Test extends App { val x = new { def > = 1 diff --git a/test/files/run/t4777.scala b/test/files/run/t4777.scala index 4a811d3b9a..6c7b856e39 100644 --- a/test/files/run/t4777.scala +++ b/test/files/run/t4777.scala @@ -3,6 +3,6 @@ class DefaultsTest(x: Int = 25) extends A(28) object DefaultsTest extends DefaultsTest(12) object Test extends App { - println(new DefaultsTest() a) - println(DefaultsTest a) + println(new DefaultsTest().a) + println(DefaultsTest.a) } diff --git a/test/files/run/t4794.scala b/test/files/run/t4794.scala index afe89fa429..720906f507 100644 --- a/test/files/run/t4794.scala +++ b/test/files/run/t4794.scala @@ -7,6 +7,7 @@ class Arr[@specialized A](val arr: Array[A]) { object Test { def main(args: Array[String]): Unit = { - println(classOf[Arr[_]].getMethods filter (_.getName contains "quux") size) // expect 10, not 1 + def quuxae = classOf[Arr[_]].getMethods filter (_.getName contains "quux") + println(quuxae.size) // expect 10, not 1 } } diff --git a/test/files/run/t4929.scala b/test/files/run/t4929.scala index 3208cd1b09..1b0e8672d5 100644 --- a/test/files/run/t4929.scala +++ b/test/files/run/t4929.scala @@ -2,6 +2,7 @@ import scala.util.parsing.json._ import java.util.concurrent._ import collection.JavaConversions._ +@deprecated("Suppress warnings", since="2.11") object Test extends App { val LIMIT = 2000 diff --git a/test/files/run/t498.scala b/test/files/run/t498.scala index b4ede951f0..5c10e6630f 100644 --- a/test/files/run/t498.scala +++ b/test/files/run/t498.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + object Test extends App { // the function passed to flatMap produces lots of empty streams, but this should not overflow the stack val res = Stream.from(1).flatMap(i => if (i < 3000) Stream.empty else List(1)) diff --git a/test/files/run/t5053.scala b/test/files/run/t5053.scala index e46dad5ac6..233edf6780 100644 --- a/test/files/run/t5053.scala +++ b/test/files/run/t5053.scala @@ -1,3 +1,6 @@ + +import scala.language.{ existentials } + object Test extends App { { val (left, right) = Seq((1, "a"), (1, "a"), (1, "a"), (3, "c")).view.unzip diff --git a/test/files/run/t5080.scala b/test/files/run/t5080.scala index ce72d13a54..acb6167f46 100644 --- a/test/files/run/t5080.scala +++ b/test/files/run/t5080.scala @@ -1,3 +1,7 @@ + +import scala.language.implicitConversions +import scala.language.reflectiveCalls + object Test extends App { abstract class Value { diff --git a/test/files/run/t5224.check b/test/files/run/t5224.check index e15c1c90eb..b11480acdf 100644 --- a/test/files/run/t5224.check +++ b/test/files/run/t5224.check @@ -1,3 +1,8 @@ +t5224.scala:3: warning: Implementation restriction: subclassing Classfile does not +make your annotation visible at runtime. If that is what +you want, you must write the annotation class in Java. +class Foo(bar: String) extends annotation.ClassfileAnnotation + ^ { @new Foo(bar = "qwe") class C extends AnyRef { def <init>() = { diff --git a/test/files/run/t5277_1.scala b/test/files/run/t5277_1.scala index a2d546579d..65232967c2 100644 --- a/test/files/run/t5277_1.scala +++ b/test/files/run/t5277_1.scala @@ -1,6 +1,7 @@ import scala.reflect.runtime.universe._ import scala.tools.reflect.Eval +import scala.language.{ implicitConversions, postfixOps } object Test extends App { reify { def fact(n: Int): BigInt = @@ -12,4 +13,4 @@ object Test extends App { println("10! = " + (10!)) }.eval -}
\ No newline at end of file +} diff --git a/test/files/run/t5284b.check b/test/files/run/t5284b.check index 98d9bcb75a..71426ad0b7 100644 --- a/test/files/run/t5284b.check +++ b/test/files/run/t5284b.check @@ -1 +1,4 @@ +t5284b.scala:27: warning: type S is unused or used in non-specializable positions. + def bar[@specialized(Int) W <: T, @specialized(Int) S](w: W) = id(w) + ^ 17 diff --git a/test/files/run/t5284c.check b/test/files/run/t5284c.check index 00750edc07..cf578ad102 100644 --- a/test/files/run/t5284c.check +++ b/test/files/run/t5284c.check @@ -1 +1,4 @@ +t5284c.scala:29: warning: type W is unused or used in non-specializable positions. + def bar[@specialized(Int) W <: T](ws: List[W]) = len(ws) + ^ 3 diff --git a/test/files/run/t5353.scala b/test/files/run/t5353.scala deleted file mode 100644 index 5208fe527f..0000000000 --- a/test/files/run/t5353.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test extends App { - def f(x: Boolean) = if (x) Array("abc") else Array() - try { - println(f(true).length) - println(f(false).length) - } catch { - case ex: Throwable => println(ex.getMessage) - } -} diff --git a/test/files/run/t5356.scala b/test/files/run/t5356.scala index ec17e036ad..dabb9ef855 100644 --- a/test/files/run/t5356.scala +++ b/test/files/run/t5356.scala @@ -1,3 +1,5 @@ + +import scala.language.{ reflectiveCalls } object Test { def f(x: Any { def toInt: Int }) = println(x.toInt + " " + x.getClass.getName) diff --git a/test/files/run/t5375.scala b/test/files/run/t5375.scala index e4b329deae..fa5932ff89 100644 --- a/test/files/run/t5375.scala +++ b/test/files/run/t5375.scala @@ -8,7 +8,7 @@ import collection.parallel.CompositeThrowable object Test { def main(args: Array[String]) { - val foos = (1 to 1000) toSeq; + val foos = (1 to 1000).toSeq try { foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i) } catch { diff --git a/test/files/run/t5380.check b/test/files/run/t5380.check new file mode 100644 index 0000000000..731a798301 --- /dev/null +++ b/test/files/run/t5380.check @@ -0,0 +1,9 @@ +t5380.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + val f = () => return try { 1 } catch { case _: Throwable => 0 } + ^ +t5380.scala:3: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + val f = () => return try { 1 } catch { case _: Throwable => 0 } + ^ +t5380.scala:3: warning: enclosing method main has result type Unit: return value discarded + val f = () => return try { 1 } catch { case _: Throwable => 0 } + ^ diff --git a/test/files/run/t5380.scala b/test/files/run/t5380.scala index 6083161a9b..66d12a0ca6 100644 --- a/test/files/run/t5380.scala +++ b/test/files/run/t5380.scala @@ -1,6 +1,6 @@ object Test { def main(args: Array[String]) { - val f = () => return try { 1 } catch { case _ => 0 } + val f = () => return try { 1 } catch { case _: Throwable => 0 } f() } } diff --git a/test/files/run/t5428.scala b/test/files/run/t5428.scala index 106bb7fc31..fb58cbbe24 100644 --- a/test/files/run/t5428.scala +++ b/test/files/run/t5428.scala @@ -23,7 +23,7 @@ object Test { println(a) - a pop + a.pop } } diff --git a/test/files/run/t5568.flags b/test/files/run/t5568.flags new file mode 100644 index 0000000000..ad51758c39 --- /dev/null +++ b/test/files/run/t5568.flags @@ -0,0 +1 @@ +-nowarn diff --git a/test/files/run/t5629b.scala b/test/files/run/t5629b.scala index 6c908081b9..adb9ca5498 100644 --- a/test/files/run/t5629b.scala +++ b/test/files/run/t5629b.scala @@ -33,7 +33,7 @@ object Test extends App { val pf = newPF(1) println("=== pf(1):") - try { pf(1) } catch { case x => println(x) } + try { pf(1) } catch { case x: Throwable => println(x) } println("=== pf(42):") pf(42) println("=== done") diff --git a/test/files/run/t5699.scala b/test/files/run/t5699.scala index 5cef67e3b1..ec3b1d26b4 100755 --- a/test/files/run/t5699.scala +++ b/test/files/run/t5699.scala @@ -1,5 +1,5 @@ import scala.tools.partest.DirectTest -import scala.tools.nsc.util.BatchSourceFile +import scala.reflect.internal.util.BatchSourceFile object Test extends DirectTest { // Java code diff --git a/test/files/run/t576.scala b/test/files/run/t576.scala index 756a241572..5c8c9a90cb 100644 --- a/test/files/run/t576.scala +++ b/test/files/run/t576.scala @@ -1,3 +1,5 @@ +import scala.language.reflectiveCalls + class A { override def equals(other: Any) = other match { case _: this.type => true diff --git a/test/files/run/t5881.scala b/test/files/run/t5881.scala index 01bee29181..04b24b713d 100644 --- a/test/files/run/t5881.scala +++ b/test/files/run/t5881.scala @@ -1,6 +1,7 @@ +import scala.language.existentials import scala.reflect.ClassTag object Test extends App { println(implicitly[ClassTag[List[T forSome {type T <: List[T]}]]]) println(implicitly[ClassTag[List[Any]]]) -}
\ No newline at end of file +} diff --git a/test/files/run/t5912.scala b/test/files/run/t5912.scala index 7710d04396..9418e946d0 100644 --- a/test/files/run/t5912.scala +++ b/test/files/run/t5912.scala @@ -1,6 +1,7 @@ +import scala.language.existentials object Test extends App{ import scala.reflect.runtime.{currentMirror=>cm} import scala.tools.reflect._ import scala.reflect.runtime.universe._ val tree = cm.mkToolBox().typeCheck( Literal(Constant("test")) ) -}
\ No newline at end of file +} diff --git a/test/files/run/t5942.scala b/test/files/run/t5942.scala index 44a8be93f6..c90d29e1ca 100644 --- a/test/files/run/t5942.scala +++ b/test/files/run/t5942.scala @@ -5,6 +5,6 @@ import scala.tools.reflect._ object Test extends App { val tb = cm.mkToolBox() tb.parse("def x = {}") - try { tb.parse("def x = {") } catch { case _ => } + try { tb.parse("def x = {") } catch { case _: Throwable => } tb.parse("def x = {}") } diff --git a/test/files/run/t6011c.check b/test/files/run/t6011c.check new file mode 100644 index 0000000000..088e6fdaae --- /dev/null +++ b/test/files/run/t6011c.check @@ -0,0 +1,3 @@ +t6011c.scala:11: warning: unreachable code + case 1 => 3 // crash + ^ diff --git a/test/files/run/t603.scala b/test/files/run/t603.scala index b8825c933b..54fb8e6974 100644 --- a/test/files/run/t603.scala +++ b/test/files/run/t603.scala @@ -1,4 +1,6 @@ object forceDelay { + import scala.language.implicitConversions + class Susp[+A](lazyValue: => A) extends Function0[A] { private var func: () => Any = () => lazyValue private var value: Any = null diff --git a/test/files/run/t6102.check b/test/files/run/t6102.check index b6fc4c620b..97e455647b 100644 --- a/test/files/run/t6102.check +++ b/test/files/run/t6102.check @@ -1 +1,29 @@ -hello
\ No newline at end of file +[running phase parser on t6102.scala] +[running phase namer on t6102.scala] +[running phase packageobjects on t6102.scala] +[running phase typer on t6102.scala] +[running phase patmat on t6102.scala] +[running phase superaccessors on t6102.scala] +[running phase extmethods on t6102.scala] +[running phase pickler on t6102.scala] +[running phase refchecks on t6102.scala] +[running phase uncurry on t6102.scala] +[running phase tailcalls on t6102.scala] +[running phase specialize on t6102.scala] +[running phase explicitouter on t6102.scala] +[running phase erasure on t6102.scala] +[running phase posterasure on t6102.scala] +[running phase lazyvals on t6102.scala] +[running phase lambdalift on t6102.scala] +[running phase constructors on t6102.scala] +[running phase flatten on t6102.scala] +[running phase mixin on t6102.scala] +[running phase cleanup on t6102.scala] +[running phase icode on t6102.scala] +[running phase inliner on t6102.scala] +[running phase inlinehandlers on t6102.scala] +[running phase closelim on t6102.scala] +[running phase constopt on t6102.scala] +[running phase dce on t6102.scala] +[running phase jvm on icode] +hello diff --git a/test/files/run/t6113.scala b/test/files/run/t6113.scala index 321cae86a3..b77a56029a 100644 --- a/test/files/run/t6113.scala +++ b/test/files/run/t6113.scala @@ -1,6 +1,8 @@ +import scala.language.higherKinds + trait Foo[C[_]] object Test extends App { import scala.reflect.runtime.universe._ println(typeOf[Foo[({type l[X] = (Int, X)})#l]]) -}
\ No newline at end of file +} diff --git a/test/files/run/t6146b.check b/test/files/run/t6146b.check index 49ff70697e..2333b9d986 100644 --- a/test/files/run/t6146b.check +++ b/test/files/run/t6146b.check @@ -1,3 +1,7 @@ +t6146b.scala:15: warning: match may not be exhaustive. +It would fail on the following inputs: S2(), S3() + def foo(f: F[Int]) = f match { case X.S1 => } + ^ Type in expressions to have them evaluated. Type :help for more information. diff --git a/test/files/run/t6246.scala b/test/files/run/t6246.scala index 28765e1adf..2db87aa6d2 100644 --- a/test/files/run/t6246.scala +++ b/test/files/run/t6246.scala @@ -1,5 +1,6 @@ import scala.reflect.{ClassTag, classTag} +@deprecated("Suppress warnings", since="2.11") object Test extends App { def testValueClass(tag: ClassTag[_]) { println(s"runtimeClass = ${tag.runtimeClass}, toString = ${tag.toString}") @@ -23,4 +24,4 @@ object Test extends App { testValueClass(ClassTag.Double) testValueClass(ClassTag.Unit) testValueClass(ClassTag.Boolean) -}
\ No newline at end of file +} diff --git a/test/files/run/t6329_vanilla.scala b/test/files/run/t6329_vanilla.scala index f2d843896d..ec84f1f938 100644 --- a/test/files/run/t6329_vanilla.scala +++ b/test/files/run/t6329_vanilla.scala @@ -1,5 +1,6 @@ import scala.reflect.classTag +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[scala.List[_]]) println(classTag[scala.List[_]]) diff --git a/test/files/run/t6443.scala b/test/files/run/t6443.scala index 67fe2cab22..3ab8c345fe 100644 --- a/test/files/run/t6443.scala +++ b/test/files/run/t6443.scala @@ -1,3 +1,5 @@ +import scala.language.existentials + class Base class Derived extends Base diff --git a/test/files/run/t657.scala b/test/files/run/t657.scala index a9726092e7..e76b0292dd 100644 --- a/test/files/run/t657.scala +++ b/test/files/run/t657.scala @@ -1,3 +1,5 @@ + +import scala.language.{ implicitConversions } abstract class BaseList { type Node <: NodeImpl; implicit def convertNode(ni : NodeImpl) = ni.asInstanceOf[Node]; diff --git a/test/files/run/t6690.scala b/test/files/run/t6690.scala index 43ede967a0..15b1817e87 100644 --- a/test/files/run/t6690.scala +++ b/test/files/run/t6690.scala @@ -1,5 +1,7 @@ import scala.collection.mutable +import scala.language.{ reflectiveCalls } + object Test extends App { def last0(ml: mutable.MutableList[Int]) = ml.asInstanceOf[{def last0: mutable.LinkedList[Int]}].last0 diff --git a/test/files/run/t6731.scala b/test/files/run/t6731.scala index 89d212e91e..12357b935e 100644 --- a/test/files/run/t6731.scala +++ b/test/files/run/t6731.scala @@ -12,7 +12,7 @@ abstract class MonoDynamic extends Dynamic { def applyDynamic(name: String)(args: Any*): String = show(this + "." + name + mkArgs(args: _*)) def applyDynamicNamed(name: String)(args: (String, Any)*): String = show(this + "." + name + mkArgs(args: _*)) - override def toString = this.getClass.getName split '.' last + override def toString = (this.getClass.getName split '.').last } object Mono extends MonoDynamic { diff --git a/test/files/run/t6863.check b/test/files/run/t6863.check new file mode 100644 index 0000000000..030cb8b265 --- /dev/null +++ b/test/files/run/t6863.check @@ -0,0 +1,12 @@ +t6863.scala:38: warning: comparing values of types Unit and Unit using `==' will always yield true + assert({ () => x}.apply == ()) + ^ +t6863.scala:42: warning: comparing values of types Unit and Unit using `==' will always yield true + assert({ () => x}.apply == ()) + ^ +t6863.scala:46: warning: comparing values of types Unit and Unit using `==' will always yield true + assert({ () => x}.apply == ()) + ^ +t6863.scala:59: warning: comparing values of types Unit and Unit using `==' will always yield true + assert({ () => x }.apply == ()) + ^ diff --git a/test/files/run/t6863.scala b/test/files/run/t6863.scala index d77adb6af4..c4f3c2c885 100644 --- a/test/files/run/t6863.scala +++ b/test/files/run/t6863.scala @@ -51,7 +51,7 @@ object Test { assert({ () => x }.apply == "42") } def tryCatch() = { - var x = try { "42" } catch { case _ => "43" } + var x = try { "42" } catch { case _: Throwable => "43" } assert({ () => x }.apply == "42") } def `if`() = { @@ -85,7 +85,7 @@ object Test { def nested() = { var x = { val y = 42 - if(true) try "42" catch {case _ => "43"} + if(true) try "42" catch {case _: Throwable => "43"} else "44" } assert({ () => x }.apply == "42") diff --git a/test/files/run/t6969.scala b/test/files/run/t6969.scala index 8cfc28c1e5..c4561b4424 100644 --- a/test/files/run/t6969.scala +++ b/test/files/run/t6969.scala @@ -1,3 +1,7 @@ + + +import scala.language.{ reflectiveCalls } + object Test { private type Clearable = { def clear(): Unit } private def choke() = { diff --git a/test/files/run/t7047.check b/test/files/run/t7047.check index e69de29bb2..32bd581094 100644 --- a/test/files/run/t7047.check +++ b/test/files/run/t7047.check @@ -0,0 +1,3 @@ +Test_2.scala:2: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + Macros.foo + ^ diff --git a/test/files/run/t7096.scala b/test/files/run/t7096.scala index 2a93dcc571..2495102899 100644 --- a/test/files/run/t7096.scala +++ b/test/files/run/t7096.scala @@ -1,3 +1,6 @@ +/* + * filter: inliner warning\(s\); re-run with -Yinline-warnings for details + */ import scala.tools.partest._ import scala.tools.nsc._ diff --git a/test/files/run/t7120b.scala b/test/files/run/t7120b.scala index 9f6591aa06..0be4eb70a7 100644 --- a/test/files/run/t7120b.scala +++ b/test/files/run/t7120b.scala @@ -1,3 +1,6 @@ + +import scala.language.higherKinds + trait Base[A] { type B = A; } class C extends Base[String] { class D { diff --git a/test/files/run/t7171.check b/test/files/run/t7171.check new file mode 100644 index 0000000000..d826f6cb94 --- /dev/null +++ b/test/files/run/t7171.check @@ -0,0 +1,3 @@ +t7171.scala:2: warning: The outer reference in this type test cannot be checked at run time. + final case class A() + ^ diff --git a/test/files/run/t7171.flags b/test/files/run/t7171.flags new file mode 100644 index 0000000000..c02e5f2461 --- /dev/null +++ b/test/files/run/t7171.flags @@ -0,0 +1 @@ +-unchecked diff --git a/test/files/run/t7171.scala b/test/files/run/t7171.scala index 97585b9860..e0a1192228 100644 --- a/test/files/run/t7171.scala +++ b/test/files/run/t7171.scala @@ -16,7 +16,7 @@ object Test extends App { val a1 = new t1.A() val a2 = new t1.A() assert(t1.foo(a1)) - // as noted in the unchecked warning (tested in the corresponding neg test), + // as noted in the unchecked warning (also tested in the corresponding neg test), // the outer pointer isn't checked assert(t1.foo(a2)) } diff --git a/test/files/run/t7198.check b/test/files/run/t7198.check new file mode 100644 index 0000000000..6dad496f49 --- /dev/null +++ b/test/files/run/t7198.check @@ -0,0 +1,2 @@ +The quick brown fox jumped +And ran away with the vixen. diff --git a/test/files/run/t7198.scala b/test/files/run/t7198.scala new file mode 100644 index 0000000000..26e1d8805a --- /dev/null +++ b/test/files/run/t7198.scala @@ -0,0 +1,9 @@ +/* spew a few lines + * filter: Over the moon + */ +object Test extends App { + Console println "The quick brown fox jumped" + Console println "Over the moon" + Console println "And ran away with the vixen." + Console println "Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (errno = 28)." +} diff --git a/test/files/run/t7240/Test_2.scala b/test/files/run/t7240/Test_2.scala index 2450bdabf9..5cc2cc7f78 100644 --- a/test/files/run/t7240/Test_2.scala +++ b/test/files/run/t7240/Test_2.scala @@ -1,3 +1,3 @@ object Test extends App { - bakery.Bakery.failure -}
\ No newline at end of file + val v = bakery.Bakery.failure +} diff --git a/test/files/run/t7271.check b/test/files/run/t7271.check index 6db301c21d..f7a23018ca 100644 --- a/test/files/run/t7271.check +++ b/test/files/run/t7271.check @@ -1,12 +1,12 @@ [[syntax trees at end of parser]] // newSource1.scala -[0:91]package [0:0]<empty> { - [0:91]class C extends [8:91][91]scala.AnyRef { +[6]package [6]<empty> { + [6]class C extends [8][91]scala.AnyRef { [8]def <init>() = [8]{ [NoPosition][NoPosition][NoPosition]super.<init>(); [8]() }; - [16:44]def quote = [28:44]<28:44><28:44>[28]StringContext([30:34]"foo", [40:44]"baz").s([35:39]this); - [51:85]def tripleQuote = [69:85]<69:85><69:85>[69]StringContext([71:75]"foo", [81:85]"baz").s([76:80]this) + [20]def quote = [28][28][28][28]StringContext([30]"foo", [40]"baz").s([35]this); + [55]def tripleQuote = [69][69][69][69]StringContext([71]"foo", [81]"baz").s([76]this) } } diff --git a/test/files/run/t7271.scala b/test/files/run/t7271.scala index 6fccf14d20..cb43331a29 100644 --- a/test/files/run/t7271.scala +++ b/test/files/run/t7271.scala @@ -4,6 +4,7 @@ import scala.tools.nsc._ import scala.tools.nsc.util.CommandLineParser import scala.tools.nsc.{Global, Settings, CompilerCommand} import scala.tools.nsc.reporters.ConsoleReporter +import scala.reflect.internal.Positions object Test extends DirectTest { @@ -29,6 +30,6 @@ object Test extends DirectTest { val settings = new Settings() settings.Xprintpos.value = true val command = new CompilerCommand((CommandLineParser tokenize extraSettings) ++ args.toList, settings) - new Global(command.settings, new ConsoleReporter(settings)) with interactive.RangePositions + new Global(command.settings, new ConsoleReporter(settings)) with Positions } } diff --git a/test/files/run/t7290.check b/test/files/run/t7290.check new file mode 100644 index 0000000000..aff48abd4a --- /dev/null +++ b/test/files/run/t7290.check @@ -0,0 +1,6 @@ +t7290.scala:4: warning: Pattern contains duplicate alternatives: 0 + case 0 | 0 => 0 + ^ +t7290.scala:5: warning: Pattern contains duplicate alternatives: 2, 3 + case 2 | 2 | 2 | 3 | 2 | 3 => 0 + ^ diff --git a/test/files/run/t7291.scala b/test/files/run/t7291.scala index 30c4261a81..d996c615ce 100644 --- a/test/files/run/t7291.scala +++ b/test/files/run/t7291.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, implicitConversions } + trait Fooable[T] object Fooable { implicit def conjure[T]: Fooable[T] = { diff --git a/test/files/run/t874.scala b/test/files/run/t874.scala index 41d124f728..7e70fc34eb 100644 --- a/test/files/run/t874.scala +++ b/test/files/run/t874.scala @@ -1,3 +1,5 @@ + +import scala.language.{ reflectiveCalls } object Test { abstract class Base { val U: { diff --git a/test/files/run/tcpoly_monads.scala b/test/files/run/tcpoly_monads.scala index cffbcc963b..6372851451 100644 --- a/test/files/run/tcpoly_monads.scala +++ b/test/files/run/tcpoly_monads.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, implicitConversions } + trait Monads { /** * class Monad m where diff --git a/test/files/run/tcpoly_overriding.scala b/test/files/run/tcpoly_overriding.scala index 86ba89f530..32174ad8bf 100644 --- a/test/files/run/tcpoly_overriding.scala +++ b/test/files/run/tcpoly_overriding.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds } + abstract class A[t[x]] { def b: t[Int] } diff --git a/test/files/run/tcpoly_parseridioms.check b/test/files/run/tcpoly_parseridioms.check index 5fff2efb15..ab829e0a0e 100644 --- a/test/files/run/tcpoly_parseridioms.check +++ b/test/files/run/tcpoly_parseridioms.check @@ -1 +1,21 @@ +tcpoly_parseridioms.scala:18: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + case Success(next, x) => b(next) match { + ^ +tcpoly_parseridioms.scala:17: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + def apply(in: Input): ParseResult[Pair[T, U]] = a(in) match { + ^ +tcpoly_parseridioms.scala:30: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + case Failure(_, _) => b(in) match { + ^ +tcpoly_parseridioms.scala:28: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + def apply(in: Input): ParseResult[T] = a(in) match { + ^ +tcpoly_parseridioms.scala:39: warning: match may not be exhaustive. +It would fail on the following input: ParseResult() + def apply(in: Input): ParseResult[U] = a(in) match { + ^ Success(List(),Plus(1,2)) diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala index 634240e44d..ec17e062db 100644 --- a/test/files/run/tcpoly_parseridioms.scala +++ b/test/files/run/tcpoly_parseridioms.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, implicitConversions, postfixOps } + trait Parsers { type Input = List[Char] diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala index d672ccb9cb..ce28086c25 100644 --- a/test/files/run/toolbox_console_reporter.scala +++ b/test/files/run/toolbox_console_reporter.scala @@ -4,10 +4,10 @@ import scala.reflect.runtime.{currentMirror => cm} import scala.tools.reflect.{ToolBox, mkConsoleFrontEnd} object Test extends App { - val oldErr = Console.err; - val baos = new java.io.ByteArrayOutputStream(); - Console.setErr(new java.io.PrintStream(baos)); - try { + //val oldErr = Console.err; + val baos = new java.io.ByteArrayOutputStream() + val errs = new java.io.PrintStream(baos) + (Console withErr errs) { val toolbox = cm.mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation") toolbox.eval(reify{ object Utils { @@ -18,12 +18,11 @@ object Test extends App { Utils.foo }.tree) println("============compiler console=============") + errs.flush() println(baos.toString); println("=========================================") println("============compiler messages============") toolbox.frontEnd.infos.foreach(println(_)) println("=========================================") - } finally { - Console.setErr(oldErr); } -}
\ No newline at end of file +} diff --git a/test/files/run/transform.scala b/test/files/run/transform.scala index 5cc1c49d6f..82f924950d 100644 --- a/test/files/run/transform.scala +++ b/test/files/run/transform.scala @@ -1,5 +1,5 @@ object Test { - val x = 1 to 10 toBuffer + val x = (1 to 10).toBuffer def main(args: Array[String]): Unit = { x transform (_ * 2) diff --git a/test/files/run/try-2.check b/test/files/run/try-2.check index 6c4a024c93..987d3462df 100644 --- a/test/files/run/try-2.check +++ b/test/files/run/try-2.check @@ -1,3 +1,6 @@ +try-2.scala:41: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 10; + ^ exception happened Nothin diff --git a/test/files/run/try-2.scala b/test/files/run/try-2.scala index da321f2668..b55977ba8b 100644 --- a/test/files/run/try-2.scala +++ b/test/files/run/try-2.scala @@ -12,42 +12,42 @@ object Test { throw new Error(); } catch { - case _ => Console.println("exception happened\n"); + case _: Throwable => Console.println("exception happened\n"); } def tryUnitAll: Unit = try { Console.println("Nothin"); } catch { - case _ => sys.error("Bad, bad, lama!"); + case _: Throwable => sys.error("Bad, bad, lama!"); } def tryAllAll: Unit = try { throw new Error(); } catch { - case _ => sys.error("Bad, bad, lama!"); + case _: Throwable => sys.error("Bad, bad, lama!"); } def tryUnitUnit: Unit = try { Console.println("Nothin"); } catch { - case _ => Console.println("Nothin"); + case _: Throwable => Console.println("Nothin"); } def tryIntUnit: Unit = try { 10; } catch { - case _ => Console.println("Huh?"); + case _: Throwable => Console.println("Huh?"); } def execute(f: => Unit) = try { f; } catch { - case _ => (); + case _: Throwable => (); } diff --git a/test/files/run/try-catch-unify.scala b/test/files/run/try-catch-unify.scala index 8cb14d060e..151e549e5f 100644 --- a/test/files/run/try-catch-unify.scala +++ b/test/files/run/try-catch-unify.scala @@ -9,7 +9,7 @@ object Test { try { catching(classOf[NumberFormatException]) withTry (sys.error("O NOES")) } catch { - case t => println(t.getMessage) + case t: Throwable => println(t.getMessage) } println(nonFatalCatch withTry ("Hi".toDouble)) } diff --git a/test/files/run/try.check b/test/files/run/try.check index 3983e26060..f742ccb0df 100644 --- a/test/files/run/try.check +++ b/test/files/run/try.check @@ -1,3 +1,6 @@ +try.scala:65: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + 1+1; + ^ 1 + 1 = 2 1 + 1 = 2 1 + 1 = 2 diff --git a/test/files/run/try.scala b/test/files/run/try.scala index e393c0b4b1..a4fdfd796b 100644 --- a/test/files/run/try.scala +++ b/test/files/run/try.scala @@ -45,7 +45,7 @@ object Test extends AnyRef with App { instance = try { "" //new String(); } catch { - case _ => + case _: Throwable => val cs = "aaa"; if (cs.length() > 0) { "" //new String(); @@ -65,13 +65,13 @@ object Test extends AnyRef with App { 1+1; () } catch { - case _ => + case _: Throwable => Console.println("2"); sys.error("for good"); } Console.println("a"); } catch { - case _ => (); + case _: Throwable => (); } class A { @@ -95,7 +95,7 @@ object Test extends AnyRef with App { try { null } catch { - case _ => null + case _: Throwable => null } new AnyRef { diff --git a/test/files/run/tuple-zipped.scala b/test/files/run/tuple-zipped.scala index b197183844..c8ba41f042 100644 --- a/test/files/run/tuple-zipped.scala +++ b/test/files/run/tuple-zipped.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + object Test { val xs1 = List.range(1, 100) val xs2 = xs1.view diff --git a/test/files/run/tuples.scala b/test/files/run/tuples.scala index 4854e36c96..a4ea9ddbcc 100644 --- a/test/files/run/tuples.scala +++ b/test/files/run/tuples.scala @@ -6,6 +6,7 @@ object Test extends App { Console.println(xyz) xyz match { case (1, "abc", true) => Console.println("OK") + case _ => ??? } def func(x: Int, y: String, z: Double) { Console.println("x = " + x + "; y = " + y + "; z = " + z); diff --git a/test/files/run/type-currying.scala b/test/files/run/type-currying.scala index f9764c64f0..5e31fef403 100644 --- a/test/files/run/type-currying.scala +++ b/test/files/run/type-currying.scala @@ -1,3 +1,6 @@ + + +import scala.language.{ higherKinds, reflectiveCalls } import scala.collection.{ mutable, immutable, generic } import generic.CanBuildFrom diff --git a/test/files/run/unapply.check b/test/files/run/unapply.check new file mode 100644 index 0000000000..847e3b381e --- /dev/null +++ b/test/files/run/unapply.check @@ -0,0 +1,3 @@ +unapply.scala:57: warning: comparing values of types Null and Null using `==' will always yield true + assert(doMatch2(b) == null) + ^ diff --git a/test/files/run/unittest_io.scala b/test/files/run/unittest_io.scala index 2cadb9b1df..2c3dacdf91 100644 --- a/test/files/run/unittest_io.scala +++ b/test/files/run/unittest_io.scala @@ -1,3 +1,5 @@ + +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]) { diff --git a/test/files/run/unreachable.scala b/test/files/run/unreachable.scala index 50a8d88b7c..99ac730746 100644 --- a/test/files/run/unreachable.scala +++ b/test/files/run/unreachable.scala @@ -1,3 +1,6 @@ +import scala.util.Random.nextInt +import scala.sys.error + object Test extends App { def unreachableNormalExit: Int = { return 42 @@ -6,14 +9,14 @@ object Test extends App { def unreachableIf: Int = { return 42 - if (util.Random.nextInt % 2 == 0) + if (nextInt % 2 == 0) 0 else 1 } def unreachableIfBranches: Int = { - if (util.Random.nextInt % 2 == 0) + if (nextInt % 2 == 0) return 42 else return 42 @@ -22,14 +25,14 @@ object Test extends App { } def unreachableOneLegIf: Int = { - if (util.Random.nextInt % 2 == 0) + if (nextInt % 2 == 0) return 42 return 42 } def unreachableLeftBranch: Int = { - val result = if (util.Random.nextInt % 2 == 0) + val result = if (nextInt % 2 == 0) return 42 else 42 @@ -38,7 +41,7 @@ object Test extends App { } def unreachableRightBranch: Int = { - val result = if (util.Random.nextInt % 2 == 0) + val result = if (nextInt % 2 == 0) 42 else return 42 @@ -89,7 +92,7 @@ object Test extends App { def unreachableSwitch: Int = { return 42 - val x = util.Random.nextInt % 2 + val x = nextInt % 2 x match { case 0 => return 0 case 1 => return 1 @@ -99,7 +102,7 @@ object Test extends App { } def unreachableAfterSwitch: Int = { - val x = util.Random.nextInt % 2 + val x = nextInt % 2 x match { case 0 => return 42 case 1 => return 41 + x @@ -122,4 +125,4 @@ object Test extends App { check(unreachableAfterFinally) check(unreachableSwitch) check(unreachableAfterSwitch) -}
\ No newline at end of file +} diff --git a/test/files/run/valueclasses-classmanifest-basic.scala b/test/files/run/valueclasses-classmanifest-basic.scala index c2aa08ef86..50addda359 100644 --- a/test/files/run/valueclasses-classmanifest-basic.scala +++ b/test/files/run/valueclasses-classmanifest-basic.scala @@ -1,5 +1,6 @@ class Foo(val x: Int) extends AnyVal +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[Foo]) -}
\ No newline at end of file +} diff --git a/test/files/run/valueclasses-classmanifest-existential.scala b/test/files/run/valueclasses-classmanifest-existential.scala index 11999df678..6bcd7cf942 100644 --- a/test/files/run/valueclasses-classmanifest-existential.scala +++ b/test/files/run/valueclasses-classmanifest-existential.scala @@ -1,5 +1,6 @@ class Foo[T](val x: T) extends AnyVal +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[Foo[_]]) -}
\ No newline at end of file +} diff --git a/test/files/run/valueclasses-classmanifest-generic.scala b/test/files/run/valueclasses-classmanifest-generic.scala index 280152dc1d..5efcaed959 100644 --- a/test/files/run/valueclasses-classmanifest-generic.scala +++ b/test/files/run/valueclasses-classmanifest-generic.scala @@ -1,5 +1,6 @@ class Foo[T](val x: T) extends AnyVal +@deprecated("Suppress warnings", since="2.11") object Test extends App { println(classManifest[Foo[String]]) -}
\ No newline at end of file +} diff --git a/test/files/run/vector1.scala b/test/files/run/vector1.scala index b37cfe82e8..2e335aded4 100644 --- a/test/files/run/vector1.scala +++ b/test/files/run/vector1.scala @@ -102,7 +102,7 @@ object Test { seqBack() } } catch { - case ex => + case ex: Throwable => //println("----------------") //a.debug throw ex diff --git a/test/files/run/view-iterator-stream.scala b/test/files/run/view-iterator-stream.scala index f91407f92c..c172b5cb99 100644 --- a/test/files/run/view-iterator-stream.scala +++ b/test/files/run/view-iterator-stream.scala @@ -1,3 +1,6 @@ + +import scala.language.postfixOps + import scala.collection.{ mutable, immutable, generic } import collection.TraversableView diff --git a/test/files/run/virtpatmat_alts.check b/test/files/run/virtpatmat_alts.check index 7a4ad0a741..f39e292fef 100644 --- a/test/files/run/virtpatmat_alts.check +++ b/test/files/run/virtpatmat_alts.check @@ -1 +1,7 @@ +virtpatmat_alts.scala:5: warning: match may not be exhaustive. + (true, true) match { + ^ +virtpatmat_alts.scala:9: warning: match may not be exhaustive. + List(5) match { + ^ OK 5 diff --git a/test/files/run/virtpatmat_alts.flags b/test/files/run/virtpatmat_alts.flags deleted file mode 100644 index 3f5a3100e4..0000000000 --- a/test/files/run/virtpatmat_alts.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/test/files/run/virtpatmat_alts.scala b/test/files/run/virtpatmat_alts.scala index b7717524e2..d1dfa8a4a1 100644 --- a/test/files/run/virtpatmat_alts.scala +++ b/test/files/run/virtpatmat_alts.scala @@ -1,3 +1,6 @@ +/* + * filter: It would fail on the following input + */ object Test extends App { (true, true) match { case (true, true) | (false, false) => 1 @@ -9,4 +12,4 @@ object Test extends App { case 7 :: Nil => println("FAILED") case Nil => println("FAILED") } -}
\ No newline at end of file +} diff --git a/test/files/run/virtpatmat_nested_lists.check b/test/files/run/virtpatmat_nested_lists.check index d8263ee986..ddf68eeedd 100644 --- a/test/files/run/virtpatmat_nested_lists.check +++ b/test/files/run/virtpatmat_nested_lists.check @@ -1 +1,4 @@ -2
\ No newline at end of file +virtpatmat_nested_lists.scala:5: warning: match may not be exhaustive. + List(List(1), List(2)) match { case x :: (y :: Nil) :: Nil => println(y) } + ^ +2 diff --git a/test/files/run/virtpatmat_nested_lists.flags b/test/files/run/virtpatmat_nested_lists.flags deleted file mode 100644 index 3f5a3100e4..0000000000 --- a/test/files/run/virtpatmat_nested_lists.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/test/files/run/virtpatmat_nested_lists.scala b/test/files/run/virtpatmat_nested_lists.scala index fef74cea15..d1aa68ea93 100644 --- a/test/files/run/virtpatmat_nested_lists.scala +++ b/test/files/run/virtpatmat_nested_lists.scala @@ -1,3 +1,6 @@ +/* + * filter: It would fail on the following input + */ object Test extends App { List(List(1), List(2)) match { case x :: (y :: Nil) :: Nil => println(y) } } diff --git a/test/files/run/virtpatmat_opt_sharing.check b/test/files/run/virtpatmat_opt_sharing.check index d00491fd7e..78ec61f19d 100644 --- a/test/files/run/virtpatmat_opt_sharing.check +++ b/test/files/run/virtpatmat_opt_sharing.check @@ -1 +1,4 @@ +virtpatmat_opt_sharing.scala:7: warning: match may not be exhaustive. + List(1, 3, 4, 7) match { + ^ 1 diff --git a/test/files/run/virtpatmat_opt_sharing.flags b/test/files/run/virtpatmat_opt_sharing.flags deleted file mode 100644 index 3f5a3100e4..0000000000 --- a/test/files/run/virtpatmat_opt_sharing.flags +++ /dev/null @@ -1 +0,0 @@ - -Xexperimental diff --git a/test/files/run/virtpatmat_opt_sharing.scala b/test/files/run/virtpatmat_opt_sharing.scala index 119e3050ea..d2c42cab48 100644 --- a/test/files/run/virtpatmat_opt_sharing.scala +++ b/test/files/run/virtpatmat_opt_sharing.scala @@ -1,3 +1,6 @@ +/* + * filter: It would fail on the following input + */ object Test extends App { virtMatch() def virtMatch() = { @@ -7,4 +10,4 @@ object Test extends App { case 1 :: 3 :: 4 :: 7 :: x => println(1) } } -}
\ No newline at end of file +} diff --git a/test/files/run/virtpatmat_staging.scala b/test/files/run/virtpatmat_staging.scala index c17b45043b..d444829b02 100644 --- a/test/files/run/virtpatmat_staging.scala +++ b/test/files/run/virtpatmat_staging.scala @@ -1,3 +1,6 @@ + +import scala.language.{ higherKinds, implicitConversions } + trait Intf { type Rep[+T] type M[+T] = Rep[Maybe[T]] @@ -9,7 +12,7 @@ trait Intf { def zero: M[Nothing] def one[T](x: Rep[T]): M[T] - def guard[T](cond: Rep[Boolean], then: => Rep[T]): M[T] + def guard[T](cond: Rep[Boolean], dann: => Rep[T]): M[T] def isSuccess[T, U](x: Rep[T])(f: Rep[T] => M[U]): Rep[Boolean] // used for isDefinedAt } @@ -33,7 +36,7 @@ trait Impl extends Intf { def runOrElse[T, U](in: Rep[T])(matcher: Rep[T] => M[U]): Rep[U] = ("runOrElse("+ in +", ?" + matcher("?") + ")") def zero: M[Nothing] = "zero" def one[T](x: Rep[T]): M[T] = "one("+x.toString+")" - def guard[T](cond: Rep[Boolean], then: => Rep[T]): M[T] = "guard("+cond+","+then+")" + def guard[T](cond: Rep[Boolean], dann: => Rep[T]): M[T] = s"guard($cond,$dann)" def isSuccess[T, U](x: Rep[T])(f: Rep[T] => M[U]): Rep[Boolean] = ("isSuccess("+x+", ?" + f("?") + ")") } diff --git a/test/files/run/virtpatmat_stringinterp.scala b/test/files/run/virtpatmat_stringinterp.scala index 213712f17a..c6c951e6e5 100644 --- a/test/files/run/virtpatmat_stringinterp.scala +++ b/test/files/run/virtpatmat_stringinterp.scala @@ -1,3 +1,6 @@ + +import scala.language.{ implicitConversions } + object Test extends App { case class Node(x: Int) @@ -10,4 +13,4 @@ object Test extends App { val x: Node = Node(0) x match { case xml"""<foo arg=$a/>""" => println(a) } -}
\ No newline at end of file +} diff --git a/test/files/run/virtpatmat_try.scala b/test/files/run/virtpatmat_try.scala index 46e67cb72e..dab2c89227 100644 --- a/test/files/run/virtpatmat_try.scala +++ b/test/files/run/virtpatmat_try.scala @@ -8,7 +8,7 @@ object Test extends App { } catch { // this should emit a "catch-switch" case y: A => println(y.x) case (_ : A | _ : B) => println("B") - case _ => println("other") + case _: Throwable => println("other") } try { @@ -17,7 +17,7 @@ object Test extends App { // case A(x) => println(x) case y: A => println(y.x) case x@((_ : A) | (_ : B)) => println(x) - case _ => println("other") + case _: Throwable => println("other") } def simpleTry { @@ -34,7 +34,7 @@ object Test extends App { } def wildcardTry { - try { bla } catch { case _ => bla } + try { bla } catch { case _: Throwable => bla } } def tryPlusFinally { @@ -44,4 +44,4 @@ object Test extends App { def catchAndPassToLambda { try { bla } catch { case ex: Exception => val f = () => ex } } -}
\ No newline at end of file +} diff --git a/test/files/run/virtpatmat_typed.check b/test/files/run/virtpatmat_typed.check index cec2740d18..9924d84148 100644 --- a/test/files/run/virtpatmat_typed.check +++ b/test/files/run/virtpatmat_typed.check @@ -1 +1,4 @@ +virtpatmat_typed.scala:5: warning: unreachable code + case x: String => println("FAILED") + ^ OK foo diff --git a/test/files/run/xml-loop-bug.scala b/test/files/run/xml-loop-bug.scala index 67637674b2..dc155dbb02 100644 --- a/test/files/run/xml-loop-bug.scala +++ b/test/files/run/xml-loop-bug.scala @@ -1,8 +1,14 @@ +import java.io.{ Console => _, _ } +import scala.io._ +import scala.xml.parsing._ object Test { def main(args: Array[String]): Unit = { - val sink = new java.io.PrintStream(new java.io.ByteArrayOutputStream()) - Console setOut sink - Console setErr sink - scala.xml.parsing.ConstructingParser.fromSource(scala.io.Source.fromString("<!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> "), true).document.docElem + val xml = "<!DOCTYPE xmeml SYSTEM> <xmeml> <sequence> </sequence> </xmeml> " + val sink = new PrintStream(new ByteArrayOutputStream()) + (Console withOut sink) { + (Console withErr sink) { + ConstructingParser.fromSource((Source fromString xml), true).document.docElem + } + } } } diff --git a/test/files/specialized/spec-matrix-old.scala b/test/files/specialized/spec-matrix-old.scala index 98735c8c03..83941e80a7 100644 --- a/test/files/specialized/spec-matrix-old.scala +++ b/test/files/specialized/spec-matrix-old.scala @@ -1,6 +1,7 @@ /** Test matrix multiplication with specialization. */ +@deprecated("Suppress warnings", since="2.11") class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { private val arr: Array[Array[A]] = Array.ofDim[A](rows, cols) @@ -25,6 +26,7 @@ class Matrix[@specialized A: ClassManifest](val rows: Int, val cols: Int) { } } +@deprecated("Suppress warnings", since="2.11") object Test { def main(args: Array[String]) { val m = randomMatrix(200, 100) diff --git a/test/files/specialized/spec-super.check b/test/files/specialized/spec-super.check index 4be83ca9e6..2f4d60018b 100644 --- a/test/files/specialized/spec-super.check +++ b/test/files/specialized/spec-super.check @@ -1,3 +1,6 @@ +spec-super.scala:18: warning: class Base must be a trait. Specialized version of class Extended will inherit generic Base[Int] +class Extended [@specialized(Int) T](t: T) extends Base[T](t) { + ^ s 1 -2
\ No newline at end of file +2 diff --git a/test/files/specialized/spec-t3896.scala b/test/files/specialized/spec-t3896.scala index 605ed0df9d..3a3be3da2b 100644 --- a/test/files/specialized/spec-t3896.scala +++ b/test/files/specialized/spec-t3896.scala @@ -12,7 +12,7 @@ object Test { def main(args: Array[String]): Unit = { val e = new AtomicBoolean(false) val x = e.f( (a : Boolean) => !a ) // ok - println( e.f( (a : Boolean) => !a ) toString ) // ok + println( e.f( (a : Boolean) => !a ).toString ) // ok println( e.f( (a : Boolean) => !a) ) // compiler crash println(runtime.BoxesRunTime.integerBoxCount) diff --git a/test/files/specialized/tb3651.check b/test/files/specialized/tb3651.check index c227083464..8a3f686ef5 100644 --- a/test/files/specialized/tb3651.check +++ b/test/files/specialized/tb3651.check @@ -1 +1,4 @@ -0
\ No newline at end of file +tb3651.scala:8: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + lk.a + ^ +0 diff --git a/test/files/specialized/tc3651.check b/test/files/specialized/tc3651.check index c227083464..e2dbadf22c 100644 --- a/test/files/specialized/tc3651.check +++ b/test/files/specialized/tc3651.check @@ -1 +1,4 @@ -0
\ No newline at end of file +tc3651.scala:12: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + lk.a + ^ +0 diff --git a/test/files/specialized/td3651.check b/test/files/specialized/td3651.check index 9aea9e0ce5..1a709fd0a7 100644 --- a/test/files/specialized/td3651.check +++ b/test/files/specialized/td3651.check @@ -1,2 +1,8 @@ +td3651.scala:12: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + b.a + ^ +td3651.scala:16: warning: a pure expression does nothing in statement position; you may be omitting necessary parentheses + der.a + ^ +0 0 -0
\ No newline at end of file |