Skip to content

Commit 683c458

Browse files
committed
clarify comment about inlineBodyCache
1 parent 33ebf01 commit 683c458

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

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

+3-7
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ private class ExtractAPICollector(using Context) extends ThunkHolder {
152152
*/
153153
private val seenInlineCache = mutable.HashSet.empty[Symbol]
154154

155-
/** This cache is optional, it avoids recomputing hashes of inline "Body" annotations. */
155+
/** This cache is optional, it avoids recomputing hashes of inline "Body" annotations,
156+
* e.g. when a concrete inline method is inherited by a subclass.
157+
*/
156158
private val inlineBodyCache = mutable.HashMap.empty[Symbol, Int]
157159

158160
private val allNonLocalClassesInSrc = new mutable.HashSet[xsbti.api.ClassLike]
@@ -654,12 +656,6 @@ private class ExtractAPICollector(using Context) extends ThunkHolder {
654656
// this method need to be recompiled. sbt has no way of tracking method
655657
// bodies, so we include the hash of the body of the method as part of the
656658
// signature we send to sbt.
657-
//
658-
// FIXME: The API of a class we send to Zinc includes the signatures of
659-
// inherited methods, which means that we repeatedly compute the hash of
660-
// an inline def in every class that extends its owner. To avoid this we
661-
// could store the hash as an annotation when pickling an inline def
662-
// and retrieve it here instead of computing it on the fly.
663659

664660
def hash[U](inlineOrigin: Symbol): Int =
665661
assert(seenInlineCache.add(s)) // will fail if already seen, guarded by treeHash

0 commit comments

Comments
 (0)