diff options
20 files changed, 123 insertions, 124 deletions
diff --git a/src/dotty/tools/dotc/Bench.scala b/src/dotty/tools/dotc/Bench.scala index 6abad7e85..417054dce 100644 --- a/src/dotty/tools/dotc/Bench.scala +++ b/src/dotty/tools/dotc/Bench.scala @@ -8,19 +8,7 @@ package dotc import core.Contexts.Context import reporting.Reporter -/* To do: - * - simplify hk types - * - have a second look at normalization (leave at method types if pt is method type?) - * - Don't open package objects from class files if they are present in source - * - Revise the way classes are inherited - when not followed by [...] or (...), - * assume the unparameterized type and forward type parameters as we do now for the synthetic head class. - */ object Bench extends Driver { - def resident(compiler: Compiler): Reporter = unsupported("resident") /*loop { line => - val command = new CompilerCommand(line split "\\s+" toList, new Settings(scalacError)) - compiler.reporter.reset() - new compiler.Run() compile command.files - }*/ private var numRuns = 1 @@ -29,17 +17,13 @@ object Bench extends Driver { private def ntimes(n: Int)(op: => Reporter): Reporter = (emptyReporter /: (0 until n)) ((_, _) => op) - override def doCompile(compiler: Compiler, fileNames: List[String], reporter: Option[Reporter] = None) - (implicit ctx: Context): Reporter = - if (new config.Settings.Setting.SettingDecorator[Boolean](ctx.base.settings.resident).value(ctx)) - resident(compiler) - else - ntimes(numRuns) { - val start = System.nanoTime() - val r = super.doCompile(compiler, fileNames, reporter) - ctx.println(s"time elapsed: ${(System.nanoTime - start) / 1000000}ms") - r - } + override def doCompile(compiler: Compiler, fileNames: List[String])(implicit ctx: Context): Reporter = + ntimes(numRuns) { + val start = System.nanoTime() + val r = super.doCompile(compiler, fileNames) + println(s"time elapsed: ${(System.nanoTime - start) / 1000000}ms") + r + } def extractNumArg(args: Array[String], name: String, default: Int = 1): (Int, Array[String]) = { val pos = args indexOf name @@ -47,11 +31,11 @@ object Bench extends Driver { else (args(pos + 1).toInt, (args take pos) ++ (args drop (pos + 2))) } - override def process(args: Array[String], rootCtx: Context, reporter: Option[Reporter] = None): Reporter = { + override def process(args: Array[String], rootCtx: Context): Reporter = { val (numCompilers, args1) = extractNumArg(args, "#compilers") val (numRuns, args2) = extractNumArg(args1, "#runs") this.numRuns = numRuns - ntimes(numCompilers)(super.process(args2, rootCtx, reporter)) + ntimes(numCompilers)(super.process(args2, rootCtx)) } } diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala index e9b0a9676..a14aa3655 100644 --- a/src/dotty/tools/dotc/Compiler.scala +++ b/src/dotty/tools/dotc/Compiler.scala @@ -7,7 +7,7 @@ import Periods._ import Symbols._ import Scopes._ import typer.{FrontEnd, Typer, Mode, ImportInfo, RefChecks} -import reporting.{ConsoleReporter, Reporter} +import reporting.{Reporter, ConsoleReporter} import Phases.Phase import dotty.tools.dotc.transform._ import dotty.tools.dotc.transform.TreeTransforms.{TreeTransform, TreeTransformer} @@ -76,8 +76,7 @@ class Compiler { List(/*new PrivateToStatic,*/ new ExpandPrivate, new CollectEntryPoints, - new LabelDefs, - new TraitConstructors), + new LabelDefs), List(new GenBCode) ) @@ -94,7 +93,7 @@ class Compiler { * for type checking. * imports For each element of RootImports, an import context */ - def rootContext(implicit ctx: Context, r: Option[Reporter] = None): Context = { + def rootContext(implicit ctx: Context): Context = { ctx.definitions.init(ctx) ctx.setPhasePlan(phases) val rootScope = new MutableScope @@ -106,20 +105,22 @@ class Compiler { .setOwner(defn.RootClass) .setTyper(new Typer) .setMode(Mode.ImplicitsEnabled) - .setTyperState(new MutableTyperState(ctx.typerState, r.getOrElse(new ConsoleReporter()(ctx)), isCommittable = true)) + .setTyperState(new MutableTyperState(ctx.typerState, rootReporter(ctx), isCommittable = true)) ctx.definitions.init(start) // set context of definitions to start def addImport(ctx: Context, symf: () => Symbol) = ctx.fresh.setImportInfo(ImportInfo.rootImport(symf)(ctx)) (start.setRunInfo(new RunInfo(start)) /: defn.RootImportFns)(addImport) } + protected def rootReporter(implicit ctx: Context): Reporter = new ConsoleReporter()(ctx) + def reset()(implicit ctx: Context): Unit = { ctx.base.reset() ctx.runInfo.clear() } - def newRun(implicit ctx: Context, r: Option[Reporter] = None): Run = { + def newRun(implicit ctx: Context): Run = { reset() - new Run(this)(rootContext(ctx, r)) + new Run(this)(rootContext) } } diff --git a/src/dotty/tools/dotc/Driver.scala b/src/dotty/tools/dotc/Driver.scala index f5e41cbef..7e9d4a5e4 100644 --- a/src/dotty/tools/dotc/Driver.scala +++ b/src/dotty/tools/dotc/Driver.scala @@ -8,33 +8,40 @@ import scala.util.control.NonFatal abstract class Driver extends DotClass { - val prompt = "\ndotc>" + val prompt = "\ndotc> " protected def newCompiler(): Compiler protected def emptyReporter: Reporter = new StoreReporter - protected def doCompile(compiler: Compiler, fileNames: List[String], reporter: Option[Reporter] = None) - (implicit ctx: Context): Reporter = - if (fileNames.nonEmpty) { - val run = compiler.newRun(ctx, reporter) - run.compile(fileNames) - run.printSummary() - } else emptyReporter + protected def doCompile(compiler: Compiler, fileNames: List[String])(implicit ctx: Context): Reporter = + if (fileNames.nonEmpty) + try { + val run = compiler.newRun + run.compile(fileNames) + run.printSummary() + } + catch { + case ex: FatalError => + ctx.error(ex.getMessage) // signals that we should fail compilation. + ctx.typerState.reporter + } + else emptyReporter protected def initCtx = (new ContextBase).initialCtx - def process(args: Array[String], rootCtx: Context, reporter: Option[Reporter] = None): Reporter = { + protected def sourcesRequired = true + + def setup(args: Array[String], rootCtx: Context): (List[String], Context) = { val summary = CompilerCommand.distill(args)(rootCtx) implicit val ctx: Context = initCtx.fresh.setSettings(summary.sstate) - val fileNames = CompilerCommand.checkUsage(summary) - try { - doCompile(newCompiler(), fileNames, reporter) - } catch { - case ex: FatalError => - ctx.error(ex.getMessage) // signals that we should fail compilation. - ctx.typerState.reporter - } + val fileNames = CompilerCommand.checkUsage(summary, sourcesRequired) + (fileNames, ctx) + } + + def process(args: Array[String], rootCtx: Context): Reporter = { + val (fileNames, ctx) = setup(args, rootCtx) + doCompile(newCompiler(), fileNames)(ctx) } def main(args: Array[String]): Unit = diff --git a/src/dotty/tools/dotc/FromTasty.scala b/src/dotty/tools/dotc/FromTasty.scala index 1662d57e7..705deedd3 100644 --- a/src/dotty/tools/dotc/FromTasty.scala +++ b/src/dotty/tools/dotc/FromTasty.scala @@ -42,7 +42,7 @@ object FromTasty extends Driver { List(new ReadTastyTreesFromClasses) :: backendPhases } - override def newRun(implicit ctx: Context, reporter: Option[Reporter] = None): Run = { + override def newRun(implicit ctx: Context): Run = { reset() new TASTYRun(this)(rootContext) } diff --git a/src/dotty/tools/dotc/Main.scala b/src/dotty/tools/dotc/Main.scala index 9aafc83ef..699a57234 100644 --- a/src/dotty/tools/dotc/Main.scala +++ b/src/dotty/tools/dotc/Main.scala @@ -1,7 +1,3 @@ -/* NSC -- new Scala compiler - * Copyright 2005-2013 LAMP/EPFL - * @author Martin Odersky - */ package dotty.tools package dotc @@ -11,18 +7,5 @@ import reporting.Reporter /* To do: */ object Main extends Driver { - def resident(compiler: Compiler): Reporter = unsupported("resident") /*loop { line => - val command = new CompilerCommand(line split "\\s+" toList, new Settings(scalacError)) - compiler.reporter.reset() - new compiler.Run() compile command.files - }*/ - override def newCompiler(): Compiler = new Compiler - - override def doCompile(compiler: Compiler, fileNames: List[String], reporter: Option[Reporter] = None)(implicit ctx: Context): Reporter = { - if (new config.Settings.Setting.SettingDecorator[Boolean](ctx.base.settings.resident).value(ctx)) - resident(compiler) - else - super.doCompile(compiler, fileNames, reporter) - } } diff --git a/src/dotty/tools/dotc/Resident.scala b/src/dotty/tools/dotc/Resident.scala new file mode 100644 index 000000000..d671ea259 --- /dev/null +++ b/src/dotty/tools/dotc/Resident.scala @@ -0,0 +1,55 @@ +package dotty.tools +package dotc + +import core.Contexts.Context +import reporting.Reporter +import java.io.EOFException +import scala.annotation.tailrec + +/** A compiler which stays resident between runs. + * Usage: + * + * > scala dotty.tools.dotc.Resident <options> <initial files> + * + * dotc> "more options and files to compile" + * + * ... + * + * dotc> :reset // reset all options to the ones passed on the command line + * + * ... + * + * dotc> :q // quit + */ +object Resident extends Driver { + + object residentCompiler extends Compiler + + override def newCompiler(): Compiler = ??? + + override def sourcesRequired = false + + private val quit = ":q" + private val reset = ":reset" + + private def getLine() = { + Console.print(prompt) + try scala.io.StdIn.readLine() catch { case _: EOFException => quit } + } + + final override def process(args: Array[String], rootCtx: Context): Reporter = { + @tailrec def loop(args: Array[String], prevCtx: Context): Reporter = { + var (fileNames, ctx) = setup(args, prevCtx) + doCompile(residentCompiler, fileNames)(ctx) + var nextCtx = ctx + var line = getLine() + while (line == reset) { + nextCtx = rootCtx + line = getLine() + } + if (line.startsWith(quit)) ctx.typerState.reporter + else loop(line split "\\s+", nextCtx) + } + loop(args, rootCtx) + } +} diff --git a/src/dotty/tools/dotc/config/CompilerCommand.scala b/src/dotty/tools/dotc/config/CompilerCommand.scala index 3ba8db3ba..e34ca07f9 100644 --- a/src/dotty/tools/dotc/config/CompilerCommand.scala +++ b/src/dotty/tools/dotc/config/CompilerCommand.scala @@ -60,7 +60,7 @@ object CompilerCommand extends DotClass { * are already applied in context. * @return The list of files to compile. */ - def checkUsage(summary: ArgsSummary)(implicit ctx: Context): List[String] = { + def checkUsage(summary: ArgsSummary, sourcesRequired: Boolean)(implicit ctx: Context): List[String] = { val settings = ctx.settings /** Creates a help message for a subset of options based on cond */ @@ -121,8 +121,7 @@ object CompilerCommand extends DotClass { ctx.println(infoMessage) Nil } else { - if (summary.arguments.isEmpty && !settings.resident.value) - ctx.println(usageMessage) + if (sourcesRequired && summary.arguments.isEmpty) ctx.println(usageMessage) summary.arguments } } diff --git a/src/dotty/tools/dotc/config/ScalaSettings.scala b/src/dotty/tools/dotc/config/ScalaSettings.scala index 2ba907084..f8c155cad 100644 --- a/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -81,7 +81,6 @@ class ScalaSettings extends Settings.SettingGroup { val Xprintpos = BooleanSetting("-Xprint-pos", "Print tree positions, as offsets.") val printtypes = BooleanSetting("-Xprint-types", "Print tree types (debugging option).") val prompt = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).") - val resident = BooleanSetting("-Xresident", "Compiler stays resident: read source filenames from standard input.") val script = StringSetting("-Xscript", "object", "Treat the source file as a script and wrap it in a main method.", "") val mainClass = StringSetting("-Xmain-class", "path", "Class for manifest's Main-Class entry (only useful with -d <jar>)", "") val Xshowcls = StringSetting("-Xshow-class", "class", "Show internal representation of class.", "") diff --git a/src/dotty/tools/dotc/core/Flags.scala b/src/dotty/tools/dotc/core/Flags.scala index 759dff0d4..f39f2bac6 100644 --- a/src/dotty/tools/dotc/core/Flags.scala +++ b/src/dotty/tools/dotc/core/Flags.scala @@ -388,7 +388,7 @@ object Flags { /** Symbol is a self name */ final val SelfName = termFlag(54, "<selfname>") - /** Symbol is an implementation class */ + /** Symbol is an implementation class of a Scala2 trait */ final val ImplClass = typeFlag(54, "<implclass>") final val SelfNameOrImplClass = SelfName.toCommonFlags diff --git a/src/dotty/tools/dotc/core/NameOps.scala b/src/dotty/tools/dotc/core/NameOps.scala index dc94f6db1..4d6cca61d 100644 --- a/src/dotty/tools/dotc/core/NameOps.scala +++ b/src/dotty/tools/dotc/core/NameOps.scala @@ -62,7 +62,7 @@ object NameOps { def likeTyped(n: Name): N = (if (name.isTermName) n.toTermName else n.toTypeName).asInstanceOf[N] - def isConstructorName = name == CONSTRUCTOR || name == IMPLCLASS_CONSTRUCTOR + def isConstructorName = name == CONSTRUCTOR || name == TRAIT_CONSTRUCTOR def isExceptionResultName = name startsWith EXCEPTION_RESULT_PREFIX def isImplClassName = name endsWith IMPL_CLASS_SUFFIX def isLocalDummyName = name startsWith LOCALDUMMY_PREFIX diff --git a/src/dotty/tools/dotc/core/StdNames.scala b/src/dotty/tools/dotc/core/StdNames.scala index eaf4ce1e2..eb1a73625 100644 --- a/src/dotty/tools/dotc/core/StdNames.scala +++ b/src/dotty/tools/dotc/core/StdNames.scala @@ -232,7 +232,6 @@ object StdNames { val EVT2U: N = "evt2u$" val EQEQ_LOCAL_VAR: N = "eqEqTemp$" val FAKE_LOCAL_THIS: N = "this$" - val IMPLCLASS_CONSTRUCTOR: N = "$init$" val LAZY_LOCAL: N = "$lzy" val LAZY_LOCAL_INIT: N = "$lzyINIT" val LAZY_FIELD_OFFSET: N = "OFFSET$" @@ -261,6 +260,7 @@ object StdNames { val SKOLEM: N = "<skolem>" val SPECIALIZED_INSTANCE: N = "specInstance$" val THIS: N = "_$this" + val TRAIT_CONSTRUCTOR: N = "$init$" val U2EVT: N = "u2evt$" final val Nil: N = "Nil" diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index d8dddb082..164b0b8f3 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -530,7 +530,7 @@ object SymDenotations { final def isClassConstructor = name == nme.CONSTRUCTOR /** Is this the constructor of a trait? */ - final def isImplClassConstructor = name == nme.IMPLCLASS_CONSTRUCTOR + final def isImplClassConstructor = name == nme.TRAIT_CONSTRUCTOR /** Is this the constructor of a trait or a class */ final def isConstructor = name.isConstructorName @@ -1630,8 +1630,11 @@ object SymDenotations { override def fullName(implicit ctx: Context): Name = super.fullName override def primaryConstructor(implicit ctx: Context): Symbol = { - val cname = if (this is ImplClass) nme.IMPLCLASS_CONSTRUCTOR else nme.CONSTRUCTOR - info.decls.denotsNamed(cname).last.symbol // denotsNamed returns Symbols in reverse order of occurrence + def constrNamed(cname: TermName) = info.decls.denotsNamed(cname).last.symbol + // denotsNamed returns Symbols in reverse order of occurrence + if (this.is(ImplClass)) constrNamed(nme.TRAIT_CONSTRUCTOR) // ignore normal constructor + else + constrNamed(nme.CONSTRUCTOR).orElse(constrNamed(nme.TRAIT_CONSTRUCTOR)) } /** The parameter accessors of this class. Term and type accessors, diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala index 9498cf43c..53e8478fa 100644 --- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala +++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala @@ -438,7 +438,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas } val name1 = name0.adjustIfModuleClass(flags) - val name = if (name1 == nme.IMPLCLASS_CONSTRUCTOR) nme.CONSTRUCTOR else name1 + val name = if (name1 == nme.TRAIT_CONSTRUCTOR) nme.CONSTRUCTOR else name1 def isClassRoot = (name == classRoot.name) && (owner == classRoot.owner) && !(flags is ModuleClass) def isModuleClassRoot = (name == moduleClassRoot.name) && (owner == moduleClassRoot.owner) && (flags is Module) diff --git a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala index eb854d513..358b8d249 100644 --- a/src/dotty/tools/dotc/reporting/ThrowingReporter.scala +++ b/src/dotty/tools/dotc/reporting/ThrowingReporter.scala @@ -7,7 +7,8 @@ import collection.mutable import Reporter._ /** - * This class implements a Reporter that stores all messages + * This class implements a Reporter that throws all errors and sends warnings and other + * info to the underlying reporter. */ class ThrowingReporter(reportInfo: Reporter) extends Reporter { protected def doReport(d: Diagnostic)(implicit ctx: Context): Unit = d match { diff --git a/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala b/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala index 9f9d2dd67..116fee899 100644 --- a/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala +++ b/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala @@ -60,7 +60,7 @@ class AugmentScala2Traits extends MiniPhaseTransform with IdentityDenotTransform val mold = if (meth.isConstructor) meth.copySymDenotation( - name = nme.IMPLCLASS_CONSTRUCTOR, + name = nme.TRAIT_CONSTRUCTOR, info = MethodType(Nil, defn.UnitType)) else meth.ensureNotPrivate meth.copy( diff --git a/src/dotty/tools/dotc/transform/ExtensionMethods.scala b/src/dotty/tools/dotc/transform/ExtensionMethods.scala index f50e3324d..087e15c71 100644 --- a/src/dotty/tools/dotc/transform/ExtensionMethods.scala +++ b/src/dotty/tools/dotc/transform/ExtensionMethods.scala @@ -14,7 +14,7 @@ import core._ import Phases.Phase import Types._, Contexts._, Constants._, Names._, NameOps._, Flags._, DenotTransformers._ import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._, Scopes._, Denotations._ -import TypeErasure.{ erasure, valueErasure, ErasedValueType } +import TypeErasure.{ valueErasure, ErasedValueType } import TypeUtils._ import util.Positions._ import Decorators._ diff --git a/src/dotty/tools/dotc/transform/LinkScala2ImplClasses.scala b/src/dotty/tools/dotc/transform/LinkScala2ImplClasses.scala index 8c247130a..60e8edc26 100644 --- a/src/dotty/tools/dotc/transform/LinkScala2ImplClasses.scala +++ b/src/dotty/tools/dotc/transform/LinkScala2ImplClasses.scala @@ -50,7 +50,7 @@ class LinkScala2ImplClasses extends MiniPhaseTransform with IdentityDenotTransfo private def implMethod(meth: Symbol)(implicit ctx: Context): Symbol = meth.owner.implClass.info - .decl(if (meth.isConstructor) nme.IMPLCLASS_CONSTRUCTOR else meth.name) + .decl(if (meth.isConstructor) nme.TRAIT_CONSTRUCTOR else meth.name) .suchThat(c => FullParameterization.memberSignature(c.info) == meth.signature) .symbol diff --git a/src/dotty/tools/dotc/transform/Mixin.scala b/src/dotty/tools/dotc/transform/Mixin.scala index de6cde8f2..bebaf44f4 100644 --- a/src/dotty/tools/dotc/transform/Mixin.scala +++ b/src/dotty/tools/dotc/transform/Mixin.scala @@ -100,8 +100,10 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform => override def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation = if (sym.is(Accessor, butNot = Deferred) && sym.owner.is(Trait)) sym.copySymDenotation(initFlags = sym.flags &~ ParamAccessor | Deferred).ensureNotPrivate - else if (sym.isConstructor && sym.owner.is(Trait) && sym.info.firstParamTypes.nonEmpty) - sym.copySymDenotation(info = MethodType(Nil, sym.info.resultType)) + else if (sym.isConstructor && sym.owner.is(Trait)) + sym.copySymDenotation( + name = nme.TRAIT_CONSTRUCTOR, + info = MethodType(Nil, sym.info.resultType)) else sym @@ -231,8 +233,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform => cpy.Template(impl)( constr = - if (cls.is(Trait) && impl.constr.vparamss.flatten.nonEmpty) - cpy.DefDef(impl.constr)(vparamss = Nil :: Nil) + if (cls.is(Trait)) cpy.DefDef(impl.constr)(vparamss = Nil :: Nil) else impl.constr, parents = impl.parents.map(p => TypeTree(p.tpe).withPos(p.pos)), body = diff --git a/src/dotty/tools/dotc/transform/TraitConstructors.scala b/src/dotty/tools/dotc/transform/TraitConstructors.scala deleted file mode 100644 index 9fea468da..000000000 --- a/src/dotty/tools/dotc/transform/TraitConstructors.scala +++ /dev/null @@ -1,36 +0,0 @@ -package dotty.tools.dotc.transform - -import dotty.tools.dotc.ast.tpd -import dotty.tools.dotc.core.Contexts.Context -import dotty.tools.dotc.core.DenotTransformers.{SymTransformer, DenotTransformer} -import dotty.tools.dotc.core.Denotations.SingleDenotation -import dotty.tools.dotc.core.Phases.Phase -import dotty.tools.dotc.core.StdNames._ -import dotty.tools.dotc.core.SymDenotations.SymDenotation -import dotty.tools.dotc.core._ -import dotty.tools.dotc.transform.TreeTransforms.{MiniPhaseTransform, TransformerInfo} - -/*** - * Renames constructors in traits so that backend will call them with invokeInterface - * Also makes sure that renamed constructor bodies conforms to type of method - */ -class TraitConstructors extends MiniPhaseTransform with SymTransformer { - import dotty.tools.dotc.ast.tpd._ - def phaseName: String = "traitConstructors" - - override def treeTransformPhase: Phase = this.phase - - def transformSym(sym: SymDenotation)(implicit ctx: Context): SymDenotation = { - if (sym.isPrimaryConstructor && (sym.owner is Flags.Trait)) - sym.copySymDenotation(name = nme.IMPLCLASS_CONSTRUCTOR) - else sym - } - - override def transformDefDef(tree: tpd.DefDef)(implicit ctx: Context, info: TransformerInfo): tpd.Tree = { - val sym = tree.symbol - if (sym.isPrimaryConstructor && (sym.owner is Flags.Trait)) - cpy.DefDef(tree)(rhs = Block(List(tree.rhs), This(tree.symbol.enclosingClass.asClass))) - else tree - } - -} diff --git a/test/dotty/partest/DPDirectCompiler.scala b/test/dotty/partest/DPDirectCompiler.scala index b04214893..885de8c62 100644 --- a/test/dotty/partest/DPDirectCompiler.scala +++ b/test/dotty/partest/DPDirectCompiler.scala @@ -23,9 +23,11 @@ class DPDirectCompiler(runner: DPTestRunner) extends nest.DirectCompiler(runner) } try { - val processor = if (opts0.exists(_.startsWith("#"))) dotty.tools.dotc.Bench else dotty.tools.dotc.Main + val processor = + if (opts0.exists(_.startsWith("#"))) dotty.tools.dotc.Bench else dotty.tools.dotc.Main val clogger = new ConsoleReporter(writer = clogWriter)(ctx) - val reporter = processor.process((sources.map(_.toString) ::: opts0).toArray, ctx, Some(clogger)) + val logCtx = ctx.fresh.setTyperState(ctx.typerState.withReporter(clogger)) + val reporter = processor.process((sources.map(_.toString) ::: opts0).toArray, logCtx) if (!reporter.hasErrors) runner.genPass() else { reporter.printSummary(ctx) |