Skip to content

Commit 3c899d2

Browse files
committed
Clean up printing
We don't really need printing facilities for erased function types, since they are already done for refined types.
1 parent a62fb79 commit 3c899d2

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
128128
/** Pretty-print comma-separated type arguments for a constructor to be inserted among parentheses or brackets
129129
* (hence with `GlobalPrec` precedence).
130130
*/
131-
protected def argsText(args: List[Type], _erased: List[Boolean] = List()): Text =
132-
val erased = _erased.padTo(args.length, false)
133-
atPrec(GlobalPrec) { Text(args.zip(erased).map((arg, erased) => argText(arg, erased)), ", ") }
131+
protected def argsText(args: List[Type]): Text =
132+
atPrec(GlobalPrec) { Text(args.map(argText(_)), ", ") }
134133

135134
/** The longest sequence of refinement types, starting at given type
136135
* and following parents.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,17 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
147147
def toTextTuple(args: List[Type]): Text =
148148
"(" ~ argsText(args) ~ ")"
149149

150-
def toTextFunction(args: List[Type], isGiven: Boolean, isErased: List[Boolean], isPure: Boolean): Text =
150+
def toTextFunction(args: List[Type], isGiven: Boolean, isPure: Boolean): Text =
151151
changePrec(GlobalPrec) {
152152
val argStr: Text =
153153
if args.length == 2
154154
&& !defn.isTupleNType(args.head)
155155
&& !isGiven
156156
then
157-
atPrec(InfixPrec) { argText(args.head, isErased.headOption.getOrElse(false)) }
157+
atPrec(InfixPrec) { argText(args.head) }
158158
else
159159
"("
160-
~ argsText(args.init, isErased)
160+
~ argsText(args.init)
161161
~ ")"
162162
argStr ~ " " ~ arrow(isGiven, isPure) ~ " " ~ argText(args.last, false)
163163
}
@@ -223,7 +223,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
223223
if tycon.isRepeatedParam then toTextLocal(args.head) ~ "*"
224224
else if tp.isConvertibleParam then "into " ~ toText(args.head)
225225
else if defn.isFunctionSymbol(tsym) then
226-
toTextFunction(args, tsym.name.isContextFunction, List(tsym.name.isErasedFunction) /* TODO @natsukagami fix this */,
226+
toTextFunction(args, tsym.name.isContextFunction,
227227
isPure = Feature.pureFunsEnabled && !tsym.name.isImpureFunction)
228228
else if isInfixType(tp) then
229229
val l :: r :: Nil = args: @unchecked

0 commit comments

Comments
 (0)