Skip to content

Commit de03284

Browse files
committed
Avoid overcompilation involving inline or annotation trees
We used to pretty-print trees in the API info we send to sbt, but the pretty-printed output seems to be unstable leading to overcompilation, so just use the raw trees instead (this should also be faster).
1 parent 228e593 commit de03284

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,11 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
595595
if (!inlineBody.isEmpty) {
596596
// FIXME: If the body of an inlineable method changes, all the reverse
597597
// dependencies of this method need to be recompiled. sbt has no way
598-
// of tracking method bodies, so as a hack we include the pretty-printed
599-
// typed tree of the method as part of the signature we send to sbt.
598+
// of tracking method bodies, so as a hack we include the printed
599+
// tree of the method as part of the signature we send to sbt.
600600
// To do this properly we would need a way to hash trees and types in
601601
// dotty itself.
602-
val printTypesCtx = ctx.fresh.setSetting(ctx.settings.XprintTypes, true)
603-
annots += marker(inlineBody.show(printTypesCtx))
602+
annots += marker(inlineBody.toString)
604603
}
605604

606605
// In the Scala2 ExtractAPI phase we only extract annotations that extend
@@ -624,6 +623,6 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder
624623
// junit tests are annotated @org.junit.Test).
625624
api.Annotation.of(
626625
apiType(annot.tree.tpe), // Used by sbt to find tests to run
627-
Array(api.AnnotationArgument.of("FULLTREE", annot.tree.show)))
626+
Array(api.AnnotationArgument.of("FULLTREE", annot.tree.toString)))
628627
}
629628
}

0 commit comments

Comments
 (0)