File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -590,16 +590,16 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
590590
591591 def apiAnnotations (s : Symbol ): List [api.Annotation ] = {
592592 val annots = new mutable.ListBuffer [api.Annotation ]
593-
594- if (Inliner .hasBodyToInline(s) ) {
593+ val inlineBody = Inliner .bodyToInline(s)
594+ if (! inlineBody.isEmpty ) {
595595 // FIXME: If the body of an inlineable method changes, all the reverse
596596 // dependencies of this method need to be recompiled. sbt has no way
597597 // of tracking method bodies, so as a hack we include the pretty-printed
598598 // typed tree of the method as part of the signature we send to sbt.
599599 // To do this properly we would need a way to hash trees and types in
600600 // dotty itself.
601601 val printTypesCtx = ctx.fresh.setSetting(ctx.settings.XprintTypes , true )
602- annots += marker(Inliner .bodyToInline(s) .show(printTypesCtx))
602+ annots += marker(inlineBody .show(printTypesCtx))
603603 }
604604
605605 // In the Scala2 ExtractAPI phase we only extract annotations that extend
Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ object Inliner {
4141 * @pre hasBodyToInline(sym)
4242 */
4343 def bodyToInline (sym : SymDenotation )(implicit ctx : Context ): Tree =
44- sym.unforcedAnnotation(defn.BodyAnnot ).get.tree
44+ if (sym.isInlineMethod && sym.hasAnnotation(defn.BodyAnnot ))
45+ sym.getAnnotation(defn.BodyAnnot ).get.tree
46+ else
47+ EmptyTree
4548
4649 /** Should call to method `meth` be inlined in this context? */
4750 def isInlineable (meth : Symbol )(implicit ctx : Context ): Boolean =
Original file line number Diff line number Diff line change @@ -2185,7 +2185,7 @@ class Typer extends Namer
21852185 traverse(xtree :: rest)
21862186 case none =>
21872187 typed(mdef) match {
2188- case mdef1 : DefDef if Inliner .hasBodyToInline (mdef1.symbol) =>
2188+ case mdef1 : DefDef if ! Inliner .bodyToInline (mdef1.symbol).isEmpty =>
21892189 buf += inlineExpansion(mdef1)
21902190 // replace body with expansion, because it will be used as inlined body
21912191 // from separately compiled files - the original BodyAnnotation is not kept.
You can’t perform that action at this time.
0 commit comments