diff options
author | Martin Odersky <odersky@gmail.com> | 2016-10-09 22:47:26 +0200 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2016-10-12 16:13:49 +0200 |
commit | df2187e51e7a38a6ca8260ab4a415a7cd5efdcfc (patch) | |
tree | e3251acde037800e843853f08d18e9e1481da292 /src/dotty/tools/dotc/printing/PlainPrinter.scala | |
parent | 6807b4454529b70d2d8a6819c51db850d06078a1 (diff) | |
download | dotty-df2187e51e7a38a6ca8260ab4a415a7cd5efdcfc.tar.gz dotty-df2187e51e7a38a6ca8260ab4a415a7cd5efdcfc.tar.bz2 dotty-df2187e51e7a38a6ca8260ab4a415a7cd5efdcfc.zip |
Merge GenericType, TypeLambda and PolyType
Diffstat (limited to 'src/dotty/tools/dotc/printing/PlainPrinter.scala')
-rw-r--r-- | src/dotty/tools/dotc/printing/PlainPrinter.scala | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala index a92095d9b..564ef21ef 100644 --- a/src/dotty/tools/dotc/printing/PlainPrinter.scala +++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala @@ -114,7 +114,7 @@ class PlainPrinter(_ctx: Context) extends Printer { case _ => toTextGlobal(arg) } - /** The text for a TypeLambda + /** The text for a PolyType * * [v_1 p_1: B_1, ..., v_n p_n: B_n] -> T * @@ -124,7 +124,7 @@ class PlainPrinter(_ctx: Context) extends Printer { * @param argBoundss = B_1, ..., B_n * @param body = T */ - protected def typeLambdaText(paramNames: List[String], variances: List[Int], argBoundss: List[TypeBounds], body: Type): Text = { + protected def polyTypeText(paramNames: List[String], variances: List[Int], argBoundss: List[TypeBounds], body: Type): Text = { def lambdaParamText(variance: Int, name: String, bounds: TypeBounds): Text = varianceString(variance) ~ name ~ toText(bounds) changePrec(GlobalPrec) { @@ -185,16 +185,8 @@ class PlainPrinter(_ctx: Context) extends Printer { } case tp: ExprType => changePrec(GlobalPrec) { "=> " ~ toText(tp.resultType) } - case tp: TypeLambda => - typeLambdaText(tp.paramNames.map(_.toString), tp.variances, tp.paramBounds, tp.resultType) case tp: PolyType => - def paramText(name: TypeName, bounds: TypeBounds): Text = - polyParamNameString(name) ~ polyHash(tp) ~ toText(bounds) - changePrec(GlobalPrec) { - "[" ~ - Text((tp.paramNames, tp.paramBounds).zipped map paramText, ", ") ~ - "]" ~ toText(tp.resultType) - } + polyTypeText(tp.paramNames.map(_.toString), tp.variances, tp.paramBounds, tp.resultType) case tp: PolyParam => polyParamNameString(tp) ~ polyHash(tp.binder) case AnnotatedType(tpe, annot) => @@ -229,7 +221,7 @@ class PlainPrinter(_ctx: Context) extends Printer { protected def simpleNameString(sym: Symbol): String = nameString(sym.name) /** If -uniqid is set, the hashcode of the polytype, after a # */ - protected def polyHash(pt: GenericType): Text = + protected def polyHash(pt: PolyType): Text = if (ctx.settings.uniqid.value) "#" + pt.hashCode else "" /** If -uniqid is set, the unique id of symbol, after a # */ |