aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-06-18 11:32:06 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:35:03 +0200
commit97e84e66d44e1a8a82a6bea95ff883cc2aec718c (patch)
tree6c66ef1e1073b31cb6c92cdc071c537c5080d354 /src
parentf6efd99e09843d54150f4c5e0f723087ba92007e (diff)
downloaddotty-97e84e66d44e1a8a82a6bea95ff883cc2aec718c.tar.gz
dotty-97e84e66d44e1a8a82a6bea95ff883cc2aec718c.tar.bz2
dotty-97e84e66d44e1a8a82a6bea95ff883cc2aec718c.zip
Fix printing of type lambda trees and types
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/printing/PlainPrinter.scala4
-rw-r--r--src/dotty/tools/dotc/printing/RefinedPrinter.scala4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala
index 07819ef77..e86137c47 100644
--- a/src/dotty/tools/dotc/printing/PlainPrinter.scala
+++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala
@@ -187,6 +187,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) =
toText(polyParamName(name)) ~ polyHash(tp) ~ toText(bounds)
@@ -199,8 +201,6 @@ class PlainPrinter(_ctx: Context) extends Printer {
toText(polyParamName(pt.paramNames(n))) ~ polyHash(pt)
case AnnotatedType(tpe, annot) =>
toTextLocal(tpe) ~ " " ~ toText(annot)
- case tp: TypeLambda =>
- typeLambdaText(tp.paramNames.map(_.toString), tp.variances, tp.paramBounds, tp.resultType)
case HKApply(tycon, args) =>
toTextLocal(tycon) ~ "[!" ~ Text(args.map(argText), ", ") ~ "]"
case tp: TypeVar =>
diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
index 91f896da2..d6ce67cef 100644
--- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala
+++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala
@@ -383,7 +383,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
case AppliedTypeTree(tpt, args) =>
toTextLocal(tpt) ~ "[" ~ Text(args map argText, ", ") ~ "]"
case TypeLambdaTree(tparams, body) =>
- tparamsText(tparams) ~ " -> " ~ toText(body)
+ changePrec(GlobalPrec) {
+ tparamsText(tparams) ~ " -> " ~ toText(body)
+ }
case ByNameTypeTree(tpt) =>
"=> " ~ toTextLocal(tpt)
case TypeBoundsTree(lo, hi) =>