on master help sign in
Check if existing IBC file has old version in Chaser.hs
commitd5bde2277b4733d065604f11df55069181b3e160 authorPaul Koerbitz <p.koerbitz@smartreporting.de> dateWed 15 Jul 2015, 22:23 (11 years ago) parent8eb81e4
1 file changed+15−18
src/Idris/Chaser.hs+15−18
src/Idris/Chaser.hs+15−18
@@ -116,29 +116,26 @@ buildTree built fp = btree [] fp
116116 else return []
117117 mt <- idrisCatch (runIO $ getModificationTime fn)
118118 (\c -> runIO $ getIModTime src)
119− ok <- checkIBCUpToDate fn src
120− return [MTree (IBC fn src) ok mt ms]
119+ -- FIXME: It's also not up to date if anything it imports has
120+ -- been modified since its own ibc has.
121+ --
122+ -- Issue #1592 on the issue tracker.
123+ --
124+ -- https://github.com/idris-lang/Idris-dev/issues/1592
125+ ibcOutdated <- fn `younger` (getSrcFile src)
126+ ibcValid <- hasValidIBCVersion fn
127+ return [MTree (IBC fn src) (ibcOutdated || not ibcValid) mt ms]
121128
122129 getSrcFile (IBC _ src) = getSrcFile src
123130 getSrcFile (LIDR src) = src
124131 getSrcFile (IDR src) = src
125132
126− -- FIXME: It's also not up to date if anything it imports has
127− -- been modified since its own ibc has.
128− --
129− -- Issue #1592 on the issue tracker.
130− --
131− -- https://github.com/idris-lang/Idris-dev/issues/1592
132−
133− checkIBCUpToDate fn (LIDR src) = older fn src
134− checkIBCUpToDate fn (IDR src) = older fn src
135−
136− older ibc src = do exist <- runIO $ doesFileExist src
137− if exist then do
138− ibct <- runIO $ getModificationTime ibc
139− srct <- runIO $ getModificationTime src
140− return (srct >= ibct)
141− else return False
133+ younger ibc src = do exist <- runIO $ doesFileExist src
134+ if exist then do
135+ ibct <- runIO $ getModificationTime ibc
136+ srct <- runIO $ getModificationTime src
137+ return (srct > ibct)
138+ else return False
142139
143140 children :: Bool -> FilePath -> [FilePath] -> Idris [ModuleTree]
144141 children lit f done = -- idrisCatch