From 8978ae6dfabae562fb5dcf4c7f66983d4d865892 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sat, 7 Nov 2015 12:58:33 +0100 Subject: First versions of Definitions based on TypeRefs not Symbols. Symbols are not stable between runs, so if some symbol referred to from Definitions gets recompiled, there are then two Symbols that are both visible, one referenced from Definitions, the other the one that got compiled. Thos led to a crash when e.g. compiling scala.Short, because the newly compiled symbol was not recognized as a primitive value class. The present commit tries to make systematic changes without regard to simplicity or aesthetics. This will be polished in future commits. // ### comments signal areas that need further attention. --- src/dotty/tools/dotc/Compiler.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/Compiler.scala') diff --git a/src/dotty/tools/dotc/Compiler.scala b/src/dotty/tools/dotc/Compiler.scala index bf3dbb232..4e96a6c8a 100644 --- a/src/dotty/tools/dotc/Compiler.scala +++ b/src/dotty/tools/dotc/Compiler.scala @@ -5,6 +5,7 @@ import core._ import Contexts._ import Periods._ import Symbols._ +import Types._ import Scopes._ import typer.{FrontEnd, Typer, Mode, ImportInfo, RefChecks} import reporting.{Reporter, ConsoleReporter} @@ -111,8 +112,8 @@ class Compiler { .setMode(Mode.ImplicitsEnabled) .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)) + def addImport(ctx: Context, refFn: () => TermRef) = + ctx.fresh.setImportInfo(ImportInfo.rootImport(refFn)(ctx)) (start.setRunInfo(new RunInfo(start)) /: defn.RootImportFns)(addImport) } -- cgit v1.2.3