From a9602035ced72dcd4ab016716a0689835015e4eb Mon Sep 17 00:00:00 2001 From: Matt Bovel Date: Wed, 11 Dec 2024 00:19:57 +0000 Subject: [PATCH] Fix LibrarySuite test --- .../common/src/it/scala/stainless/LibrarySuite.scala | 2 +- .../scala/stainless/frontends/dotc/DottyCompiler.scala | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontends/common/src/it/scala/stainless/LibrarySuite.scala b/frontends/common/src/it/scala/stainless/LibrarySuite.scala index ca645660d..94a1ed637 100644 --- a/frontends/common/src/it/scala/stainless/LibrarySuite.scala +++ b/frontends/common/src/it/scala/stainless/LibrarySuite.scala @@ -31,7 +31,7 @@ abstract class AbstractLibrarySuite(opts: Seq[inox.OptionValue[?]]) extends AnyF val ctx: inox.Context = stainless.TestContext(options) import ctx.{reporter, given} - val tryProgram = scala.util.Try(loadFiles(Seq.empty)._2) + val tryProgram = scala.util.Try(loadFiles(Main.libraryFiles)._2) it("should be extractable") { assert(tryProgram.isSuccess, "Extraction crashed with exception") assert(reporter.errorCount == 0, "Extraction had errors") diff --git a/frontends/dotty/src/main/scala/stainless/frontends/dotc/DottyCompiler.scala b/frontends/dotty/src/main/scala/stainless/frontends/dotc/DottyCompiler.scala index d2792451e..941544bfd 100644 --- a/frontends/dotty/src/main/scala/stainless/frontends/dotc/DottyCompiler.scala +++ b/frontends/dotty/src/main/scala/stainless/frontends/dotc/DottyCompiler.scala @@ -21,6 +21,7 @@ import inox.DebugSection import java.io.File import java.net.URL +import DottyReporter.NoReporter class DottyCompiler(ctx: inox.Context, callback: CallBack) extends Compiler { override def phases: List[List[Phase]] = { @@ -72,10 +73,13 @@ class DottyCompiler(ctx: inox.Context, callback: CallBack) extends Compiler { } } -private class DottyDriver(args: Seq[String], compiler: DottyCompiler, reporter: DottyReporter) extends Driver { +private class DottyDriver(args: Seq[String], compiler: DottyCompiler, reporter: SimpleReporter) extends Driver { override def newCompiler(using DottyContext) = compiler - lazy val files: List[String] = setup(args.toArray, initCtx).map(_._1.map(_.path)).getOrElse(Nil) + lazy val files: List[String] = + setup(args.toArray, initCtx.fresh.setReporter(NoReporter)) + .map(_._1.map(_.path)) + .getOrElse(reporter.reporter.internalError(f"Error parsing arguments from ${args.toList}")) def run(): Unit = process(args.toArray, reporter) }