Skip to content

Commit

Permalink
Only populate deprecated Unit#depends under -Ytrack-dependencies
Browse files Browse the repository at this point in the history
Not used by Zinc since 2016 sbt/zinc#86
  • Loading branch information
retronym committed Apr 6, 2020
1 parent bb4d3e2 commit d505681
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/compiler/scala/tools/nsc/CompilationUnits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ trait CompilationUnits { global: Global =>
/** Note: depends now contains toplevel classes.
* To get their sourcefiles, you need to dereference with .sourcefile
*/
private[this] val _depends = mutable.HashSet[Symbol]()
private[this] val _depends = if (settings.YtrackDependencies.value) mutable.HashSet[Symbol]() else null
@deprecated("Not supported and no longer used by Zinc", "2.12.9")
def depends = _depends
def registerDependency(symbol: Symbol): Unit = {
def depends: mutable.HashSet[Symbol] = if (_depends == null) mutable.HashSet[Symbol]() else _depends
def registerDependency(symbol: Symbol): Unit = if (settings.YtrackDependencies.value) {
// sbt compatibility (scala/bug#6875)
//
// imagine we have a file named A.scala, which defines a trait named Foo and a module named Main
Expand Down
1 change: 1 addition & 0 deletions src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ trait ScalaSettings extends AbsScalaSettings
val YpickleJava = BooleanSetting("-Ypickle-java", "Pickler phase should compute pickles for .java defined symbols for use by build tools").internalOnly()
val YpickleWrite = StringSetting("-Ypickle-write", "directory|jar", "destination for generated .sig files containing type signatures.", "", None).internalOnly()
val YpickleWriteApiOnly = BooleanSetting("-Ypickle-write-api-only", "Exclude private members (other than those material to subclass compilation, such as private trait vals) from generated .sig files containing type signatures.").internalOnly()
val YtrackDependencies = BooleanSetting("-Ytrack-dependencies", "Record references to classes ").internalOnly()

sealed abstract class CachePolicy(val name: String, val help: String)
object CachePolicy {
Expand Down
3 changes: 1 addition & 2 deletions src/compiler/scala/tools/nsc/typechecker/Infer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ trait Infer extends Checkable {
case NoSymbol if sym.isJavaDefined && context.unit.isJava => sym // don't try to second guess Java; see #4402
case sym1 => sym1
}
// XXX So... what's this for exactly?
if (context.unit.exists)
if (settings.YtrackDependencies.value)
context.unit.registerDependency(sym.enclosingTopLevelClass)

if (sym.isError)
Expand Down

0 comments on commit d505681

Please sign in to comment.