File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
compiler/src/dotty/tools/dotc/sbt Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -266,8 +266,16 @@ private class ExtractDependenciesCollector extends tpd.TreeTraverser { thisTreeT
266
266
sym.isAnonymousFunction ||
267
267
sym.isAnonymousClass
268
268
269
- private def addInheritanceDependency (parent : Symbol )(implicit ctx : Context ): Unit =
270
- _dependencies += ClassDependency (resolveDependencySource, parent.topLevelClass, DependencyByInheritance )
269
+ private def addInheritanceDependency (tree : Template )(implicit ctx : Context ): Unit =
270
+ if (tree.parents.nonEmpty) {
271
+ val depContext =
272
+ if (isLocal(tree.symbol.owner)) LocalDependencyByInheritance
273
+ else DependencyByInheritance
274
+ val from = resolveDependencySource
275
+ tree.parents.foreach { parent =>
276
+ _dependencies += ClassDependency (from, parent.tpe.classSymbol.topLevelClass, depContext)
277
+ }
278
+ }
271
279
272
280
/** Traverse the tree of a source file and record the dependencies which
273
281
* can be retrieved using `topLevelDependencies`, `topLevelInheritanceDependencies`,
@@ -303,8 +311,8 @@ private class ExtractDependenciesCollector extends tpd.TreeTraverser { thisTreeT
303
311
case ref : RefTree =>
304
312
addDependency(ref.symbol)
305
313
addTypeDependency(ref.tpe)
306
- case t @ Template (_, parents, _, _) =>
307
- t.parents.foreach(p => addInheritanceDependency(p.tpe.classSymbol) )
314
+ case t : Template =>
315
+ addInheritanceDependency(t )
308
316
case _ =>
309
317
}
310
318
traverseChildren(tree)
You can’t perform that action at this time.
0 commit comments