Skip to content

Commit e740452

Browse files
committed
Refactor printer code
1 parent bd586bf commit e740452

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
252252
("{" ~ toText(trees, "\n") ~ "}").close
253253

254254
protected def typeApplyText[T >: Untyped](tree: TypeApply[T]): Text = {
255-
if (tree.fun.hasType && tree.fun.symbol == defn.QuotedType_apply)
256-
keywordStr("'[") ~ toTextGlobal(tree.args, ", ") ~ keywordStr("]")
257-
else
258-
toTextLocal(tree.fun) ~ "[" ~ toTextGlobal(tree.args, ", ") ~ "]"
255+
val isQuote = tree.fun.hasType && tree.fun.symbol == defn.QuotedType_apply
256+
val (open, close) = if (isQuote) (keywordStr("'["), keywordStr("]")) else ("[", "]")
257+
toTextLocal(tree.fun).provided(!isQuote) ~ open ~ toTextGlobal(tree.args, ", ") ~ close
259258
}
260259

261260
protected def toTextCore[T >: Untyped](tree: Tree[T]): Text = {

0 commit comments

Comments
 (0)