diff options
-rw-r--r-- | src/dotty/tools/dotc/config/Printers.scala | 5 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 14 | ||||
-rw-r--r-- | test/dotc/tests.scala | 23 |
4 files changed, 19 insertions, 26 deletions
diff --git a/src/dotty/tools/dotc/config/Printers.scala b/src/dotty/tools/dotc/config/Printers.scala index 407e93714..7f9c73926 100644 --- a/src/dotty/tools/dotc/config/Printers.scala +++ b/src/dotty/tools/dotc/config/Printers.scala @@ -11,10 +11,11 @@ object Printers { } val core: Printer = noPrinter - val typr: Printer = new Printer - val constr: Printer = new Printer + val typr: Printer = noPrinter + val constr: Printer = noPrinter val overload: Printer = noPrinter val implicits: Printer = noPrinter val unapp: Printer = noPrinter + val completions = noPrinter }
\ No newline at end of file diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 58f148ba5..18b5c5f8f 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -12,6 +12,7 @@ import Decorators.SymbolIteratorDecorator import annotation.tailrec import util.SimpleMap import config.Config +import config.Printers._ trait SymDenotations { this: Context => import SymDenotations._ @@ -127,7 +128,7 @@ object SymDenotations { if (myFlags is Touched) throw new CyclicReference(this) myFlags |= Touched - Context.theBase.initialCtx.debugTraceIndented(s"completing ${this.debugString}") { + Context.theBase.initialCtx.traceIndented(completions, s"completing ${this.debugString}") { // println("completing " + debugString) completer.complete(this) } diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 317827129..c0e39c44c 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -327,7 +327,8 @@ class Namer { typer: Typer => private def typeSig(sym: Symbol): Type = original match { case original: ValDef => - valOrDefDefSig(original, sym, Nil, identity)(localContext(sym).withNewScope) + if (sym is Module) moduleValSig(sym) + else valOrDefDefSig(original, sym, Nil, identity)(localContext(sym).withNewScope) case original: DefDef => val typer1 = new Typer nestedTyper(sym) = typer1 @@ -420,6 +421,17 @@ class Namer { typer: Typer => for (param <- params) typedAheadExpr(param) } + /** The signature of a module valdef. + * This will compute the corresponding module class TypeRef immediately + * without going through the defined type of the ValDef. This is necessary + * to avoid cyclic references involving imports and module val defs. + */ + def moduleValSig(sym: Symbol)(implicit ctx: Context): Type = { + val clsName = sym.name.moduleClassName + val cls = ctx.denotNamed(clsName) suchThat (_ is ModuleClass) + ctx.owner.thisType select (clsName, cls) + } + /** The type signature of a ValDef or DefDef * @param mdef The definition * @param sym Its symbol diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 77cfdd39e..fab5cab09 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -46,28 +46,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 dotc1 = compileFile(dotcDir + "tools/dotc/core/", "Annotations") - @Test def dotc2 = compileFile(dotcDir + "tools/dotc/core/", "Constants") - @Test def dotc3 = compileFile(dotcDir + "tools/dotc/core/", "Constraint") - @Test def dotc4 = compileFile(dotcDir + "tools/dotc/core/", "Contexts") - @Test def dotc5 = compileFile(dotcDir + "tools/dotc/core/", "Decorators") - @Test def dotc6 = compileFile(dotcDir + "tools/dotc/core/", "Definitions") - @Test def dotc7 = compileFile(dotcDir + "tools/dotc/core/", "Denotations") - @Test def dotc8 = compileFile(dotcDir + "tools/dotc/core/", "DotClass") - @Test def dotc9 = compileFile(dotcDir + "tools/dotc/core/", "Flags") - @Test def dotc10 = compileFile(dotcDir + "tools/dotc/core/", "NameOps") - @Test def dotc11 = compileFile(dotcDir + "tools/dotc/core/", "Names") - @Test def dotc12 = compileFile(dotcDir + "tools/dotc/core/", "Periods") - @Test def dotc13 = compileFile(dotcDir + "tools/dotc/core/", "Phases") - @Test def dotc14 = compileFile(dotcDir + "tools/dotc/core/", "Scopes") - @Test def dotc15 = compileFile(dotcDir + "tools/dotc/core/", "Signature") - @Test def dotc16 = compileFile(dotcDir + "tools/dotc/core/", "StdNames") - @Test def dotc17 = compileFile(dotcDir + "tools/dotc/core/", "Substituters") - @Test def dotc18 = compileFile(dotcDir + "tools/dotc/core/", "SymbolLoaders") - @Test def dotc19 = compileFile(dotcDir + "tools/dotc/core/", "Symbols") - @Test def dotc20 = compileFile(dotcDir + "tools/dotc/core/", "SymDenotations") - - + @Test def dotc_core = compileDir(dotcDir + "tools/dotc/core") // @Test def dotc_compilercommand = compileFile(dotcDir + "tools/dotc/config/", "CompilerCommand") |