diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2016-11-27 03:17:40 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2017-01-28 19:12:19 +0100 |
commit | 57641b9c7447fa0a6f1f47352dffb4c56c560b6a (patch) | |
tree | d4d6552e801b412752eac0b67c6a71ef605c05c4 | |
parent | 51a458efeeebfeed6c357d56cf8afe5b06e86724 (diff) | |
download | dotty-57641b9c7447fa0a6f1f47352dffb4c56c560b6a.tar.gz dotty-57641b9c7447fa0a6f1f47352dffb4c56c560b6a.tar.bz2 dotty-57641b9c7447fa0a6f1f47352dffb4c56c560b6a.zip |
sbt.ExtractDependencies: avoid false dependencies
Type#member might return a denotation that doesn't "really exists" (as
defined by TypeAssigner#reallyExists), in some circumstance this
denotation can refer to a symbol in a class that is in the classpath but
that is not used by this file, so using addDependency on the result of
Type#member might add a false dependency. We avoid this by using
Type#select instead which will internally do the right thing.
This issue was discovered while compiling the bootstrapped projects
which would sometimes force a full recompilation for no reason.
-rw-r--r-- | compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala index fefa63f6f..c392880c5 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ExtractDependencies.scala @@ -175,7 +175,7 @@ private class ExtractDependenciesCollector(implicit val ctx: Context) extends tp override def traverse(tree: Tree)(implicit ctx: Context): Unit = { tree match { case Import(expr, selectors) => - def lookupImported(name: Name) = expr.tpe.member(name).symbol + def lookupImported(name: Name) = expr.tpe.select(name).typeSymbol def addImported(name: Name) = { // importing a name means importing both a term and a type (if they exist) addDependency(lookupImported(name.toTermName)) |