diff options
3 files changed, 12 insertions, 161 deletions
diff --git a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala index acb78f9df3..2ebe82509c 100644 --- a/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala +++ b/src/compiler/scala/tools/nsc/reporters/ConsoleReporter.scala @@ -40,7 +40,8 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr countElementsAsString((severity).count, label(severity)) /** Prints the message. */ - def printMessage(msg: String) { writer.println(msg) } + //def printMessage(msg: String) { writer.println(msg) } // platform-dependent! + def printMessage(msg: String) { writer.print(msg + "\n"); writer.flush() } /** Prints the message with the given position indication. */ def printMessage(posIn: Position, msg: String) { @@ -53,12 +54,12 @@ class ConsoleReporter(val settings: Settings, reader: BufferedReader, writer: Pr } //println(getSource.file) pos match { - case FakePos(msg) => - buf.insert(0, msg + " ") - case _ if !pos.source.isEmpty => - val file = pos.source.get.file - buf.insert(0, if (shortname) file.name else file.path) - case _ => + case FakePos(msg) => + buf.insert(0, msg + " ") + case _ if !pos.source.isEmpty => + val file = pos.source.get.file + buf.insert(0, if (shortname) file.name else file.path) + case _ => } printMessage(buf.toString()) if (!pos.line.isEmpty) diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 116543fc53..67c302156a 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -177,15 +177,15 @@ trait Infer { */ def normalize(tp: Type): Type = skipImplicit(tp) match { case MethodType(formals, restpe) if (!restpe.isDependent) => - if (util.Statistics.enabled) normM = normM + 1 + if (util.Statistics.enabled) normM += 1 functionType(formals, normalize(restpe)) case PolyType(List(), restpe) => - if (util.Statistics.enabled) normP = normP + 1 + if (util.Statistics.enabled) normP += 1 normalize(restpe) case ExistentialType(tparams, qtpe) => ExistentialType(tparams, normalize(qtpe)) case tp1 => - if (util.Statistics.enabled) normO = normO + 1 + if (util.Statistics.enabled) normO += 1 tp1 // @MAT aliases already handled by subtyping } @@ -230,7 +230,7 @@ trait Infer { (if (pt == WildcardType) "" else " with expected result type " + pt) // todo: use also for other error messages - def existentialContext(tp: Type) = tp.existentialSkolems match { + private def existentialContext(tp: Type) = tp.existentialSkolems match { case List() => "" case skolems => " where "+(skolems map (_.existentialToString) mkString ", ") } diff --git a/src/partest/scala/tools/partest/NewTestRunner.scala b/src/partest/scala/tools/partest/NewTestRunner.scala deleted file mode 100644 index 73a28e09f3..0000000000 --- a/src/partest/scala/tools/partest/NewTestRunner.scala +++ /dev/null @@ -1,150 +0,0 @@ -package scala.tools.partest - -import java.io.{File, FilenameFilter, FileInputStream, FileOutputStream, - PrintStream} -import java.net.URI - -import scala.tools.nsc.Settings - -import utils.PrintMgr -import utils.PrintMgr._ - -/** - * @author Adriaan Moors, Thomas Hofer - * @version 1.0 - */ -class Test(val kind: String, val file: File) { - val dir = file.getParentFile - val dirpath = dir.getAbsolutePath - protected def baseSettings(settings: Settings) { - settings.classpath.value = dirpath - settings.outdir.value = { - var outDir = new File(dir, fileBase + "-" + kind + ".obj") - outDir.mkdir - outDir.toString - } - settings.deprecation.value = true - settings.nowarnings.value = false - settings.encoding.value = "iso-8859-1" - } - def defineSettings(settings: Settings) { - baseSettings(settings) - } - private def basename(name: String): String = { - val inx = name.lastIndexOf(".") - if (inx < 0) name else name.substring(0, inx) - } - val fileBase: String = basename(file.getName) - val logFile = new File(dir, fileBase + "-" + kind + ".log") - val checkFile = { - val chkFile = new File(dir, fileBase + ".check") - if (chkFile.isFile) // @P: in which case is it not a file? - chkFile - else - new File(dir, fileBase + "-" + kind + ".check") - } -} - -case class PosTest(override val file: File) extends Test("pos", file) - -object NewTestRunner { - - private val srcDir = { - val dirname = System.getProperty("scalatest.cwd", "") - val dir = if (dirname.isEmpty) { // guess - val libDir = new File(new URI(classOf[Test].getResource("/").toString)) - val path = libDir.getAbsolutePath - val parent = libDir.getParentFile - val rootDir = - if (path contains "quick") parent.getParentFile.getParentFile.getParentFile - else if (path contains "dists") parent.getParentFile.getParentFile - else parent - new File(rootDir, "test" + File.separator + "files") - } else - new File(dirname) - dir - } - - private val testFiles = new collection.mutable.ListBuffer[File] - - private def go() { - val filter = new FilenameFilter { - def accept(dir: File, name: String): Boolean = name endsWith ".scala" - } - def getFiles(kind: String, doCheck: Boolean): List[File] = { - val dir = new File(srcDir, kind) - if (dir.isDirectory) { - if (! testFiles.isEmpty) { - val dirpath = dir.getAbsolutePath - val files = testFiles filter { _.getParentFile.getAbsolutePath == dirpath } - files.toList - } else if (doCheck) - dir.listFiles(filter).toList - else // skip - Nil - } else { - println("Directory \"" + dir.getPath + "\" not found") - Nil - } - } - - val posCheck = true - val posFiles = getFiles("pos", posCheck) - if (!posFiles.isEmpty) { - printOutline("\nTesting compiler (on files whose compilation should succeed)\n") - - for (file <- posFiles) { - val test = PosTest(file) - - // @P: why is this a var? - var toCompile = List(file.getPath) - - var outDir = new File(test.dir, test.fileBase + "-" + test.kind + ".obj") - if (!outDir.exists) { - outDir.mkdir - println(this+" "+"created "+outDir) - } else { - println(this+" "+"didn't have to create "+outDir) - } - } - } - } - - def main(args: Array[String]) { - if (!srcDir.isDirectory) { - println("Test directory \"" + srcDir.getAbsolutePath + "\" not found") - exit(1) - } - printVerbose(srcDir.getAbsolutePath) - if (args.length == 0) - printUsage - else { - initialization(PrintMgr.MANY) - go() - } - } - - private def printUsage { - println("Usage: TestRunner [<options>] [<testfile> ..] [<resfile>]") - println(" --pos next files test a compilation success") - println(" --neg next files test a compilation failure") - println(" --jvm next files test the JVM backend") - println(" --run next files test the interpreter and all backends") - println(" --shootout ...") - println(" --conservative ...") - println(" --verbose display progress information") - println(" --version output version information and exit") - println - println("Send bugs to <scala@listes.epfl.ch>") - exit(1) - } - - var verbose = false - - private def printVerbose(msg: String) { - if (verbose) { - printOutline("debug : ") - println(msg) - } - } -} |