Skip to content

Commit 85ad4df

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

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

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

Lines changed: 3 additions & 13 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 (getLexicalFastString),
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
@@ -581,17 +581,7 @@ defRowToSymbolInfo _ = Nothing
581581
pointCommand :: HieASTs t -> Position -> (HieAST t -> a) -> [a]
582582
pointCommand hf pos k =
583583
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
584+
case selectSmallestContaining (sp $ getLexicalFastString fs) ast of
595585
Nothing -> Nothing
596586
Just ast' -> Just $ k ast'
597587
where

0 commit comments

Comments
 (0)