File tree 2 files changed +10
-1
lines changed
ghcide/src/Development/IDE/Core
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
49
49
instance Hashable LinkableType
50
50
instance NFData LinkableType
51
51
52
+ -- | Encode the linkable into an ordered bytestring.
53
+ -- This is used to drive an ordered "newness" predicate in the
54
+ -- 'NeedsCompilation' build rule.
52
55
encodeLinkableType :: Maybe LinkableType -> ByteString
53
56
encodeLinkableType Nothing = " 0"
54
57
encodeLinkableType (Just BCOLinkable ) = " 1"
Original file line number Diff line number Diff line change @@ -1080,7 +1080,13 @@ mainRule = do
1080
1080
getClientSettingsRule
1081
1081
getHieAstsRule
1082
1082
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 ->
1084
1090
needsCompilationRule file
1085
1091
generateCoreRule
1086
1092
getImportMapRule
You can’t perform that action at this time.
0 commit comments