From a29004168c964e2d8551ac7b49332a7d63c5cb78 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Thu, 17 Oct 2024 23:14:39 +0800 Subject: [PATCH] Revert #1284 Include mutual dependency in initial invalidation (#1462) Ref https://github.com/sbt/zinc/pull/1284 Fixes https://github.com/sbt/zinc/issues/1461 Fixes https://github.com/sbt/zinc/issues/1420 Also fixes https://github.com/com-lihaoyi/mill/issues/3748 downstream Not sure if there's a better way to fix this? Just opening this to spark discussion The original bugs are fine, but the solution seems incorrect, and is both overly conservative (invalidating everything based on whitespace?) and not conservative enough (doesn't handle cycles with length > 2?). --- .../main/scala/sbt/internal/inc/IncrementalCommon.scala | 9 +-------- .../abstract-class-to-trait/{test => pending} | 0 .../source-dependencies/false-error/{test => pending} | 0 .../nested-type-params/{test => pending} | 0 .../no-type-annotation/{test => pending} | 0 5 files changed, 1 insertion(+), 8 deletions(-) rename zinc/src/sbt-test/source-dependencies/abstract-class-to-trait/{test => pending} (100%) rename zinc/src/sbt-test/source-dependencies/false-error/{test => pending} (100%) rename zinc/src/sbt-test/source-dependencies/nested-type-params/{test => pending} (100%) rename zinc/src/sbt-test/source-dependencies/no-type-annotation/{test => pending} (100%) diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala index dfe6a869f0..19cfff70e0 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala @@ -534,14 +534,7 @@ private[inc] abstract class IncrementalCommon( val removedClasses = classNames(removedSrcs) val dependentOnRemovedClasses = removedClasses.flatMap(previous.memberRef.internal.reverse) val modifiedClasses = classNames(modifiedSrcs) - val mutualDependentOnModifiedClasses = { - val dependentOnModifiedClasses = modifiedClasses.flatMap(previous.memberRef.internal.reverse) - dependentOnModifiedClasses.filter(dependent => - previous.memberRef.internal.reverse(dependent).exists(modifiedClasses) - ) - } - val invalidatedClasses = - removedClasses ++ dependentOnRemovedClasses ++ modifiedClasses ++ mutualDependentOnModifiedClasses + val invalidatedClasses = removedClasses ++ dependentOnRemovedClasses ++ modifiedClasses val byProduct = changes.removedProducts.flatMap(previous.produced) val byLibraryDep = changes.libraryDeps.flatMap(previous.usesLibrary) diff --git a/zinc/src/sbt-test/source-dependencies/abstract-class-to-trait/test b/zinc/src/sbt-test/source-dependencies/abstract-class-to-trait/pending similarity index 100% rename from zinc/src/sbt-test/source-dependencies/abstract-class-to-trait/test rename to zinc/src/sbt-test/source-dependencies/abstract-class-to-trait/pending diff --git a/zinc/src/sbt-test/source-dependencies/false-error/test b/zinc/src/sbt-test/source-dependencies/false-error/pending similarity index 100% rename from zinc/src/sbt-test/source-dependencies/false-error/test rename to zinc/src/sbt-test/source-dependencies/false-error/pending diff --git a/zinc/src/sbt-test/source-dependencies/nested-type-params/test b/zinc/src/sbt-test/source-dependencies/nested-type-params/pending similarity index 100% rename from zinc/src/sbt-test/source-dependencies/nested-type-params/test rename to zinc/src/sbt-test/source-dependencies/nested-type-params/pending diff --git a/zinc/src/sbt-test/source-dependencies/no-type-annotation/test b/zinc/src/sbt-test/source-dependencies/no-type-annotation/pending similarity index 100% rename from zinc/src/sbt-test/source-dependencies/no-type-annotation/test rename to zinc/src/sbt-test/source-dependencies/no-type-annotation/pending