From aaa34891cb9cd87b803aef8dfc5386545b7a0784 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Tue, 25 Apr 2006 14:09:32 +0000 Subject: [PATCH] Fix recompilation checking. One-shot compilation was throwing away the old iface read by checkOldIface, with the result that version numbers were never being incremented. Fixes the recomp001 test too. --- compiler/main/HscMain.lhs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/main/HscMain.lhs b/compiler/main/HscMain.lhs index 986d2ce..fdad852 100644 --- a/compiler/main/HscMain.lhs +++ b/compiler/main/HscMain.lhs @@ -217,6 +217,9 @@ data CompState get :: Comp CompState get = Comp $ \s -> return (s,s) +modify :: (CompState -> CompState) -> Comp () +modify f = Comp $ \s -> return ((), f s) + gets :: (CompState -> a) -> Comp a gets getter = do st <- get return (getter st) @@ -253,6 +256,10 @@ hscMkCompiler norecomp messenger frontend backend <- {-# SCC "checkOldIface" #-} liftIO $ checkOldIface hsc_env mod_summary source_unchanged mbOldIface + -- save the interface that comes back from checkOldIface. + -- In one-shot mode we don't have the old iface until this + -- point, when checkOldIface reads it from the disk. + modify (\s -> s{ compOldIface = mbCheckedIface }) case mbCheckedIface of Just iface | not recomp_reqd -> do messenger mbModIndex False -- 1.7.10.4