diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2017-03-05 19:21:28 +0900 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2017-03-07 14:06:42 +0100 |
commit | b2f30edc13a3af7fdfec6812b61fce8ca83cde91 (patch) | |
tree | a151c52af6cbc1739074dce1487b7b0efc2369ac /compiler/src/dotty/tools/dotc/sbt | |
parent | c90ea6b62de5d70f8855b377688f62c40dfe3a66 (diff) | |
download | dotty-b2f30edc13a3af7fdfec6812b61fce8ca83cde91.tar.gz dotty-b2f30edc13a3af7fdfec6812b61fce8ca83cde91.tar.bz2 dotty-b2f30edc13a3af7fdfec6812b61fce8ca83cde91.zip |
Fix incremental overcompilation due to instabilities
The output of ExtractAPI should be stable, otherwise sbt might
incorrectly conclude that some API changed because its hash is
different, even though the source hasn't changed. This commit fixes two
cases where this might happen:
- package prefixes in NamedTypes are unstable, we already worked around this by
normalizing them, but only for classes, we now always do it.
- We use a simplified representation for `_ >: Nothing <: Any`, this is
now checked using `isDirectRef` instead of referential equality on types
since there is more than one way to represent `Nothing` and `Any`.
Both of these issues were found while compiling dotty with
`dotty-compiler-bootstrapped/compile` and making small changes.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/sbt')
-rw-r--r-- | compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala index 7f44af486..599522b74 100644 --- a/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala +++ b/compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala @@ -350,7 +350,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder case tp: NamedType => val sym = tp.symbol // Normalize package prefix to avoid instability of representation - val prefix = if (sym.isClass && sym.owner.is(Package)) + val prefix = if (sym.owner.is(Package)) sym.owner.thisType else tp.prefix @@ -358,7 +358,7 @@ private class ExtractAPICollector(implicit val ctx: Context) extends ThunkHolder case TypeApplications.AppliedType(tycon, args) => def processArg(arg: Type): api.Type = arg match { case arg @ TypeBounds(lo, hi) => // Handle wildcard parameters - if (lo.eq(defn.NothingType) && hi.eq(defn.AnyType)) + if (lo.isDirectRef(defn.NothingClass) && hi.isDirectRef(defn.AnyClass)) Constants.emptyType else { val name = "_" |