File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -52,15 +52,9 @@ class DecompilerPrinter(_ctx: Context) extends RefinedPrinter(_ctx) {
5252 }
5353 }
5454
55- override protected def toTextCore [T >: Untyped ](tree : Tree [T ]): Text = {
56- import untpd .{modsDeco => _ , _ }
57- tree match {
58- case TypeApply (fun, args) =>
59- if (tree.symbol eq defn.quoteMethod) " '"
60- else if (tree.symbol eq defn.typeQuoteMethod) " '[" ~ toTextGlobal(args, " , " ) ~ " ]"
61- else super .toTextCore(tree)
62- case _ =>
63- super .toTextCore(tree)
64- }
55+ override protected def typeApplyText [T >: Untyped ](tree : TypeApply [T ]): Text = {
56+ if (tree.symbol eq defn.quoteMethod) " '"
57+ else if (tree.symbol eq defn.typeQuoteMethod) " '[" ~ toTextGlobal(tree.args, " , " ) ~ " ]"
58+ else super .typeApplyText(tree)
6559 }
6660}
Original file line number Diff line number Diff line change @@ -229,6 +229,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
229229 protected def blockText [T >: Untyped ](trees : List [Tree [T ]]): Text =
230230 (" {" ~ toText(trees, " \n " ) ~ " }" ).close
231231
232+ protected def typeApplyText [T >: Untyped ](tree : TypeApply [T ]): Text =
233+ toTextLocal(tree.fun) ~ " [" ~ toTextGlobal(tree.args, " , " ) ~ " ]"
234+
232235 protected def toTextCore [T >: Untyped ](tree : Tree [T ]): Text = {
233236 import untpd .{modsDeco => _ , _ }
234237
@@ -308,8 +311,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
308311 }
309312 else
310313 toTextLocal(fun) ~ " (" ~ toTextGlobal(args, " , " ) ~ " )"
311- case TypeApply (fun, args) =>
312- toTextLocal(fun) ~ " [ " ~ toTextGlobal(args, " , " ) ~ " ] "
314+ case tree : TypeApply =>
315+ typeApplyText(tree)
313316 case Literal (c) =>
314317 tree.typeOpt match {
315318 case ConstantType (tc) => withPos(toText(tc), tree.pos)
You can’t perform that action at this time.
0 commit comments