Skip to content

Commit 34c04af

Browse files
committed
Refactor globalPrecArgText to expose argText without prio tweaking
1 parent cd13ce1 commit 34c04af

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,16 @@ class PlainPrinter(_ctx: Context) extends Printer {
101101
protected def toTextRefinement(rt: RefinedType) =
102102
(refinementNameString(rt) ~ toTextRHS(rt.refinedInfo)).close
103103

104-
protected def globalPrecArgText(arg: Type): Text = homogenizeArg(arg) match {
105-
case arg: TypeBounds => "_" ~ toTextGlobal(arg)
106-
case arg => toTextGlobal(arg)
104+
protected def argText(arg: Type): Text = homogenizeArg(arg) match {
105+
case arg: TypeBounds => "_" ~ toText(arg)
106+
case arg => toText(arg)
107107
}
108108

109+
/** Pretty-print type `arg` for use when rendering a type argument (such as `T1` in `Foo[T1, T2]`), hence with
110+
* GlobalPrec precedence.
111+
*/
112+
protected def globalPrecArgText(arg: Type): Text = atPrec(GlobalPrec) { argText(arg) }
113+
109114
/** The longest sequence of refinement types, starting at given type
110115
* and following parents.
111116
*/

0 commit comments

Comments
 (0)