diff options
-rw-r--r-- | src/dotty/tools/dotc/printing/RefinedPrinter.scala | 13 | ||||
-rw-r--r-- | test/dotc/tests.scala | 11 |
2 files changed, 18 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala index 9b2d30fdf..dcbf92cfe 100644 --- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -252,6 +252,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { prefix ~ (" extends" provided !ofNew) ~~ parentsText ~~ bodyText } + def toTextPackageId(pid: Tree): Text = + if (homogenizedView) toTextLocal(pid.tpe) + else toTextLocal(pid) + var txt: Text = tree match { case id: Trees.BackquotedIdent[_] if !homogenizedView => "`" ~ toText(id.name) ~ "`" @@ -282,7 +286,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { case TypeApply(fun, args) => toTextLocal(fun) ~ "[" ~ toTextGlobal(args, ", ") ~ "]" case Literal(c) => - toText(c) + tree.typeOpt match { + case ConstantType(tc) => toText(tc) + case _ => toText(c) + } case New(tpt) => "new " ~ { tpt match { @@ -404,7 +411,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { } val bodyText = if (currentPrecedence == TopLevelPrec) "\n" ~ statsText else " {" ~ statsText ~ "}" - "package " ~ toTextLocal(pid) ~ bodyText + "package " ~ toTextPackageId(pid) ~ bodyText case tree: Template => toTextTemplate(tree) case Annotated(annot, arg) => @@ -509,7 +516,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { def optText[T >: Untyped](tree: List[Tree[T]])(encl: Text => Text): Text = if (tree.exists(!_.isEmpty)) encl(blockText(tree)) else "" - + override protected def polyParamName(name: TypeName): TypeName = name.unexpandedName diff --git a/test/dotc/tests.scala b/test/dotc/tests.scala index 39dd16dc9..303bf46cd 100644 --- a/test/dotc/tests.scala +++ b/test/dotc/tests.scala @@ -19,6 +19,11 @@ class tests extends CompilerTest { "-d", "./out/" ) + val doEmitBytecode = List("-Ystop-before:terminal") + val failedbyName = List("-Ystop-before:collectEntryPoints") // #288 + val failedUnderscore = List("-Ystop-before:collectEntryPoints") // #289 + val testPickling = List("-Xprint-types", "-Ytest-pickler", "-Ystop-after:pickler") + val failedOther = List("-Ystop-before:collectEntryPoints") // some non-obvious reason. need to look deeper val twice = List("#runs", "2", "-YnoDoubleBindings") val staleSymbolError: List[String] = List() @@ -32,8 +37,8 @@ class tests extends CompilerTest { val newDir = "./tests/new/" val dotcDir = "./src/dotty/" - @Test def pickle_pickleOK = compileDir(posDir + "pickleOK/", "-Xprint-types" :: testPickling) - @Test def pickle_pickling = compileDir(dotcDir + "tools/dotc/core/pickling", testPickling) + @Test def pickle_pickleOK = compileDir(posDir + "pickleOK/", testPickling) + @Test def pickle_pickling = compileDir(dotcDir + "tools/dotc/core/pickling/", testPickling) @Test def pos_t2168_pat = compileFile(posDir, "t2168") @Test def pos_erasure = compileFile(posDir, "erasure") @@ -175,6 +180,6 @@ class tests extends CompilerTest { val javaDir = "./tests/pos/java-interop/" @Test def java_all = compileFiles(javaDir) - + //@Test def dotc_compilercommand = compileFile(dotcDir + "tools/dotc/config/", "CompilerCommand") } |