Skip to content

Commit c00cca0

Browse files
committed
Compat with 8.6.5 (and tighten spans for rule suggestions)
1 parent 4baf294 commit c00cca0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Ide/Plugin/Retrie.hs

+8-5
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ suggestRuleRewrites ::
268268
GHC.Module ->
269269
LRuleDecls pass ->
270270
[(T.Text, CodeActionKind, RunRetrieParams)]
271-
suggestRuleRewrites originatingFile pos ms_mod (L l (HsRules {rds_rules}))
272-
| pos `isInsideSrcSpan` l =
271+
suggestRuleRewrites originatingFile pos ms_mod (L _ (HsRules {rds_rules})) =
273272
concat
274273
[ [ let rewrites =
275274
[Right $ RuleForward (qualify ms_mod ruleName)]
@@ -286,7 +285,13 @@ suggestRuleRewrites originatingFile pos ms_mod (L l (HsRules {rds_rules}))
286285
RunRetrieParams {..}
287286
)
288287
]
289-
| L _ (HsRule {rd_name = (L _ (_, rn))}) <- rds_rules,
288+
| L l r <- rds_rules,
289+
pos `isInsideSrcSpan` l,
290+
#if MIN_GHC_API_VERSION(8,8,0)
291+
let HsRule {rd_name = L _ (_, rn)} = r,
292+
#else
293+
let HsRule _ (L _ (_,rn)) _ _ _ _ = r,
294+
#endif
290295
let ruleName = unpackFS rn
291296
]
292297
suggestRuleRewrites _ _ _ _ = []
@@ -510,9 +515,7 @@ toImportDecl AddImport {..} = GHC.ImportDecl {..}
510515
ideclSourceSrc = NoSourceText
511516
ideclExt = GHC.noExtField
512517
ideclAs = toMod <$> ideclAsString
513-
514518
#if MIN_GHC_API_VERSION(8,10,0)
515-
516519
ideclQualified = if ideclQualifiedBool then GHC.QualifiedPre else GHC.NotQualified
517520
#else
518521
ideclQualified = ideclQualifiedBool

0 commit comments

Comments
 (0)