From 73fad44a11dafa507e1d358f1bc222b04319a594 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Wed, 3 Feb 2016 22:42:36 +0100 Subject: Driver: properly use root Context passed as argument Also CompilerTest no longer runs the compiler with the context DottyTest#ctx. Previously, we got away with this because Compiler#process ignored it and created a new Context, but this commit fixes this, and it is now very important that we use a different context for every test we compile. Since DottyTest#ctx was the only part of DottyTest we used, CompilerTest no longer extends DottyTest to make sure that we do not use it accidentally. If we want to use DottyTest as a base class for tests again, we will have to remove its implicit Context field first. Also do not try to initialize the definitions in the context used by partest, this is not necessary. --- test/test/CompilerTest.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/test/CompilerTest.scala') diff --git a/test/test/CompilerTest.scala b/test/test/CompilerTest.scala index c65710e7d..526392576 100644 --- a/test/test/CompilerTest.scala +++ b/test/test/CompilerTest.scala @@ -33,7 +33,7 @@ import org.junit.Test * object Test { def main(args: Array[String]): Unit = ... } * Classpath jars can be added to partestDeps in the sbt Build.scala. */ -abstract class CompilerTest extends DottyTest { +abstract class CompilerTest { /** Override with output dir of test so it can be patched. Partest expects * classes to be in partest-generated/[kind]/[testname]-[kind].obj/ */ @@ -181,7 +181,7 @@ abstract class CompilerTest extends DottyTest { private def compileArgs(args: Array[String], xerrors: Int = 0)(implicit defaultOptions: List[String]): Unit = { val allArgs = args ++ defaultOptions val processor = if (allArgs.exists(_.startsWith("#"))) Bench else Main - val nerrors = processor.process(allArgs, ctx).errorCount + val nerrors = processor.process(allArgs).errorCount assert(nerrors == xerrors, s"Wrong # of errors. Expected: $xerrors, found: $nerrors") } -- cgit v1.2.3