@@ -73,8 +73,7 @@ import Development.IDE.Types.Diagnostics
7373import Development.IDE.Types.Exports
7474import Development.IDE.Types.Location
7575import Development.IDE.Types.Options
76- import GHC (
77- DeltaPos (.. ),
76+ import GHC (DeltaPos (.. ),
7877 EpAnn (.. ),
7978 LEpaComment )
8079import qualified GHC.LanguageExtensions as Lang
@@ -109,9 +108,9 @@ import Text.Regex.TDFA ((=~), (=~~))
109108#if !MIN_VERSION_ghc(9,9,0)
110109import Development.IDE.GHC.Compat.ExactPrint (makeDeltaAst )
111110import GHC (AddEpAnn (AddEpAnn ),
112- AnnsModule (am_main ),
113111 Anchor (anchor_op ),
114112 AnchorOperation (.. ),
113+ AnnsModule (am_main ),
115114 EpaLocation (.. ))
116115#endif
117116
@@ -123,11 +122,11 @@ import GHC (AddEpAnn (Ad
123122 HasLoc (.. ))
124123#endif
125124#if MIN_VERSION_ghc(9,11,0)
126- import GHC (EpaLocation ,
127- AnnsModule (am_where ),
125+ import GHC (AnnsModule (am_where ),
126+ EpToken (.. ),
127+ EpaLocation ,
128128 EpaLocation' (.. ),
129- HasLoc (.. ),
130- EpToken (.. ))
129+ HasLoc (.. ))
131130#endif
132131
133132
@@ -680,14 +679,16 @@ suggestDeleteUnusedBinding
680679 indexedContent
681680 name
682681 (L _ Match {m_grhss= GRHSs {grhssLocalBinds}}) = do
683- let go bag lsigs =
682+ let emptyBag bag =
684683#if MIN_VERSION_ghc(9,11,0)
685- if null bag
684+ null bag
686685#else
687- if isEmptyBag bag
686+ isEmptyBag bag
688687#endif
689- then []
690- else concatMap (findRelatedSpanForHsBind indexedContent name lsigs) bag
688+ go bag lsigs =
689+ if emptyBag bag
690+ then []
691+ else concatMap (findRelatedSpanForHsBind indexedContent name lsigs) bag
691692 case grhssLocalBinds of
692693 (HsValBinds _ (ValBinds _ bag lsigs)) -> go bag lsigs
693694 _ -> []
@@ -858,7 +859,6 @@ suggestAddTypeAnnotationToSatisfyConstraints sourceOpt Diagnostic{_range=_range,
858859 | otherwise = []
859860 where
860861 makeAnnotatedLit ty lit = " (" <> lit <> " :: " <> ty <> " )"
861- #if MIN_VERSION_ghc(9,4,0)
862862 pat multiple at inArg inExpr = T. concat [ " .*Defaulting the type variable "
863863 , " .*to type ‘([^ ]+)’ "
864864 , " in the following constraint"
@@ -869,17 +869,6 @@ suggestAddTypeAnnotationToSatisfyConstraints sourceOpt Diagnostic{_range=_range,
869869 , if inExpr then " .+In the expression" else " "
870870 , " .+In the expression"
871871 ]
872- #else
873- pat multiple at inArg inExpr = T. concat [ " .*Defaulting the following constraint"
874- , if multiple then " s" else " "
875- , " to type ‘([^ ]+)’ "
876- , " .*arising from the literal ‘(.+)’"
877- , if inArg then " .+In the.+argument" else " "
878- , if at then " .+at ([^ ]*)" else " "
879- , if inExpr then " .+In the expression" else " "
880- , " .+In the expression"
881- ]
882- #endif
883872 codeEdit range ty lit replacement =
884873 let title = " Add type annotation ‘" <> ty <> " ’ to ‘" <> lit <> " ’"
885874 edits = [TextEdit range replacement]
@@ -1757,8 +1746,8 @@ findPositionAfterModuleName ps _hsmodName' = do
17571746 EpAnnNotUsed -> Nothing
17581747#endif
17591748#if MIN_VERSION_ghc(9,11,0)
1760- filterWhere (EpTok loc) = Just loc
1761- filterWhere _ = Nothing
1749+ filterWhere (EpTok loc) = Just loc
1750+ filterWhere _ = Nothing
17621751#else
17631752 filterWhere (AddEpAnn AnnWhere loc) = Just loc
17641753 filterWhere _ = Nothing
@@ -1797,7 +1786,7 @@ findPositionAfterModuleName ps _hsmodName' = do
17971786
17981787#if MIN_VERSION_ghc(9,11,0)
17991788 anchorOpLine :: EpaLocation' a -> Int
1800- anchorOpLine EpaSpan {} = 0
1789+ anchorOpLine EpaSpan {} = 0
18011790 anchorOpLine (EpaDelta _ (SameLine _) _) = 0
18021791 anchorOpLine (EpaDelta _ (DifferentLine line _) _) = line
18031792#elif MIN_VERSION_ghc(9,9,0)
0 commit comments