Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit 9507dc6

Browse files
committed
Add support for 8.2.1 - 8.4.4 for FunBind
1 parent 91dd4c7 commit 9507dc6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

hie-plugin-api/Haskell/Ide/Engine/Compat.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import qualified GHC
77
import qualified Type
88
import qualified TcHsSyn
99
import qualified TysWiredIn
10+
import qualified Var
1011

1112
#if MIN_VERSION_filepath(1,4,2)
1213
#else
@@ -123,6 +124,17 @@ pattern HsMultiIfType t <-
123124
GHC.HsMultiIf t _
124125
#endif
125126

127+
pattern FunBindType :: Type.Type -> GHC.HsBindLR GhcTc GhcTc
128+
pattern FunBindType t <-
129+
#if MIN_VERSION_ghc(8, 6, 0)
130+
GHC.FunBind _ (GHC.L _ (Var.varType -> t)) _ _ _
131+
#elif MIN_VERSION_ghc(8, 4, 0)
132+
GHC.FunBind (GHC.L _ (Var.varType -> t)) _ _ _ _
133+
#else
134+
GHC.FunBind (GHC.L _ (Var.varType -> t)) _ _ _ _
135+
#endif
136+
137+
126138
#if MIN_VERSION_ghc(8, 6, 0)
127139
matchGroupType :: GHC.MatchGroupTc -> GHC.Type
128140
matchGroupType (GHC.MatchGroupTc args res) = Type.mkFunTys args res

hie-plugin-api/Haskell/Ide/Engine/TypeMap.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import qualified TcHsSyn
1818
import qualified CoreUtils
1919
import qualified Type
2020
import qualified Desugar
21-
import qualified Var
2221
import Haskell.Ide.Engine.Compat
2322

2423
import Haskell.Ide.Engine.ArtifactMap
@@ -57,8 +56,8 @@ types hs_env = everythingInTypecheckedSourceM (ty `combineM` fun `combineM` funB
5756

5857
funBind :: forall a . Data a => a -> IO TypeMap
5958
funBind term = case cast term of
60-
(Just (GHC.L (GHC.RealSrcSpan spn) ((GHC.FunBind _ (GHC.L _ (idp :: GHC.IdP GhcTc)) _ _ _) :: GHC.HsBindLR GhcTc GhcTc))) ->
61-
return (IM.singleton (rspToInt spn) (Var.varType idp))
59+
(Just (GHC.L (GHC.RealSrcSpan spn) (FunBindType t))) ->
60+
return (IM.singleton (rspToInt spn) t)
6261
_ -> return IM.empty
6362

6463
-- | Combine two queries into one using alternative combinator.

0 commit comments

Comments
 (0)