@@ -16,6 +16,7 @@ import dotty.tools.dotc.core.NameOps.*
1616import dotty .tools .dotc .core .Names .*
1717import dotty .tools .dotc .core .Phases .*
1818import dotty .tools .dotc .core .Symbols .*
19+ import dotty .tools .dotc .core .Definitions
1920import dotty .tools .dotc .core .Denotations .StaleSymbol
2021import dotty .tools .dotc .core .Types .*
2122
@@ -75,7 +76,7 @@ class ExtractDependencies extends Phase {
7576 override def run (using Context ): Unit = {
7677 val unit = ctx.compilationUnit
7778 val rec = unit.depRecorder
78- val collector = ExtractDependenciesCollector (rec)
79+ val collector = ExtractDependenciesCollector (rec, defn )
7980 collector.traverse(unit.tpdTree)
8081
8182 if (ctx.settings.YdumpSbtInc .value) {
@@ -137,7 +138,7 @@ object ExtractDependencies {
137138 * specially, see the subsection "Dependencies introduced by member reference and
138139 * inheritance" in the "Name hashing algorithm" section.
139140 */
140- private class ExtractDependenciesCollector (rec : DependencyRecorder ) extends tpd.TreeTraverser { thisTreeTraverser =>
141+ private class ExtractDependenciesCollector (rec : DependencyRecorder , defn : Definitions ) extends tpd.TreeTraverser { thisTreeTraverser =>
141142 import tpd .*
142143
143144 private def addMemberRefDependency (sym : Symbol )(using Context ): Unit =
@@ -169,14 +170,23 @@ private class ExtractDependenciesCollector(rec: DependencyRecorder) extends tpd.
169170 if cls.isLocal then LocalDependencyByInheritance
170171 else DependencyByInheritance
171172
173+ private val ignoredSymbols = Set [Symbol ](
174+ defn.syntheticScalaClasses*
175+ ) ++ Set (
176+ defn.ClassClass ,
177+ defn.ModuleSerializationProxyClass ,
178+ defn.ModuleSerializationProxyConstructor ,
179+ )
180+
172181 private def ignoreDependency (sym : Symbol )(using Context ) =
173182 try
174183 ! sym.exists ||
175184 sym.isAbsent(canForce = false ) || // ignore dependencies that have a symbol but do not exist.
176185 // e.g. java.lang.Object companion object
177186 sym.isEffectiveRoot ||
178187 sym.isAnonymousFunction ||
179- sym.isAnonymousClass
188+ sym.isAnonymousClass ||
189+ ignoredSymbols(sym)
180190 catch case ex : StaleSymbol =>
181191 // can happen for constructor proxies. Test case is pos-macros/i13532.
182192 true
0 commit comments