@@ -15,7 +15,7 @@ import Denotations._
15
15
import SymDenotations ._
16
16
import StdNames .{nme , tpnme }
17
17
import ast .{Trees , untpd }
18
- import typer .{Implicits , Namer , Applications }
18
+ import typer .{Implicits , Namer , Applications , Inliner }
19
19
import typer .ProtoTypes ._
20
20
import Trees ._
21
21
import TypeApplications ._
@@ -726,7 +726,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
726
726
if (sym.privateWithin.exists) sym.privateWithin.asType.name else tpnme.EMPTY ,
727
727
sym.annotations.filterNot(ann => dropAnnotForModText(ann.symbol)).map(_.tree))
728
728
729
- protected def dropAnnotForModText (sym : Symbol ): Boolean = sym == defn.BodyAnnot
729
+ protected def dropAnnotForModText (sym : Symbol ): Boolean =
730
+ sym == defn.BodyAnnot && ! printDebug
730
731
731
732
protected def optAscription [T >: Untyped ](tpt : Tree [T ]): Text = optText(tpt)(" : " ~ _)
732
733
@@ -779,16 +780,20 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
779
780
protected def defDefToText [T >: Untyped ](tree : DefDef [T ]): Text = {
780
781
import untpd .{modsDeco => _ }
781
782
dclTextOr(tree) {
782
- val defKeyword = modText(tree.mods, tree.symbol, keywordStr(" def" ), isType = false )
783
- val isExtension = tree.hasType && tree.symbol.is(Extension )
783
+ val meth = tree.symbol
784
+ val defKeyword = modText(tree.mods, meth, keywordStr(" def" ), isType = false )
785
+ val isExtension = tree.hasType && meth.is(Extension )
784
786
withEnclosingDef(tree) {
785
787
val (prefix, vparamss) =
786
788
if (isExtension) (defKeyword ~~ paramsText(tree.vparamss.head) ~~ valDefText(nameIdText(tree)), tree.vparamss.tail)
787
789
else (defKeyword ~~ valDefText(nameIdText(tree)), tree.vparamss)
788
-
790
+ val rhs =
791
+ if meth.isInlineMethod && meth.isInlineRetained && ! printDebug
792
+ then Inliner .bodyToInline(meth)
793
+ else tree.rhs
789
794
addVparamssText(prefix ~ tparamsText(tree.tparams), vparamss) ~
790
795
optAscription(tree.tpt) ~
791
- optText(tree. rhs)(" = " ~ _)
796
+ optText(rhs)(" = " ~ _)
792
797
}
793
798
}
794
799
}
0 commit comments