@@ -1158,7 +1158,7 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
1158
1158
-- No changes in the dependencies and we have
1159
1159
-- an existing successful result.
1160
1160
Just (v@ (Succeeded _ x), diags) -> do
1161
- ver <- estimateFileVersionUnsafely key (Just x) file
1161
+ ver <- estimateFileVersionUnsafely key FromProject (Just x) file
1162
1162
doDiagnostics (vfsVersion =<< ver) $ Vector. toList diags
1163
1163
return $ Just $ RunResult ChangedNothing old $ A v
1164
1164
_ -> return Nothing
@@ -1174,20 +1174,20 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
1174
1174
Just (Succeeded ver v, _) -> Stale Nothing ver v
1175
1175
Just (Stale d ver v, _) -> Stale d ver v
1176
1176
Just (Failed b, _) -> Failed b
1177
- (bs, (diags, res)) <- do
1177
+ (fileOrigin, ( bs, (diags, res) )) <- do
1178
1178
let doAction = actionCatch
1179
1179
(do v <- action staleV; liftIO $ evaluate $ force v) $
1180
1180
\ (e :: SomeException ) -> do
1181
1181
pure (Nothing , ([ideErrorText file $ T. pack $ show e | not $ isBadDependency e],Nothing ))
1182
1182
case getSourceFileOrigin file of
1183
- FromProject -> doAction
1183
+ FromProject -> ( \ r -> ( FromProject , r)) <$> doAction
1184
1184
FromDependency -> if isSafeDependencyRule key
1185
- then doAction
1185
+ then ( \ r -> ( FromDependency , r)) <$> doAction
1186
1186
else error $
1187
1187
" defineEarlyCutoff': Undefined action for dependency source files\n "
1188
1188
++ show file ++ " \n "
1189
1189
++ show key
1190
- ver <- estimateFileVersionUnsafely key res file
1190
+ ver <- estimateFileVersionUnsafely key fileOrigin res file
1191
1191
(bs, res) <- case res of
1192
1192
Nothing -> do
1193
1193
pure (toShakeValue ShakeStale bs, staleV)
@@ -1214,10 +1214,11 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
1214
1214
:: forall k v
1215
1215
. IdeRule k v
1216
1216
=> k
1217
+ -> SourceFileOrigin
1217
1218
-> Maybe v
1218
1219
-> NormalizedFilePath
1219
1220
-> Action (Maybe FileVersion )
1220
- estimateFileVersionUnsafely _k v fp
1221
+ estimateFileVersionUnsafely _k fileOrigin v fp
1221
1222
| fp == emptyFilePath = pure Nothing
1222
1223
| Just Refl <- eqT @ k @ GetModificationTime = pure v
1223
1224
-- GetModificationTime depends on these rules, so avoid creating a cycle
@@ -1228,7 +1229,10 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
1228
1229
-- For all other rules - compute the version properly without:
1229
1230
-- * creating a dependency: If everything depends on GetModificationTime, we lose early cutoff
1230
1231
-- * creating bogus "file does not exists" diagnostics
1231
- | otherwise = useWithoutDependency (GetModificationTime_ False ) fp
1232
+ | otherwise =
1233
+ case fileOrigin of
1234
+ FromDependency -> pure Nothing
1235
+ FromProject -> useWithoutDependency (GetModificationTime_ False ) fp
1232
1236
isSafeDependencyRule
1233
1237
:: forall k v
1234
1238
. IdeRule k v
0 commit comments