@@ -15,7 +15,7 @@ import Denotations._
1515import SymDenotations ._
1616import StdNames .{nme , tpnme }
1717import ast .{Trees , untpd }
18- import typer .{Implicits , Namer , Applications }
18+ import typer .{Implicits , Namer , Applications , Inliner }
1919import typer .ProtoTypes ._
2020import Trees ._
2121import TypeApplications ._
@@ -726,7 +726,8 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
726726 if (sym.privateWithin.exists) sym.privateWithin.asType.name else tpnme.EMPTY ,
727727 sym.annotations.filterNot(ann => dropAnnotForModText(ann.symbol)).map(_.tree))
728728
729- protected def dropAnnotForModText (sym : Symbol ): Boolean = sym == defn.BodyAnnot
729+ protected def dropAnnotForModText (sym : Symbol ): Boolean =
730+ sym == defn.BodyAnnot && ! printDebug
730731
731732 protected def optAscription [T >: Untyped ](tpt : Tree [T ]): Text = optText(tpt)(" : " ~ _)
732733
@@ -779,16 +780,20 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
779780 protected def defDefToText [T >: Untyped ](tree : DefDef [T ]): Text = {
780781 import untpd .{modsDeco => _ }
781782 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 )
784786 withEnclosingDef(tree) {
785787 val (prefix, vparamss) =
786788 if (isExtension) (defKeyword ~~ paramsText(tree.vparamss.head) ~~ valDefText(nameIdText(tree)), tree.vparamss.tail)
787789 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
789794 addVparamssText(prefix ~ tparamsText(tree.tparams), vparamss) ~
790795 optAscription(tree.tpt) ~
791- optText(tree. rhs)(" = " ~ _)
796+ optText(rhs)(" = " ~ _)
792797 }
793798 }
794799 }
0 commit comments