aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r--src/dotty/tools/dotc/core/Constants.scala2
-rw-r--r--src/dotty/tools/dotc/core/Contexts.scala6
-rw-r--r--src/dotty/tools/dotc/core/Decorators.scala2
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala4
-rw-r--r--src/dotty/tools/dotc/core/Printers.scala539
-rw-r--r--src/dotty/tools/dotc/core/Scopes.scala4
-rw-r--r--src/dotty/tools/dotc/core/Showable.scala12
-rw-r--r--src/dotty/tools/dotc/core/Symbols.scala4
-rw-r--r--src/dotty/tools/dotc/core/Trees.scala2
-rw-r--r--src/dotty/tools/dotc/core/Types.scala6
-rw-r--r--src/dotty/tools/dotc/core/pickling/UnPickler.scala2
11 files changed, 16 insertions, 567 deletions
diff --git a/src/dotty/tools/dotc/core/Constants.scala b/src/dotty/tools/dotc/core/Constants.scala
index 0b4f51cf2..cdfb62a18 100644
--- a/src/dotty/tools/dotc/core/Constants.scala
+++ b/src/dotty/tools/dotc/core/Constants.scala
@@ -21,7 +21,7 @@ object Constants {
// For supporting java enumerations inside java annotations (see ClassfileParser)
final val EnumTag = 13
- case class Constant(value: Any) extends Showable {
+ case class Constant(value: Any) extends printing.Showable {
import java.lang.Double.doubleToRawLongBits
import java.lang.Float.floatToRawIntBits
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala
index 3eb0f573a..e6bd5a843 100644
--- a/src/dotty/tools/dotc/core/Contexts.scala
+++ b/src/dotty/tools/dotc/core/Contexts.scala
@@ -8,7 +8,7 @@ import Names._
import Phases._
import Types._
import Symbols._
-import TypeComparers._, Printers._, NameOps._, SymDenotations._, util.Positions._
+import TypeComparers._, printing.Printers._, NameOps._, SymDenotations._, util.Positions._
import TypedTrees.tpd._, util.FreshNameCreator
import config.Settings._
import config.ScalaSettings
@@ -43,7 +43,7 @@ object Contexts {
with Substituters
with TypeOps
with Phases
- with Printers
+ with printing.Printers
with Symbols
with SymDenotations
with Reporting
@@ -367,7 +367,7 @@ object Contexts {
// Printers state
/** Number of recursive invocations of a show method on cuyrrent stack */
- private[core] var toTextRecursions = 0
+ private[dotc] var toTextRecursions = 0
// Reporters state
private[dotc] var indent = 0
diff --git a/src/dotty/tools/dotc/core/Decorators.scala b/src/dotty/tools/dotc/core/Decorators.scala
index 2d6526c26..2f91aa59a 100644
--- a/src/dotty/tools/dotc/core/Decorators.scala
+++ b/src/dotty/tools/dotc/core/Decorators.scala
@@ -3,7 +3,7 @@ package core
import annotation.tailrec
import Symbols._
-import Contexts._, Names._, Phases._, util.Texts._
+import Contexts._, Names._, Phases._, printing.Texts._
/** This object provides useful implicit decorators for types defined elsewhere */
object Decorators {
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala
index 66baeef55..e30e230b1 100644
--- a/src/dotty/tools/dotc/core/Denotations.scala
+++ b/src/dotty/tools/dotc/core/Denotations.scala
@@ -9,7 +9,7 @@ import Names.TypeName
import Symbols.NoSymbol
import Symbols._
import Types._, Periods._, Flags._, Transformers._
-import util.Texts._
+import printing.Texts._
import io.AbstractFile
import Decorators.SymbolIteratorDecorator
@@ -109,7 +109,7 @@ object Denotations {
*
* Then the denotation of `y` is `SingleDenotation(NoSymbol, A | B)`.
*/
- abstract class Denotation extends DotClass with Showable {
+ abstract class Denotation extends DotClass with printing.Showable {
/** The referencing symbol, exists only for non-overloaded denotations */
def symbol: Symbol
diff --git a/src/dotty/tools/dotc/core/Printers.scala b/src/dotty/tools/dotc/core/Printers.scala
deleted file mode 100644
index 51cb01e02..000000000
--- a/src/dotty/tools/dotc/core/Printers.scala
+++ /dev/null
@@ -1,539 +0,0 @@
-package dotty.tools.dotc
-package core
-
-import Types._, Symbols._, Contexts._, Scopes._, Names._, NameOps._, Flags._
-import Constants._, Annotations._, StdNames._, Denotations._, SymDenotations._, Trees._
-import util.Texts._
-import java.lang.Integer.toOctalString
-import scala.annotation.switch
-
-trait Printers { this: Context =>
-
- import Printers._
-
- def printer = if (this.debug) plainPrinter else refinedPrinter
-
-}
-
-object Printers {
-
- class Precedence(val value: Int) extends AnyVal {
- def parenthesize(nested: Precedence)(text: Text) =
- if (nested.value < value) "(" ~ text ~ ")" else text
- }
-
- val DotPrec = new Precedence(4)
- val AndPrec = new Precedence(3)
- val OrPrec = new Precedence(2)
- val WithPrec = new Precedence(1)
- val LeftArrowPrec = new Precedence(1)
- val GlobalPrec = new Precedence(0)
-
- abstract class Printer {
-
- /** The name, possibley with with namespace suffix if debugNames is set:
- * /L for local names, /V for other term names, /T for type names
- */
- def nameString(name: Name): String
-
- /** The name of the given symbol.
- * If !settings.debug, the original name where
- * expansions of operators are translated back to operator symbol.
- * E.g. $eq => =.
- * If settings.uniqid, adds id.
- */
- def nameString(sym: Symbol): String
-
- /** The fully qualified name of the symbol */
- def fullNameString(sym: Symbol): String
-
- /** The kind of the symbol */
- def kindString(sym: Symbol): String
-
- /** Textual representation, including symbol's kind e.g., "class Foo", "method Bar".
- * If hasMeaninglessName is true, uses the owner's name to disambiguate identity.
- */
- def toText(sym: Symbol): Text
-
- /** Textual representation of symbol's declaration */
- def dclText(sym: Symbol): Text
-
- /** If symbol's owner is a printable class C, the text "in C", otherwise "" */
- def locationText(sym: Symbol): Text
-
- /** Textual representation of symbol and its location */
- def locatedText(sym: Symbol): Text
-
- /** Textual representation of denotation */
- def toText(denot: Denotation): Text
-
- /** Textual representation of constant */
- def toText(const: Constant): Text
-
- /** Textual representation of annotation */
- def toText(annot: Annotation): Text
-
- /** Textual representation of type in context with given precedence */
- def toText(tp: Type, precedence: Precedence): Text
-
- /** Textual representation of all symbols in given list,
- * using `dclText` for displaying each.
- */
- def dclsText(syms: List[Symbol], sep: String = "\n"): Text
-
- /** Textual representation of all definitions in a scope using `dclText` for each */
- def toText(sc: Scope): Text
-
- /** Textual representation of tree */
- def toText[T >: Untyped](tree: Tree[T]): Text
- }
-
- class PlainPrinter(_ctx: Context) extends Printer {
- protected[this] implicit val ctx = _ctx
-
- def controlled(op: => Text): Text =
- if (ctx.toTextRecursions < maxToTextRecursions)
- try {
- ctx.toTextRecursions += 1
- op
- } finally {
- ctx.toTextRecursions -= 1
- }
- else {
- recursionLimitExceeeded()
- "..."
- }
-
- protected def recursionLimitExceeeded() = {
- ctx.warning("Exceeded recursion depth attempting to print type.")
- (new Throwable).printStackTrace
- }
-
- /** If the name of the symbol's owner should be used when you care about
- * seeing an interesting name: in such cases this symbol is e.g. a method
- * parameter with a synthetic name, a constructor named "this", an object
- * "package", etc. The kind string, if non-empty, will be phrased relative
- * to the name of the owner.
- */
- protected def hasMeaninglessName(sym: Symbol) = (
- (sym is Param) && sym.owner.isSetter // x$1
- || sym.isClassConstructor // this
- || (sym.name == nme.PACKAGE) // package
- )
-
- def nameString(name: Name): String = name.toString + {
- if (ctx.settings.debugNames.value)
- if (name.isLocalName) "/L"
- else if (name.isTypeName) "/T"
- else "/V"
- else ""
- }
-
- /** String representation of a name used in a refinement
- * In refined printing this undoes type parameter expansion
- */
- protected def refinementNameString(tp: RefinedType) = nameString(tp.refinedName)
-
- /** String representation of a refinement */
- protected def toTextRefinement(rt: RefinedType) =
- (refinementNameString(rt) ~ toTextRHS(rt.refinedInfo)).close
-
- /** The longest sequence of refinement types, starting at given type
- * and following parents.
- */
- private def refinementChain(tp: Type): List[Type] =
- tp :: (tp match {
- case RefinedType(parent, _) => refinementChain(parent)
- case _ => Nil
- })
-
- def toText(tp: Type, prec: Precedence): Text = controlled {
- tp match {
- case tp: TypeType =>
- toTextRHS(tp)
- case tp: SingletonType =>
- val pre = toTextPrefix(tp)
- if (pre.lastLine.endsWith(".")) pre ~ "type"
- else fullNameString(tp.typeSymbol.skipPackageObject) ~ ".type"
- case TypeRef(pre, name) =>
- toTextPrefix(pre) ~ nameString(tp.typeSymbol)
- case tp: RefinedType =>
- // return tp.toString // !!! DEBUG
- val parent :: (refined: List[RefinedType]) =
- refinementChain(tp).reverse
- toTextLocal(parent) ~ "{" ~
- Text(refined.map(toTextRefinement), "; ").close ~ "}"
- case AndType(tp1, tp2) =>
- (prec parenthesize AndPrec) {
- toText(tp1, AndPrec) ~ " & " ~ toText(tp2, AndPrec)
- }
- case OrType(tp1, tp2) =>
- (prec parenthesize OrPrec) {
- toText(tp1, OrPrec) ~ " | " ~ toText(tp2, OrPrec)
- }
- case ErrorType =>
- "<error>"
- case WildcardType =>
- "?"
- case NoType =>
- "<notype>"
- case NoPrefix =>
- "<noprefix>"
- case tp: MethodType =>
- (prec parenthesize GlobalPrec) {
- (if (tp.isImplicit) "(implicit " else "(") ~
- Text(
- (tp.paramNames, tp.paramTypes).zipped
- .map((name, tp) => nameString(name) ~ ": " ~ toTextGlobal(tp)),
- ", ") ~
- ")" ~ toTextGlobal(tp.resultType)
- }
- case tp: ExprType =>
- (prec parenthesize GlobalPrec) {
- "=> " ~ toTextGlobal(tp.resultType)
- }
- case tp: PolyType =>
- (prec parenthesize GlobalPrec) {
- "[" ~
- Text(
- (tp.paramNames, tp.paramBounds).zipped
- .map((name, bounds) =>
- nameString(polyParamName(name)) ~ toTextGlobal(bounds)),
- ", ") ~
- "]" ~ toTextGlobal(tp.resultType)
- }
- case PolyParam(pt, n) =>
- nameString(polyParamName(pt.paramNames(n)))
- case AnnotatedType(annot, tpe) =>
- toTextLocal(tpe) ~ " " ~ toText(annot)
- }
- }.close
-
- protected def polyParamName(name: TypeName): TypeName = name
-
- /** Render type within highest precedence */
- protected def toTextLocal(tp: Type) = toText(tp, DotPrec)
-
- /** Render type within lowest precedence */
- protected def toTextGlobal(tp: Type) = toText(tp, GlobalPrec)
-
- /** The name of the symbol without a unique id. Under refined printing,
- * the decoded original name.
- */
- protected def simpleNameString(sym: Symbol): String = nameString(sym.name)
-
- /** The unique id of symbol, after a # */
- protected def idString(sym: Symbol): String =
- if (ctx.settings.uniqid.value) "#" + sym.id else ""
-
- def nameString(sym: Symbol): String = simpleNameString(sym) + idString(sym)
-
- def fullNameString(sym: Symbol): String =
- if (sym.isRoot || sym == NoSymbol || sym.owner.isEffectiveRoot)
- nameString(sym)
- else
- fullNameString(sym.effectiveOwner.enclosingClass) + "." + nameString(sym)
-
- protected def objectPrefix = "object "
- protected def packagePrefix = "package "
-
- protected def trimPrefix(text: Text) =
- text.stripPrefix(objectPrefix).stripPrefix(packagePrefix)
-
- /** The string representation of this type used as a prefix */
- protected def toTextPrefix(tp: Type): Text = controlled {
- tp match {
- case tp @ TermRef(pre, name) =>
- toTextPrefix(pre) ~ nameString(tp.symbol) ~ "."
- case ThisType(cls) =>
- nameString(cls) + ".this."
- case SuperType(thistpe, _) =>
- toTextPrefix(thistpe).map(_.replaceAll("""\bthis\.$""", "super."))
- case tp @ ConstantType(value) =>
- toTextLocal(tp.underlying) ~ "(" ~ toText(value) ~ ")."
- case MethodParam(mt, idx) =>
- nameString(mt.paramNames(idx)) + "."
- case RefinedThis(_) =>
- "this."
- case NoPrefix =>
- ""
- case _ =>
- trimPrefix(toTextLocal(tp)) ~ "#"
- }
- }
-
- protected def isOmittablePrefix(sym: Symbol) =
- (defn.UnqualifiedOwners contains sym) || isEmptyPrefix(sym)
-
- protected def isEmptyPrefix(sym: Symbol) =
- sym.isEffectiveRoot || sym.isAnonymousClass || sym.name.isReplWrapperName
-
- /** String representation of a definition's type following its name */
- protected def toTextRHS(tp: Type): Text = controlled {
- tp match {
- case TypeBounds(lo, hi) =>
- if (lo eq hi)
- " = " ~ lo.toText
- else
- (if (lo == defn.NothingType) Text() else " >: " ~ lo.toText) ~
- (if (hi == defn.AnyType) Text() else " <: " ~ hi.toText)
- case ClassInfo(pre, cls, cparents, decls, optSelfType) =>
- val preText = toTextLocal(pre)
- val (tparams, otherDecls) = decls.toList partition treatAsTypeParam
- val tparamsText =
- if (tparams.isEmpty) Text() else ("[" ~ dclsText(tparams) ~ "]").close
- val selfText =
- if (optSelfType.exists)
- "this: " ~ toText(optSelfType, LeftArrowPrec) ~ " =>"
- else Text()
- val parentsText = Text(cparents.map(p =>
- toText(reconstituteParent(cls, p), WithPrec)), " with ")
- val trueDecls = otherDecls.filterNot(treatAsTypeArg)
- val declsText = if (trueDecls.isEmpty) Text() else dclsText(trueDecls)
- tparamsText ~ " extends " ~ parentsText ~ "{" ~ selfText ~ declsText ~
- "} at " ~ preText
- case _ =>
- ": " ~ toTextGlobal(tp)
- }
- }
-
- protected def treatAsTypeParam(sym: Symbol): Boolean = false
- protected def treatAsTypeArg(sym: Symbol): Boolean = false
- protected def reconstituteParent(cls: ClassSymbol, parent: Type): Type = parent
-
- /** String representation of symbol's kind. */
- def kindString(sym: Symbol): String = {
- val flags = sym.flagsUNSAFE
- if (flags is PackageClass) "package class"
- else if (flags is PackageVal) "package"
- else if (sym.isPackageObject)
- if (sym.isClass) "package object class"
- else "package object"
- else if (sym.isAnonymousClass) "anonymous class"
- else if (flags is ModuleClass) "module class"
- else if (flags is ModuleVal) "module"
- else if (flags is ImplClass) "implementation class"
- else if (flags is Trait) "trait"
- else if (sym.isClass) "class"
- else if (sym.isType) "type"
- else if (sym.isGetter) "getter"
- else if (sym.isSetter) "setter"
- else if (flags is Lazy) "lazy value"
- else if (flags is Mutable) "variable"
- else if (sym.isClassConstructor && sym.isPrimaryConstructor) "primary constructor"
- else if (sym.isClassConstructor) "constructor"
- else if (sym.isSourceMethod) "method"
- else if (sym.isTerm) "value"
- else ""
- }
-
- /** String representation of symbol's definition key word */
- protected def keyString(sym: Symbol): String = {
- val flags = sym.flagsUNSAFE
- if (flags is JavaInterface) "interface"
- else if ((flags is Trait) && !(flags is ImplClass)) "trait"
- else if (sym.isClass) "class"
- else if (sym.isType) "type"
- else if (flags is Mutable) "var"
- else if (flags is Package) "package"
- else if (flags is Module) "object"
- else if (sym.isSourceMethod) "def"
- else if (sym.isTerm && (!(flags is Param))) "val"
- else ""
- }
-
- /** String representation of symbol's flags */
- protected def toTextFlags(sym: Symbol): Text =
- Text(sym.flags.flagStrings map stringToText, " ")
-
- /** String representation of symbol's variance or "" if not applicable */
- protected def varianceString(sym: Symbol): String = sym.variance match {
- case -1 => "-"
- case 1 => "+"
- case _ => ""
- }
-
- def dclText(sym: Symbol): Text =
- (toTextFlags(sym) ~~ keyString(sym) ~~
- (varianceString(sym) ~ nameString(sym)) ~ toTextRHS(sym.info)).close
-
- def toText(sym: Symbol): Text =
- (kindString(sym) ~~ {
- if (hasMeaninglessName(sym)) simpleNameString(sym.owner) + idString(sym)
- else nameString(sym)
- }).close
-
- def locationText(sym: Symbol): Text = {
- val owns = sym.effectiveOwner
- if (owns.isClass && !isEmptyPrefix(owns)) " in " ~ toText(owns) else Text()
- }
-
- def locatedText(sym: Symbol): Text =
- (toText(sym) ~ locationText(sym)).close
-
- def toText(denot: Denotation): Text = toText(denot.symbol) ~ "/D"
-
- @switch private def escapedChar(ch: Char): String = ch match {
- case '\b' => "\\b"
- case '\t' => "\\t"
- case '\n' => "\\n"
- case '\f' => "\\f"
- case '\r' => "\\r"
- case '"' => "\\\""
- case '\'' => "\\\'"
- case '\\' => "\\\\"
- case _ => if (ch.isControl) "\\0" + toOctalString(ch) else String.valueOf(ch)
- }
-
- def toText(const: Constant): Text = const.tag match {
- case StringTag => "\"" + (const.value.toString flatMap escapedChar) + "\""
- case ClazzTag => "classOf[" ~ const.tpe.toText ~ "]"
- case CharTag => s"'${escapedChar(const.charValue)}'"
- case LongTag => const.longValue.toString + "L"
- case EnumTag => const.symbolValue.name.toString
- case _ => String.valueOf(const.value)
- }
-
- def toText(annot: Annotation): Text = s"@${annot.symbol.name}" // for now
-
- def dclsText(syms: List[Symbol], sep: String): Text =
- if (sep == "\n") Text.lines(syms map dclText)
- else Text(syms map dclText, sep)
-
- def toText(sc: Scope): Text =
- ("Scope{" ~ dclsText(sc.toList) ~ "}").close
-
- def toText[T >: Untyped](tree: Tree[T]): Text = {
- tree match {
- case node: Positioned =>
- def toTextElem(elem: Any): Text = elem match {
- case elem: Showable => elem.toText
- case elem: List[_] => "List(" ~ Text(elem map toTextElem, ",") ~ ")"
- case elem => elem.toString
- }
- val nodeName = node.productPrefix
- val elems =
- Text(node.productIterator.map(toTextElem).toList, ", ")
- val tpSuffix =
- if (ctx.settings.printtypes.value && tree.hasType)
- " | " ~ tree.tpe.asInstanceOf[Type].toText
- else
- Text()
-
- nodeName ~ "(" ~ elems ~ tpSuffix ~ ")" ~ node.pos.toString
- case _ =>
- tree.toString: Text
- }
- }.close // todo: override in refined printer
- }
-
- class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
- override protected def recursionLimitExceeeded() = {}
-
- override def nameString(name: Name): String = name.toString
-
- override protected def simpleNameString(sym: Symbol): String = {
- var name = sym.originalName
- if (sym is ModuleClass) name = name.stripModuleClassSuffix
- name.decode.toString
- }
-
- override def toTextPrefix(tp: Type): Text = controlled {
- tp match {
- case ThisType(cls) =>
- if (cls.isAnonymousClass) return "this."
- if (isOmittablePrefix(cls)) return ""
- if (cls is ModuleClass) return fullNameString(cls) + "."
- case tp @ TermRef(pre, name) =>
- val sym = tp.symbol
- if (sym.isPackageObject) return toTextPrefix(pre)
- if (isOmittablePrefix(sym)) return ""
- case _ =>
- }
- super.toTextPrefix(tp)
- }
-
- override protected def refinementNameString(tp: RefinedType): String = {
- val tsym = tp.member(tp.refinedName).symbol
- val name = tsym.originalName
- nameString(if (tsym is ExpandedTypeParam) name.asTypeName.unexpandedName() else name)
- }
-
- override def toText(tp: Type, prec: Precedence): Text = controlled {
- def toTextFunction(args: List[Type]): Text =
- (prec parenthesize GlobalPrec) {
- val argStr: Text =
- if (args.length == 2 &&
- !(defn.TupleClasses contains args.head.typeSymbol)) toText(args.head, LeftArrowPrec)
- else
- "(" ~ Text(args.init.map(toTextGlobal(_)), ", ") ~ ")"
- argStr ~ " => " ~ toTextGlobal(args.last)
- }
- def toTextTuple(args: List[Type]): Text =
- "(" ~ Text(args.map(toTextGlobal(_)), ", ") ~ ")"
- tp match {
- case tp: RefinedType =>
- val args = tp.typeArgs
- if (args.nonEmpty) {
- val tycon = tp.unrefine
- val cls = tycon.typeSymbol
- if (cls.typeParams.length == args.length) {
- if (cls == defn.RepeatedParamClass) return toTextLocal(args.head) ~ "*"
- if (cls == defn.ByNameParamClass) return "=> " ~ toTextGlobal(args.head)
- if (defn.FunctionClasses contains cls) return toTextFunction(args)
- if (defn.TupleClasses contains cls) return toTextTuple(args)
- }
- return (toTextLocal(tycon) ~ "[" ~
- Text(args.map(toTextGlobal(_)), ", ") ~ "]").close
- }
- case tp @ TypeRef(pre, name) =>
- if (tp.symbol is TypeParam) return nameString(tp.symbol)
- case _ =>
- }
- super.toText(tp, prec)
- }
-
- override protected def polyParamName(name: TypeName): TypeName =
- name.unexpandedName()
-
- override protected def treatAsTypeParam(sym: Symbol): Boolean = sym is TypeParam
-
- override protected def treatAsTypeArg(sym: Symbol) =
- sym.isType && (sym is ProtectedLocal) &&
- (sym.allOverriddenSymbols exists (_ is TypeParam))
-
- override protected def reconstituteParent(cls: ClassSymbol, parent: Type): Type =
- (parent /: parent.classSymbol.typeParams) { (parent, tparam) =>
- val targSym = cls.decls.lookup(tparam.name)
- if (targSym.exists) RefinedType(parent, targSym.name, targSym.info)
- else parent
- }
-
- override def kindString(sym: Symbol) = {
- val flags = sym.flagsUNSAFE
- if (flags is Package) "package"
- else if (sym.isPackageObject) "package object"
- else if (flags is Module) "object"
- else if (flags is ImplClass) "class"
- else if (sym.isClassConstructor) "constructor"
- else super.kindString(sym)
- }
-
- override protected def keyString(sym: Symbol): String = {
- val flags = sym.flagsUNSAFE
- if (sym.isType && (flags is ExpandedTypeParam)) ""
- else super.keyString(sym)
- }
-
- override def toTextFlags(sym: Symbol) = {
- var flags = sym.flags
- if (flags is TypeParam) flags = flags &~ Protected
- Text(flags.flagStrings.filterNot(_.startsWith("<")) map stringToText, " ")
- }
-
- override def toText(denot: Denotation): Text = toText(denot.symbol)
- }
-
- final val maxToTextRecursions = 100
-
-}
diff --git a/src/dotty/tools/dotc/core/Scopes.scala b/src/dotty/tools/dotc/core/Scopes.scala
index 6bcfc6f6a..426d5a51a 100644
--- a/src/dotty/tools/dotc/core/Scopes.scala
+++ b/src/dotty/tools/dotc/core/Scopes.scala
@@ -12,7 +12,7 @@ import Periods._
import Decorators._
import Contexts._
import Denotations._
-import util.Texts._
+import printing.Texts._
import SymDenotations.NoDenotation
object Scopes {
@@ -49,7 +49,7 @@ object Scopes {
* or to delete them. These methods are provided by subclass
* MutableScope.
*/
- abstract class Scope extends Showable with Iterable[Symbol] {
+ abstract class Scope extends printing.Showable with Iterable[Symbol] {
/** The last scope-entry from which all others are reachable via `prev` */
private[dotc] def lastEntry: ScopeEntry
diff --git a/src/dotty/tools/dotc/core/Showable.scala b/src/dotty/tools/dotc/core/Showable.scala
deleted file mode 100644
index 54a25506a..000000000
--- a/src/dotty/tools/dotc/core/Showable.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-package dotty.tools.dotc
-package core
-
-import Contexts._, util.Texts._, Decorators._
-
-trait Showable {
-
- def toText(implicit ctx: Context): Text
-
- def show(implicit ctx: Context): String = toText.show
-
-} \ No newline at end of file
diff --git a/src/dotty/tools/dotc/core/Symbols.scala b/src/dotty/tools/dotc/core/Symbols.scala
index 9d1545371..7d9fa9d44 100644
--- a/src/dotty/tools/dotc/core/Symbols.scala
+++ b/src/dotty/tools/dotc/core/Symbols.scala
@@ -10,7 +10,7 @@ import java.lang.AssertionError
import Decorators._
import Symbols._
import Contexts._
-import SymDenotations._, util.Texts._
+import SymDenotations._, printing.Texts._
import Types._, Annotations._, util.Positions._, StdNames._, Trees._, NameOps._
import Denotations.{ Denotation, SingleDenotation, MultiDenotation }
import collection.mutable
@@ -287,7 +287,7 @@ object Symbols {
/** A Symbol represents a Scala definition/declaration or a package.
*/
- class Symbol private[Symbols] (val coord: Coord) extends DotClass with Showable {
+ class Symbol private[Symbols] (val coord: Coord) extends DotClass with printing.Showable {
type ThisName <: Name
diff --git a/src/dotty/tools/dotc/core/Trees.scala b/src/dotty/tools/dotc/core/Trees.scala
index 054b17fa9..f99e72196 100644
--- a/src/dotty/tools/dotc/core/Trees.scala
+++ b/src/dotty/tools/dotc/core/Trees.scala
@@ -135,7 +135,7 @@ object Trees {
* - Type checking an untyped tree should remove all embedded `TypedSplice`
* nodes.
*/
- abstract class Tree[T >: Untyped] extends Positioned with Product with Showable with Cloneable {
+ abstract class Tree[T >: Untyped] extends Positioned with Product with printing.Showable with Cloneable {
if (Stats.enabled) ntrees += 1
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index e4209ba98..46b718968 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -15,7 +15,7 @@ import SymDenotations._
import Decorators._
import Denotations._
import Periods._
-import TypedTrees.tpd._, TypedTrees.TreeMapper, util.Texts._
+import TypedTrees.tpd._, TypedTrees.TreeMapper, printing.Texts._
import transform.Erasure
import scala.util.hashing.{ MurmurHash3 => hashing }
import collection.mutable
@@ -70,7 +70,7 @@ object Types {
* +- ErrorType
* +- WildcardType
*/
- abstract class Type extends DotClass with Showable {
+ abstract class Type extends DotClass with printing.Showable {
// ----- Tests -----------------------------------------------------
@@ -735,7 +735,7 @@ object Types {
*/
def signature(implicit ctx: Context): Signature = NotAMethod
- def toText(implicit ctx: Context): Text = ctx.toText(this, Printers.GlobalPrec)
+ def toText(implicit ctx: Context): Text = ctx.toText(this, printing.Printers.GlobalPrec)
// ----- hashing ------------------------------------------------------
diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
index 55c086e6f..1c9ce4b8a 100644
--- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
@@ -10,7 +10,7 @@ import java.lang.Double.longBitsToDouble
import Contexts._, Symbols._, Types._, Scopes._, SymDenotations._, Names._, NameOps._
import StdNames._, Denotations._, NameOps._, Flags._, Constants._, Annotations._
import util.Positions._, TypedTrees.tpd._, TypedTrees.TreeOps
-import util.Texts._
+import printing.Texts._
import io.AbstractFile
import scala.reflect.internal.pickling.PickleFormat._
import Decorators._