@@ -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 = {
@@ -416,7 +419,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
416
419
}
417
420
case Closure (env, ref, target) =>
418
421
(" 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 )
420
423
case Match (sel, cases) =>
421
424
if (sel.isEmpty) blockText(cases)
422
425
else changePrec(GlobalPrec ) { toText(sel) ~ keywordStr(" match " ) ~ blockText(cases) }
@@ -480,7 +483,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
480
483
}
481
484
case tree @ DefDef (name, tparams, vparamss, tpt, _) =>
482
485
dclTextOr {
483
- val printLambda = tree.symbol.isAnonymousFunction && ctx.settings. XprintUser .value
486
+ val printLambda = tree.symbol.isAnonymousFunction && YprintUser
484
487
val prefix = modText(tree.mods, keywordStr(" def" )) ~~ valDefText(nameIdText(tree)) provided (! printLambda)
485
488
withEnclosingDef(tree) {
486
489
addVparamssText(prefix ~ tparamsText(tparams), vparamss) ~ optAscription(tpt).provided(! printLambda) ~
0 commit comments