File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
ghcide/src/Development/IDE/Core Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ data LinkableType = ObjectLinkable | BCOLinkable
4949instance Hashable LinkableType
5050instance NFData LinkableType
5151
52+ -- | Encode the linkable into an ordered bytestring.
53+ -- This is used to drive an ordered "newness" predicate in the
54+ -- 'NeedsCompilation' build rule.
5255encodeLinkableType :: Maybe LinkableType -> ByteString
5356encodeLinkableType Nothing = " 0"
5457encodeLinkableType (Just BCOLinkable ) = " 1"
Original file line number Diff line number Diff line change @@ -1080,7 +1080,13 @@ mainRule = do
10801080 getClientSettingsRule
10811081 getHieAstsRule
10821082 getBindingsRule
1083- defineEarlyCutoff $ RuleNoDiagnostics $ \ NeedsCompilation file ->
1083+ -- This rule uses a custom newness check that relies on the encoding
1084+ -- produced by 'encodeLinkable'. This works as follows:
1085+ -- * <previous> -> <new>
1086+ -- * ObjectLinkable -> BCOLinkable : the prev linkable can be reused, signal "no change"
1087+ -- * Object/BCO -> NoLinkable : the prev linkable can be ignored, signal "no change"
1088+ -- * otherwise : the prev linkable cannot be reused, signal "value has changed"
1089+ defineEarlyCutoff $ RuleWithCustomNewnessCheck (<=) $ \ NeedsCompilation file ->
10841090 needsCompilationRule file
10851091 generateCoreRule
10861092 getImportMapRule
You can’t perform that action at this time.
0 commit comments