Include ONLY non-public members in API hash of traits

The previous logic was wrong and included all members of traits in their
API hash, which degraded the performance of the incremental compiler.

This commit changes this logic so that only the non-public members of
traits are included into their API hash.

Fixes #2436
This commit is contained in:
Martin Duhem 2016-02-03 13:49:15 +01:00
parent 207dd762f4
commit be8ba763fa
2 changed files with 6 additions and 1 deletions

View File

@ -356,7 +356,12 @@ final class HashAPI(includePrivate: Boolean, includeParamNames: Boolean, include
def hashStructure0(structure: Structure, includeDefinitions: Boolean, isTrait: Boolean = false): Unit = {
extend(StructureHash)
hashTypes(structure.parents, includeDefinitions)
if (includeDefinitions || isTrait) {
if (isTrait && !includeDefinitions) {
def public(d: Definition): Boolean = d.access match { case _: xsbti.api.Public => true; case _ => false }
hashDefinitions(structure.declared.filterNot(public), isTrait)
hashDefinitions(structure.inherited.filterNot(public), isTrait)
}
if (includeDefinitions) {
hashDefinitions(structure.declared, isTrait)
hashDefinitions(structure.inherited, isTrait)
}