@@ -40,7 +40,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
40
40
41
41
override def printerContext : Context = myCtx
42
42
43
- def withEnclosingDef (enclDef : Tree [? >: Untyped ])(op : => Text ): Text = {
43
+ def withEnclosingDef (enclDef : Tree [? ])(op : => Text ): Text = {
44
44
val savedCtx = myCtx
45
45
if (enclDef.hasType && enclDef.symbol.exists)
46
46
myCtx = ctx.withOwner(enclDef.symbol)
@@ -308,15 +308,15 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
308
308
protected def exprToText (tp : ExprType ): Text =
309
309
" => " ~ toText(tp.resType)
310
310
311
- protected def blockToText [T > : Untyped ](block : Block [T ]): Text =
311
+ protected def blockToText [T < : Untyped ](block : Block [T ]): Text =
312
312
blockText(block.stats :+ block.expr)
313
313
314
- protected def blockText [T > : Untyped ](trees : List [Tree [T ]]): Text =
314
+ protected def blockText [T < : Untyped ](trees : List [Tree [T ]]): Text =
315
315
inContextBracket {
316
316
(" {" ~ toText(trees, " \n " ) ~ " }" ).close
317
317
}
318
318
319
- protected def typeApplyText [T > : Untyped ](tree : TypeApply [T ]): Text = {
319
+ protected def typeApplyText [T < : Untyped ](tree : TypeApply [T ]): Text = {
320
320
val funText = toTextLocal(tree.fun)
321
321
tree.fun match {
322
322
case Select (New (tpt), nme.CONSTRUCTOR ) if tpt.typeOpt.dealias.isInstanceOf [AppliedType ] =>
@@ -326,7 +326,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
326
326
}
327
327
}
328
328
329
- protected def toTextCore [T > : Untyped ](tree : Tree [T ]): Text = {
329
+ protected def toTextCore [T < : Untyped ](tree : Tree [T ]): Text = {
330
330
import untpd ._
331
331
332
332
def isLocalThis (tree : Tree ) = tree.typeOpt match {
@@ -739,7 +739,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
739
739
}
740
740
}
741
741
742
- override def toText [T > : Untyped ](tree : Tree [T ]): Text = controlled {
742
+ override def toText [T < : Untyped ](tree : Tree [T ]): Text = controlled {
743
743
import untpd ._
744
744
745
745
var txt = toTextCore(tree)
@@ -826,7 +826,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
826
826
827
827
protected def dropAnnotForModText (sym : Symbol ): Boolean = sym == defn.BodyAnnot
828
828
829
- protected def optAscription [T > : Untyped ](tpt : Tree [T ]): Text = optText(tpt)(" : " ~ _)
829
+ protected def optAscription [T < : Untyped ](tpt : Tree [T ]): Text = optText(tpt)(" : " ~ _)
830
830
831
831
private def idText (tree : untpd.Tree ): Text =
832
832
(if showUniqueIds && tree.hasType && tree.symbol.exists then s " # ${tree.symbol.id}" else " " ) ~
@@ -842,7 +842,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
842
842
private def useSymbol (tree : untpd.Tree ) =
843
843
tree.hasType && tree.symbol.exists && ctx.settings.YprintSyms .value
844
844
845
- protected def nameIdText [T > : Untyped ](tree : NameTree [T ]): Text =
845
+ protected def nameIdText [T < : Untyped ](tree : NameTree [T ]): Text =
846
846
if (tree.hasType && tree.symbol.exists) {
847
847
val str = nameString(tree.symbol)
848
848
tree match {
@@ -856,13 +856,13 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
856
856
private def toTextOwner (tree : Tree [? ]) =
857
857
" [owner = " ~ tree.symbol.maybeOwner.show ~ " ]" provided ctx.settings.YprintDebugOwners .value
858
858
859
- protected def dclTextOr [T > : Untyped ](tree : Tree [T ])(treeText : => Text ): Text =
859
+ protected def dclTextOr [T < : Untyped ](tree : Tree [T ])(treeText : => Text ): Text =
860
860
toTextOwner(tree) ~ {
861
861
if (useSymbol(tree)) annotsText(tree.symbol) ~~ dclText(tree.symbol)
862
862
else treeText
863
863
}
864
864
865
- def paramsText [T > : Untyped ](params : ParamClause [T ]): Text = (params : @ unchecked) match
865
+ def paramsText [T < : Untyped ](params : ParamClause [T ]): Text = (params : @ unchecked) match
866
866
case Nil =>
867
867
" ()"
868
868
case untpd.ValDefs (vparams @ (vparam :: _)) =>
@@ -872,18 +872,18 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
872
872
case untpd.TypeDefs (tparams) =>
873
873
" [" ~ toText(tparams, " , " ) ~ " ]"
874
874
875
- def addParamssText [T > : Untyped ](leading : Text , paramss : List [ParamClause [T ]]): Text =
875
+ def addParamssText [T < : Untyped ](leading : Text , paramss : List [ParamClause [T ]]): Text =
876
876
paramss.foldLeft(leading)((txt, params) => txt ~ paramsText(params))
877
877
878
- protected def valDefToText [T > : Untyped ](tree : ValDef [T ]): Text = {
878
+ protected def valDefToText [T < : Untyped ](tree : ValDef [T ]): Text = {
879
879
dclTextOr(tree) {
880
880
modText(tree.mods, tree.symbol, keywordStr(if (tree.mods.is(Mutable )) " var" else " val" ), isType = false ) ~~
881
881
valDefText(nameIdText(tree)) ~ optAscription(tree.tpt) ~
882
882
withEnclosingDef(tree) { optText(tree.rhs)(" = " ~ _) }
883
883
}
884
884
}
885
885
886
- protected def defDefToText [T > : Untyped ](tree : DefDef [T ]): Text = {
886
+ protected def defDefToText [T < : Untyped ](tree : DefDef [T ]): Text = {
887
887
import untpd ._
888
888
dclTextOr(tree) {
889
889
val defKeyword = modText(tree.mods, tree.symbol, keywordStr(" def" ), isType = false )
@@ -989,8 +989,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
989
989
)
990
990
}
991
991
992
- protected def toTextPackageId [T > : Untyped ](pid : Tree [T ]): Text =
993
- if (homogenizedView && pid.hasType) toTextLocal(pid.tpe. asInstanceOf [ Showable ] )
992
+ protected def toTextPackageId [T < : Untyped ](pid : Tree [T ]): Text =
993
+ if (homogenizedView && pid.hasType) toTextLocal(pid.typeOpt )
994
994
else toTextLocal(pid)
995
995
996
996
protected def packageDefText (tree : PackageDef ): Text = {
@@ -1044,10 +1044,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
1044
1044
def optText (name : Name )(encl : Text => Text ): Text =
1045
1045
if (name.isEmpty) " " else encl(toText(name))
1046
1046
1047
- def optText [T > : Untyped ](tree : Tree [T ])(encl : Text => Text ): Text =
1047
+ def optText [T < : Untyped ](tree : Tree [T ])(encl : Text => Text ): Text =
1048
1048
if (tree.isEmpty) " " else encl(toText(tree))
1049
1049
1050
- def optText [T > : Untyped ](tree : List [Tree [T ]])(encl : Text => Text ): Text =
1050
+ def optText [T < : Untyped ](tree : List [Tree [T ]])(encl : Text => Text ): Text =
1051
1051
if (tree.exists(! _.isEmpty)) encl(blockText(tree)) else " "
1052
1052
1053
1053
override protected def treatAsTypeParam (sym : Symbol ): Boolean = sym.is(TypeParam )
0 commit comments