@@ -14,7 +14,8 @@ import TypeApplications._
1414import Decorators ._
1515import config .Config
1616import util .Positions ._
17- import transform .SymUtils ._
17+ import dotty .tools .dotc .transform .SymUtils ._
18+ import dotty .tools .dotc .transform .FirstTransform
1819import scala .annotation .switch
1920import language .implicitConversions
2021import dotty .tools .dotc .util .SourcePosition
@@ -27,6 +28,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
2728 private [this ] var myCtx : Context = _ctx
2829 private [this ] var printPos = ctx.settings.YprintPos .value
2930 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)
3033 override protected [this ] implicit def ctx : Context = myCtx
3134
3235 def withEnclosingDef (enclDef : Tree [_ >: Untyped ])(op : => Text ): Text = {
@@ -416,7 +419,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
416419 }
417420 case Closure (env, ref, target) =>
418421 (" closure(" ~ (toTextGlobal(env, " , " ) ~ " | " provided env.nonEmpty) ~
419- toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )" ).provided(! ctx.settings. XprintUser .value )
422+ toTextGlobal(ref) ~ (" :" ~ toText(target) provided ! target.isEmpty) ~ " )" ).provided(! YprintUser )
420423 case Match (sel, cases) =>
421424 if (sel.isEmpty) blockText(cases)
422425 else changePrec(GlobalPrec ) { toText(sel) ~ keywordStr(" match " ) ~ blockText(cases) }
@@ -480,7 +483,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
480483 }
481484 case tree @ DefDef (name, tparams, vparamss, tpt, _) =>
482485 dclTextOr {
483- val printLambda = tree.symbol.isAnonymousFunction && ctx.settings. XprintUser .value
486+ val printLambda = tree.symbol.isAnonymousFunction && YprintUser
484487 val prefix = modText(tree.mods, keywordStr(" def" )) ~~ valDefText(nameIdText(tree)) provided (! printLambda)
485488 withEnclosingDef(tree) {
486489 addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt).provided(! printLambda) ~
0 commit comments