From 17eeec687621999f0a14032faba0c78245309e6a Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Sun, 4 Mar 2012 21:28:01 +0100 Subject: [PATCH] Move condition out of SameAPI. It was tenuously relying on the caller short-circuiting with `shortcutSameSource`. --- compile/api/SameAPI.scala | 7 +------ compile/inc/Incremental.scala | 7 ++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compile/api/SameAPI.scala b/compile/api/SameAPI.scala index 01493c60a..7ace3cfbd 100644 --- a/compile/api/SameAPI.scala +++ b/compile/api/SameAPI.scala @@ -44,12 +44,7 @@ object TopLevel object SameAPI { def apply(a: Source, b: Source): Boolean = - { - // Never consider a file containing macros as having the same API as the previous run. - val hasMacro = a.hasMacro || b.hasMacro - - !hasMacro && a.apiHash == b.apiHash && (a.hash.length > 0 && b.hash.length > 0) && apply(a.api, b.api) - } + a.apiHash == b.apiHash && (a.hash.length > 0 && b.hash.length > 0) && apply(a.api, b.api) def apply(a: SourceAPI, b: SourceAPI): Boolean = { diff --git a/compile/inc/Incremental.scala b/compile/inc/Incremental.scala index 211db2ce1..4c35b6b6a 100644 --- a/compile/inc/Incremental.scala +++ b/compile/inc/Incremental.scala @@ -59,7 +59,12 @@ object Incremental new APIChanges(modifiedAPIs, changedNames) } - def sameSource(a: Source, b: Source): Boolean = shortcutSameSource(a, b) || SameAPI(a,b) + def sameSource(a: Source, b: Source): Boolean = { + // Clients of a modified source file (ie, one that doesn't satisfy `shortcutSameSource`) containing macros must be recompiled. + val hasMacro = a.hasMacro || b.hasMacro + shortcutSameSource(a, b) || (!hasMacro && SameAPI(a,b)) + } + def shortcutSameSource(a: Source, b: Source): Boolean = !a.hash.isEmpty && !b.hash.isEmpty && sameCompilation(a.compilation, b.compilation) && (a.hash deepEquals b.hash) def sameCompilation(a: Compilation, b: Compilation): Boolean = a.startTime == b.startTime && a.target == b.target