[LL FIR] KT-58257 Keep library (source) sessions on global source invalidation

- `LLFirSessionCache.sourceCache` can contain library and library
  sources sessions. However, global source modification events should
  not remove such sessions from the cache, because they belong to
  "stable" modules.
- The commit introduces the term "stable module" as a combined term for
  binary and library source modules. Library sources are not binaries,
  but nevertheless they cannot cause nor be affected by out-of-block
  modification.
- The term "source modules" as used by global "source" modification is
  slightly imprecise, as it does *not* include library sources, but for
  the sake of conciseness, I don't plan to change that.
This commit is contained in:
Marco Pennekamp
2023-07-12 21:53:42 +02:00
committed by Space Team
parent edadfd0daa
commit 24045067bf
8 changed files with 41 additions and 26 deletions
@@ -64,3 +64,11 @@ public inline fun <reified M : KtModule> KtModule.allDirectDependenciesOfType():
*/
public fun computeTransitiveDependsOnDependencies(directDependsOnDependencies: List<KtModule>): List<KtModule> =
topologicalSort(directDependsOnDependencies) { this.directDependsOnDependencies }
/**
* A stable [KtModule] does not contain conventionally *editable* sources and cannot cause or be affected by out-of-block modification.
*
* Stable modules may still be subject to modification (e.g. when a JAR is added to a library), but in such cases, module state modification
* events will be raised.
*/
public val KtModule.isStableModule: Boolean get() = this is KtBinaryModule || this is KtLibrarySourceModule