From db683fe9ffd24db513b926fc4b1b9c08423e37ec Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 3 Mar 2014 11:19:09 +0100 Subject: [PATCH 1/2] Better logging 1) max constraint is now printed via typr printer, does not clog the output unless typr is set. 2) running a frontend phase informs what is run on which unit under -verbose. --- src/dotty/tools/dotc/core/Constraint.scala | 3 ++- src/dotty/tools/dotc/typer/FrontEnd.scala | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/dotty/tools/dotc/core/Constraint.scala b/src/dotty/tools/dotc/core/Constraint.scala index 9354e18f86a8..64fb8764ebb6 100644 --- a/src/dotty/tools/dotc/core/Constraint.scala +++ b/src/dotty/tools/dotc/core/Constraint.scala @@ -8,6 +8,7 @@ import collection.mutable import printing.{Printer, Showable} import printing.Texts._ import config.Config +import config.Printers._ /** Constraint over undetermined type parameters * @param myMap a map from PolyType to arrays. @@ -304,5 +305,5 @@ trait ConstraintRunInfo { self: RunInfo => maxConstraint = c } def printMaxConstraint()(implicit ctx: Context) = - if (maxSize > 0) println(s"max constraint = ${maxConstraint.show}") + if (maxSize > 0) typr.println(s"max constraint = ${maxConstraint.show}") } diff --git a/src/dotty/tools/dotc/typer/FrontEnd.scala b/src/dotty/tools/dotc/typer/FrontEnd.scala index 0161c1f6ffd2..030f255bf46b 100644 --- a/src/dotty/tools/dotc/typer/FrontEnd.scala +++ b/src/dotty/tools/dotc/typer/FrontEnd.scala @@ -12,13 +12,17 @@ class FrontEnd extends Phase { def name = "frontend" - def monitor(doing: String)(body: => Unit)(implicit ctx: Context) = - try body - catch { + def monitor(doing: String)(body: => Unit)(implicit ctx: Context) = { + def action = s"$doing ${ctx.compilationUnit}" + try { + ctx.inform(action) + body + } catch { case ex: Throwable => - println(s"exception occured while $doing ${ctx.compilationUnit}") + println(s"exception occured while $action") throw ex } + } def parse(implicit ctx: Context) = monitor("parsing") { val unit = ctx.compilationUnit From b461c214e02a242338afa2121868c4e3acd18e07 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 3 Mar 2014 11:19:56 +0100 Subject: [PATCH 2/2] Turning -verbose on for dotc-config test Reason is we want to find out in what order files were compiled when a failure occurs. --- test/dotc/tests.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 9132ce9c4d72..7f3ca38a32f7 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -52,7 +52,7 @@ class tests extends CompilerTest { @Test def dotc = compileDir(dotcDir + "tools/dotc") @Test def dotc_ast = compileDir(dotcDir + "tools/dotc/ast") - @Test def dotc_config = compileDir(dotcDir + "tools/dotc/config") + @Test def dotc_config = compileDir(dotcDir + "tools/dotc/config", List("-verbose")) @Test def dotc_core = compileDir(dotcDir + "tools/dotc/core") @Test def dotc_core_pickling = compileDir(dotcDir + "tools/dotc/core/pickling") @Test def dotc_transform = compileDir(dotcDir + "tools/dotc/core/transform")