aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-09-30 18:42:34 +0200
committerMartin Odersky <odersky@gmail.com>2016-10-02 16:12:28 +0200
commit6821bac06b34c416ca94216025b864e73592cbe7 (patch)
treee4ce0e9cd5c13b137fa969f046446b310cb36716 /src/dotty/tools/dotc
parentd4f00691c4a26f716cbf29878022309a741de070 (diff)
downloaddotty-6821bac06b34c416ca94216025b864e73592cbe7.tar.gz
dotty-6821bac06b34c416ca94216025b864e73592cbe7.tar.bz2
dotty-6821bac06b34c416ca94216025b864e73592cbe7.zip
Fix incremental compilation when inline method body changes
Since we have no nice way of hashing a typed tree we use the pretty-printed tree of the method (as it would be printed by -Xprint:posttyper -Xprint-types) as a hacky substitute for now.
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r--src/dotty/tools/dotc/sbt/ExtractAPI.scala20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/sbt/ExtractAPI.scala b/src/dotty/tools/dotc/sbt/ExtractAPI.scala
index 437e36bb9..a7b18b6d6 100644
--- a/src/dotty/tools/dotc/sbt/ExtractAPI.scala
+++ b/src/dotty/tools/dotc/sbt/ExtractAPI.scala
@@ -5,6 +5,7 @@ import ast.{Trees, tpd}
import core._, core.Decorators._
import Contexts._, Flags._, Phases._, Trees._, Types._, Symbols._
import Names._, NameOps._, StdNames._
+import typer.Inliner
import dotty.tools.io.Path
import java.io.PrintWriter
@@ -497,6 +498,21 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
sym.is(Implicit), sym.is(Lazy), sym.is(Macro), sym.is(SuperAccessor))
}
- // TODO: Annotation support
- def apiAnnotations(s: Symbol): List[api.Annotation] = Nil
+ // TODO: Support other annotations
+ def apiAnnotations(s: Symbol): List[api.Annotation] = {
+ val annots = new mutable.ListBuffer[api.Annotation]
+
+ if (Inliner.hasBodyToInline(s)) {
+ // FIXME: If the body of an inline method changes, all the reverse
+ // dependencies of this method need to be recompiled. sbt has no way
+ // of tracking method bodies, so as a hack we include the pretty-printed
+ // typed tree of the method as part of the signature we send to sbt.
+ // To do this properly we would need a way to hash trees and types in
+ // dotty itself.
+ val printTypesCtx = ctx.fresh.setSetting(ctx.settings.printtypes, true)
+ annots += marker(Inliner.bodyToInline(s).show(printTypesCtx).toString)
+ }
+
+ annots.toList
+ }
}