This repository has been archived by the owner on Jan 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 97
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pepeiborra
suggested changes
Nov 1, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. But this code is very tricky so I think it's worth adding an extra check.
Comment on lines
+705
to
+728
Just ObjectLinkable | ||
| not (recompileRequired obj_needs_recomp) | ||
-- If the module used TH splices when it was last | ||
-- compiled, then the recompilation check is not | ||
-- accurate enough (https://gitlab.haskell.org/ghc/ghc/-/issues/481) | ||
-- and we must ignore | ||
-- it. However, if the module is stable (none of | ||
-- the modules it depends on, directly or | ||
-- indirectly, changed), then we *can* skip | ||
-- recompilation. This is why the SourceModified | ||
-- type contains SourceUnmodifiedAndStable, and | ||
-- it's pretty important: otherwise ghc --make | ||
-- would always recompile TH modules, even if | ||
-- nothing at all has changed. Stability is just | ||
-- the same check that make is doing for us in | ||
-- one-shot mode. | ||
, not (mi_used_th iface) || SourceUnmodifiedAndStable == sourceMod | ||
-> do | ||
-- Look for the old obj if we don't need recompilation | ||
mb_linkable <- liftIO $ findObjectLinkableMaybe (ms_mod ms) (ms_location ms) | ||
case mb_linkable of | ||
Just linkable@(LM obj_time _ _) | obj_time > ms_hs_date ms -> liftIO $ do | ||
hmi <- mkDetailsFromIface session iface (Just linkable) | ||
return ([], Just $ HiFileResult ms hmi) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, so we do not need to regenerate the iface when TH splices are involved, only recompile. This is great.
pepeiborra
approved these changes
Nov 1, 2020
The ghcide Github project is becoming archived and merged into https://github.com/haskell/haskell-language-server This PR will need to be reopened in the HLS repo. To do that, create a new branch from HLS HEAD in your HLS repo and do:
Thanks! |
7 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Clean up recompilation check - specifically the
RecompileRequired
result returned bycheckOldIface
only indicates whether we should recompile the object code. In particular, we don't need to pay attention to it if we aren't generating aLinkable
.The
Maybe ModIface
field being aJust
is sufficient to indicate that we don't need to regenerate theModIface
.