Skip to content

Commit af64de7

Browse files
committed
Remove comment referring to GHC 9.2 and fix code
1 parent 9b952c8 commit af64de7

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

ghcide/src/Development/IDE/GHC/Compat/Logger.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{-# LANGUAGE CPP #-}
2-
-- | Compat module for GHC 9.2 Logger infrastructure.
2+
-- | Compat module for logger infrastructure.
33
module Development.IDE.GHC.Compat.Logger (
44
putLogHook,
55
Logger.pushLogHook,

ghcide/src/Development/IDE/Spans/AtPoint.hs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module Development.IDE.Spans.AtPoint (
2525
) where
2626

2727

28-
import GHC.Data.FastString (lengthFS)
28+
import GHC.Data.FastString (LexicalFastString (..),
29+
lengthFS)
2930
import qualified GHC.Utils.Outputable as O
3031

3132
import Development.IDE.GHC.Error
@@ -50,7 +51,6 @@ import Control.Monad.Extra
5051
import Control.Monad.IO.Class
5152
import Control.Monad.Trans.Class
5253
import Control.Monad.Trans.Maybe
53-
import Data.Coerce (coerce)
5454
import qualified Data.HashMap.Strict as HM
5555
import qualified Data.Map.Strict as M
5656
import Data.Maybe
@@ -580,18 +580,8 @@ defRowToSymbolInfo _ = Nothing
580580

581581
pointCommand :: HieASTs t -> Position -> (HieAST t -> a) -> [a]
582582
pointCommand hf pos k =
583-
M.elems $ flip M.mapMaybeWithKey (getAsts hf) $ \fs ast ->
584-
-- Since GHC 9.2:
585-
-- getAsts :: Map HiePath (HieAst a)
586-
-- type HiePath = LexicalFastString
587-
--
588-
-- but before:
589-
-- getAsts :: Map HiePath (HieAst a)
590-
-- type HiePath = FastString
591-
--
592-
-- 'coerce' here to avoid an additional function for maintaining
593-
-- backwards compatibility.
594-
case selectSmallestContaining (sp $ coerce fs) ast of
583+
M.elems $ flip M.mapMaybeWithKey (getAsts hf) $ \(LexicalFastString fs) ast ->
584+
case selectSmallestContaining (sp fs) ast of
595585
Nothing -> Nothing
596586
Just ast' -> Just $ k ast'
597587
where

0 commit comments

Comments
 (0)