@@ -14,7 +14,8 @@ import TypeApplications._
14
14
import Decorators ._
15
15
import config .Config
16
16
import util .Positions ._
17
- import transform .SymUtils ._
17
+ import dotty .tools .dotc .transform .SymUtils ._
18
+ import dotty .tools .dotc .transform .FirstTransform
18
19
import scala .annotation .switch
19
20
import language .implicitConversions
20
21
import dotty .tools .dotc .util .SourcePosition
@@ -27,6 +28,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
27
28
private [this ] var myCtx : Context = _ctx
28
29
private [this ] var printPos = ctx.settings.YprintPos .value
29
30
private [this ] val printLines = ctx.settings.printLines.value
31
+ private [this ] val YprintUser =
32
+ ctx.settings.YprintUser .value && ! ctx.phases.dropWhile(! _.isInstanceOf [FirstTransform ]).contains(ctx.phase)
30
33
override protected [this ] implicit def ctx : Context = myCtx
31
34
32
35
def withEnclosingDef (enclDef : Tree [_ >: Untyped ])(op : => Text ): Text = {
@@ -422,7 +425,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
422
425
}
423
426
case Closure (env, ref, target) =>
424
427
(" closure(" ~ (toTextGlobal(env, " , " ) ~ " | " provided env.nonEmpty) ~
425
- toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )" ).provided(! ctx.settings. XprintUser .value )
428
+ toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )" ).provided(! YprintUser )
426
429
case Match (sel, cases) =>
427
430
if (sel.isEmpty) blockText(cases)
428
431
else changePrec(GlobalPrec ) { toText(sel) ~ keywordStr(" match " ) ~ blockText(cases) }
@@ -486,7 +489,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
486
489
}
487
490
case tree @ DefDef (name, tparams, vparamss, tpt, _) =>
488
491
dclTextOr {
489
- val printLambda = tree.symbol.isAnonymousFunction && ctx.settings. XprintUser .value
492
+ val printLambda = tree.symbol.isAnonymousFunction && YprintUser
490
493
val prefix = modText(tree.mods, keywordStr(" def" )) ~~ valDefText(nameIdText(tree)) provided (! printLambda)
491
494
withEnclosingDef(tree) {
492
495
addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt).provided(! printLambda) ~
0 commit comments