@@ -207,7 +207,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
207
207
208
208
import untpd .{modsDeco => _ , _ }
209
209
210
- /** Print modifiers form symbols if tree has type, overriding the untpd behavior. */
210
+ /** Print modifiers from symbols if tree has type, overriding the untpd behavior. */
211
211
implicit def modsDeco (mdef : untpd.MemberDef )(implicit ctx : Context ): untpd.ModsDeco =
212
212
tpd.modsDeco(mdef.asInstanceOf [tpd.MemberDef ]).asInstanceOf [untpd.ModsDeco ]
213
213
@@ -264,6 +264,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
264
264
Text (mods.annotations.map(annotText), " " ) ~~ flagsText ~~ (kw provided ! suppressKw)
265
265
}
266
266
267
+ def varianceText (mods : untpd.Modifiers ) =
268
+ if (mods is Covariant ) " +"
269
+ else if (mods is Contravariant ) " -"
270
+ else " "
271
+
267
272
def argText (arg : Tree ): Text = arg match {
268
273
case arg : TypeBoundsTree => " _" ~ toTextGlobal(arg)
269
274
case arg : TypeTree =>
@@ -398,6 +403,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
398
403
toTextLocal(tpt) ~ " " ~ blockText(refines)
399
404
case AppliedTypeTree (tpt, args) =>
400
405
toTextLocal(tpt) ~ " [" ~ Text (args map argText, " , " ) ~ " ]"
406
+ case TypeLambdaTree (tparams, body) =>
407
+ tparamsText(tparams) ~ " -> " ~ toText(body)
401
408
case ByNameTypeTree (tpt) =>
402
409
" => " ~ toTextLocal(tpt)
403
410
case TypeBoundsTree (lo, hi) =>
@@ -431,7 +438,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
431
438
case tree @ TypeDef (name, rhs) =>
432
439
def typeDefText (rhsText : Text ) =
433
440
dclTextOr {
434
- modText(tree.mods, " type" ) ~~ nameIdText(tree) ~
441
+ modText(tree.mods, " type" ) ~~ (varianceText(tree.mods) ~ nameIdText(tree) ) ~
435
442
withEnclosingDef(tree) {
436
443
val rhsText1 = if (tree.hasType) toText(tree.symbol.info) else rhsText
437
444
tparamsText(tree.tparams) ~ rhsText1
0 commit comments