Skip to content

Commit 1358339

Browse files
committed
Revert "Prevent GetModificationTime in dependency file"
This reverts commit e4fd5f7.
1 parent 95e8a02 commit 1358339

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

ghcide/src/Development/IDE/Core/Shake.hs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,7 +1158,7 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
11581158
-- No changes in the dependencies and we have
11591159
-- an existing successful result.
11601160
Just (v@(Succeeded _ x), diags) -> do
1161-
ver <- estimateFileVersionUnsafely key FromProject (Just x) file
1161+
ver <- estimateFileVersionUnsafely key (Just x) file
11621162
doDiagnostics (vfsVersion =<< ver) $ Vector.toList diags
11631163
return $ Just $ RunResult ChangedNothing old $ A v
11641164
_ -> return Nothing
@@ -1174,20 +1174,20 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
11741174
Just (Succeeded ver v, _) -> Stale Nothing ver v
11751175
Just (Stale d ver v, _) -> Stale d ver v
11761176
Just (Failed b, _) -> Failed b
1177-
(fileOrigin, (bs, (diags, res))) <- do
1177+
(bs, (diags, res)) <- do
11781178
let doAction = actionCatch
11791179
(do v <- action staleV; liftIO $ evaluate $ force v) $
11801180
\(e :: SomeException) -> do
11811181
pure (Nothing, ([ideErrorText file $ T.pack $ show e | not $ isBadDependency e],Nothing))
11821182
case getSourceFileOrigin file of
1183-
FromProject -> (\r -> (FromProject, r)) <$> doAction
1183+
FromProject -> doAction
11841184
FromDependency -> if isSafeDependencyRule key
1185-
then (\r -> (FromDependency, r)) <$> doAction
1185+
then doAction
11861186
else error $
11871187
"defineEarlyCutoff': Undefined action for dependency source files\n"
11881188
++ show file ++ "\n"
11891189
++ show key
1190-
ver <- estimateFileVersionUnsafely key fileOrigin res file
1190+
ver <- estimateFileVersionUnsafely key res file
11911191
(bs, res) <- case res of
11921192
Nothing -> do
11931193
pure (toShakeValue ShakeStale bs, staleV)
@@ -1214,11 +1214,10 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
12141214
:: forall k v
12151215
. IdeRule k v
12161216
=> k
1217-
-> SourceFileOrigin
12181217
-> Maybe v
12191218
-> NormalizedFilePath
12201219
-> Action (Maybe FileVersion)
1221-
estimateFileVersionUnsafely _k fileOrigin v fp
1220+
estimateFileVersionUnsafely _k v fp
12221221
| fp == emptyFilePath = pure Nothing
12231222
| Just Refl <- eqT @k @GetModificationTime = pure v
12241223
-- GetModificationTime depends on these rules, so avoid creating a cycle
@@ -1229,10 +1228,7 @@ defineEarlyCutoff' doDiagnostics cmp key file old mode action = do
12291228
-- For all other rules - compute the version properly without:
12301229
-- * creating a dependency: If everything depends on GetModificationTime, we lose early cutoff
12311230
-- * creating bogus "file does not exists" diagnostics
1232-
| otherwise =
1233-
case fileOrigin of
1234-
FromDependency -> pure Nothing
1235-
FromProject -> useWithoutDependency (GetModificationTime_ False) fp
1231+
| otherwise = useWithoutDependency (GetModificationTime_ False) fp
12361232
isSafeDependencyRule
12371233
:: forall k v
12381234
. IdeRule k v

0 commit comments

Comments
 (0)