aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/HaskellCodeExplorer/AST/RenamedSource.hs11
-rw-r--r--src/HaskellCodeExplorer/AST/TypecheckedSource.hs81
-rw-r--r--src/HaskellCodeExplorer/GhcUtils.hs16
-rw-r--r--stack-8.8.1.yaml45
4 files changed, 120 insertions, 33 deletions
diff --git a/src/HaskellCodeExplorer/AST/RenamedSource.hs b/src/HaskellCodeExplorer/AST/RenamedSource.hs
index 1f42874..44e0190 100644
--- a/src/HaskellCodeExplorer/AST/RenamedSource.hs
+++ b/src/HaskellCodeExplorer/AST/RenamedSource.hs
@@ -2,6 +2,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE StrictData #-}
module HaskellCodeExplorer.AST.RenamedSource
@@ -80,7 +81,7 @@ import GHC
#if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0)
import HsExtension (GhcRn)
#endif
-import HaskellCodeExplorer.GhcUtils (hsPatSynDetails, ieLocNames)
+import HaskellCodeExplorer.GhcUtils (hsPatSynDetails, ieLocNames, ghcDL)
import Prelude hiding (span)
import TysWiredIn
( nilDataConName
@@ -367,7 +368,7 @@ patNames :: LPat GhcRn -> [NameOccurrence]
patNames :: LPat Name -> [NameOccurrence]
#endif
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-patNames (L _span (VarPat _ name)) =
+patNames (ghcDL -> (L _span (VarPat _ name))) =
#else
patNames (L _span (VarPat name)) =
#endif
@@ -377,7 +378,7 @@ patNames (L _span (VarPat name)) =
, isBinder = True
}
]
-patNames (L _span (ConPatIn name _)) =
+patNames (ghcDL -> (L _span (ConPatIn name _))) =
[ NameOccurrence
{ locatedName = Just <$> name
, description = "ConPatIn"
@@ -385,7 +386,7 @@ patNames (L _span (ConPatIn name _)) =
}
]
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-patNames (L _span (AsPat _ name _)) =
+patNames (ghcDL -> (L _span (AsPat _ name _))) =
#else
patNames (L _span (AsPat name _)) =
#endif
@@ -396,7 +397,7 @@ patNames (L _span (AsPat name _)) =
}
]
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-patNames (L _span (NPlusKPat _ name _ _ _ _)) =
+patNames (ghcDL -> (L _span (NPlusKPat _ name _ _ _ _))) =
#else
patNames (L _span (NPlusKPat name _ _ _ _ _)) =
#endif
diff --git a/src/HaskellCodeExplorer/AST/TypecheckedSource.hs b/src/HaskellCodeExplorer/AST/TypecheckedSource.hs
index 4321469..41a202e 100644
--- a/src/HaskellCodeExplorer/AST/TypecheckedSource.hs
+++ b/src/HaskellCodeExplorer/AST/TypecheckedSource.hs
@@ -4,6 +4,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE StrictData #-}
module HaskellCodeExplorer.AST.TypecheckedSource
@@ -110,7 +111,16 @@ import InstEnv
)
import Name (Name, nameOccName, nameUnique)
import Prelude hiding (span)
-import SrcLoc (GenLocated(..), SrcSpan(..), isGoodSrcSpan, isOneLineSpan, unLoc)
+import SrcLoc
+ ( GenLocated(..)
+ , SrcSpan(..)
+ , isGoodSrcSpan
+ , isOneLineSpan
+ , unLoc
+#if MIN_VERSION_GLASGOW_HASKELL(8,8,1,0)
+ , cL
+#endif
+ )
import TcEvidence (HsWrapper(..))
import TcHsSyn (conLikeResTy, hsLitType)
import Type
@@ -682,7 +692,10 @@ foldLHsExpr (L span expr@(HsApp fun arg)) = do
typ <- maybe (return Nothing) (funResultTySafe span "HsApp") funTy
addExprInfo span typ "HsApp" (exprSort expr)
return typ
-#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
+
+#if MIN_VERSION_GLASGOW_HASKELL(8,8,1,0)
+foldLHsExpr (L span ex@(HsAppType _ expr _)) = do
+#elif MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
foldLHsExpr (L span ex@(HsAppType _ expr)) = do
#else
foldLHsExpr (L _ (HsAppType _ _)) = return Nothing
@@ -856,7 +869,9 @@ foldLHsExpr (L span e@(RecordUpd expr binds cons _inputTys outTys _wrapper)) =
_ <- foldLHsExpr expr
mapM_ foldLHsRecUpdField binds
return $ Just typ'
-#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
+#if MIN_VERSION_GLASGOW_HASKELL(8,8,1,0)
+foldLHsExpr (L span e@(ExprWithTySig _ expr _)) = do
+#elif MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
foldLHsExpr (L span e@(ExprWithTySig _ expr)) = do
#else
foldLHsExpr (L _span (ExprWithTySig _expr _type)) = return Nothing
@@ -1422,22 +1437,22 @@ foldLPat :: LPat GhcTc -> State ASTState (Maybe Type)
foldLPat :: LPat Id -> State ASTState (Maybe Type)
#endif
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L _span (XPat _)) = return Nothing
-foldLPat (L _ (NPat _ (L _ (XOverLit _)) _ _)) = return Nothing
-foldLPat (L _ (NPlusKPat _ (L _ _) (L _ (XOverLit _)) _ _ _)) = return Nothing
-foldLPat (L span (VarPat _ (L _ identifier))) = do
+foldLPat (ghcDL -> L _span (XPat _)) = return Nothing
+foldLPat (ghcDL -> L _ (NPat _ (L _ (XOverLit _)) _ _)) = return Nothing
+foldLPat (ghcDL -> L _ (NPlusKPat _ (L _ _) (L _ (XOverLit _)) _ _ _)) = return Nothing
+foldLPat (ghcDL -> L span (VarPat _ (L _ identifier))) = do
#else
-foldLPat (L span (VarPat (L _ identifier))) = do
+foldLPat (ghcDL -> L span (VarPat (L _ identifier))) = do
#endif
(identifier', _) <- tidyIdentifier identifier
addIdentifierToIdSrcSpanMap span identifier' Nothing
return . Just . varType $ identifier'
-foldLPat (L span pat@(WildPat typ)) = do
+foldLPat (ghcDL -> L span pat@(WildPat typ)) = do
typ' <- tidyType typ
addExprInfo span (Just typ') "WildPat" (patSort pat)
return $ Just typ'
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span p@(LazyPat _ pat)) = do
+foldLPat (ghcDL -> L span p@(LazyPat _ pat)) = do
#else
foldLPat (L span p@(LazyPat pat)) = do
#endif
@@ -1445,7 +1460,7 @@ foldLPat (L span p@(LazyPat pat)) = do
addExprInfo span mbType "LazyPat" (patSort p)
return mbType
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span p@(AsPat _ (L idSpan identifier) pat)) = do
+foldLPat (ghcDL -> L span p@(AsPat _ (L idSpan identifier) pat)) = do
#else
foldLPat (L span p@(AsPat (L idSpan identifier) pat)) = do
#endif
@@ -1455,12 +1470,12 @@ foldLPat (L span p@(AsPat (L idSpan identifier) pat)) = do
_ <- foldLPat pat
return . Just . varType $ identifier'
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L _span (ParPat _ pat)) = foldLPat pat
+foldLPat (ghcDL -> L _span (ParPat _ pat)) = foldLPat pat
#else
-foldLPat (L _span (ParPat pat)) = foldLPat pat
+foldLPat (ghcDL -> L _span (ParPat pat)) = foldLPat pat
#endif
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span p@(BangPat _ pat)) = do
+foldLPat (ghcDL -> L span p@(BangPat _ pat)) = do
#else
foldLPat (L span p@(BangPat pat)) = do
#endif
@@ -1468,7 +1483,7 @@ foldLPat (L span p@(BangPat pat)) = do
addExprInfo span typ "BangPat" (patSort p)
return typ
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span p@(ListPat (ListPatTc typ _) pats)) = do
+foldLPat (ghcDL -> L span p@(ListPat (ListPatTc typ _) pats)) = do
#else
foldLPat (L span p@(ListPat pats typ _)) = do
#endif
@@ -1478,7 +1493,7 @@ foldLPat (L span p@(ListPat pats typ _)) = do
mapM_ foldLPat pats
return $ Just listType
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span pat@(TuplePat types pats boxity)) = do
+foldLPat (ghcDL -> L span pat@(TuplePat types pats boxity)) = do
#else
foldLPat (L span pat@(TuplePat pats boxity types)) = do
#endif
@@ -1488,7 +1503,7 @@ foldLPat (L span pat@(TuplePat pats boxity types)) = do
return $ Just typ'
#if MIN_VERSION_GLASGOW_HASKELL(8,2,2,0)
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L _span (SumPat _ pat _ _)) = do
+foldLPat (ghcDL -> L _span (SumPat _ pat _ _)) = do
#else
foldLPat (L _span (SumPat pat _ _ _types)) = do
#endif
@@ -1504,8 +1519,8 @@ foldLPat (L span pat@(PArrPat pats typ)) = do
mapM_ foldLPat pats
return $ Just typ'
#endif
-foldLPat (L _span (ConPatIn _ _)) = return Nothing
-foldLPat (L span pat@ConPatOut {..}) = do
+foldLPat (ghcDL -> L _span (ConPatIn _ _)) = return Nothing
+foldLPat (ghcDL -> L span pat@ConPatOut {..}) = do
let (L idSpan conLike) = pat_con
conId =
case conLike of
@@ -1519,18 +1534,18 @@ foldLPat (L span pat@ConPatOut {..}) = do
_ <- foldHsConPatDetails pat_args
return . Just . varType $ identifier'
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span p@(ViewPat typ expr pat)) = do
+foldLPat (ghcDL -> L span p@(ViewPat typ expr pat)) = do
#else
-foldLPat (L span p@(ViewPat expr pat typ)) = do
+foldLPat (ghcDL -> L span p@(ViewPat expr pat typ)) = do
#endif
typ' <- tidyType typ
addExprInfo span (Just typ') "ViewPat" (patSort p)
_ <- foldLPat pat
_ <- foldLHsExpr expr
return $ Just typ'
-foldLPat (L _ SplicePat {}) = return Nothing
+foldLPat (ghcDL -> L _ SplicePat {}) = return Nothing
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span (LitPat _ hsLit)) = do
+foldLPat (ghcDL -> L span (LitPat _ hsLit)) = do
#else
foldLPat (L span (LitPat hsLit)) = do
#endif
@@ -1544,7 +1559,7 @@ foldLPat (L span (LitPat hsLit)) = do
else Composite)
return $ Just typ'
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span pat@(NPat _ (L _spanLit (OverLit (OverLitTc {..}) _ _)) _ _)) = do
+foldLPat (ghcDL -> L span pat@(NPat _ (L _spanLit (OverLit (OverLitTc {..}) _ _)) _ _)) = do
#else
foldLPat (L span pat@(NPat (L _spanLit OverLit {ol_type}) _ _ _)) = do
#endif
@@ -1552,7 +1567,7 @@ foldLPat (L span pat@(NPat (L _spanLit OverLit {ol_type}) _ _ _)) = do
addExprInfo span (Just typ') "NPat" (patSort pat)
return $ Just ol_type
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span pat@(NPlusKPat typ (L idSpan identifier) (L litSpan (OverLit (OverLitTc {..}) _ _)) _ _ _)) = do
+foldLPat (ghcDL -> L span pat@(NPlusKPat typ (L idSpan identifier) (L litSpan (OverLit (OverLitTc {..}) _ _)) _ _ _)) = do
#else
foldLPat (L span pat@(NPlusKPat (L idSpan identifier) (L litSpan OverLit {ol_type}) _ _ _ typ)) = do
#endif
@@ -1569,7 +1584,12 @@ foldLPat (L span pat@(NPlusKPat (L idSpan identifier) (L litSpan OverLit {ol_typ
then Simple
else Composite)
return $ Just typ'
-#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
+#if MIN_VERSION_GLASGOW_HASKELL(8,8,1,0)
+foldLPat (ghcDL -> L _span (SigPat typ pat _)) = do
+ typ' <- tidyType typ
+ _ <- foldLPat pat
+ return $ Just typ'
+#elif MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
foldLPat (L _span (SigPat typ pat)) = do
typ' <- tidyType typ
_ <- foldLPat pat
@@ -1582,14 +1602,21 @@ foldLPat (L _span (SigPatOut pat typ)) = do
return $ Just typ'
#endif
#if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0)
-foldLPat (L span p@(CoPat _ _ pat typ)) = do
+foldLPat (ghcDL -> L span p@(CoPat _ _ pat typ)) = do
#else
foldLPat (L span p@(CoPat _ pat typ)) = do
#endif
typ' <- tidyType typ
addExprInfo span (Just typ') "CoPat" (patSort p)
+#if MIN_VERSION_GLASGOW_HASKELL(8,8,1,0)
+ _ <- foldLPat (cL span pat)
+#else
_ <- foldLPat (L span pat)
+#endif
return Nothing
+#if MIN_VERSION_GLASGOW_HASKELL(8,8,1,0)
+foldLPat _ = return Nothing
+#endif
#if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0)
foldHsConPatDetails
diff --git a/src/HaskellCodeExplorer/GhcUtils.hs b/src/HaskellCodeExplorer/GhcUtils.hs
index bb89832..0f3ff1c 100644
--- a/src/HaskellCodeExplorer/GhcUtils.hs
+++ b/src/HaskellCodeExplorer/GhcUtils.hs
@@ -25,6 +25,7 @@ module HaskellCodeExplorer.GhcUtils
, hsGroupVals
, hsPatSynDetails
, ieLocNames
+ , ghcDL
-- * Lookups
, lookupIdInTypeEnv
, lookupNameModuleAndPackage
@@ -165,6 +166,11 @@ import GHC
, tfe_pats
#endif
, tfid_eqn
+#if MIN_VERSION_ghc(8,8,0)
+ , dL
+ , HasSrcSpan
+ , SrcSpanLess
+#endif
)
import qualified HaskellCodeExplorer.Types as HCE
@@ -1203,7 +1209,7 @@ isUserLSig (L _ ClassOpSig {}) = True
isUserLSig _ = False
#if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0)
-getMainDeclBinder :: HsDecl pass -> [IdP pass]
+getMainDeclBinder :: HsDecl GhcRn -> [IdP GhcRn]
#else
getMainDeclBinder :: HsDecl name -> [name]
#endif
@@ -1401,3 +1407,11 @@ makeAnchorId (f:r) = escape isAlpha f ++ concatMap (escape isLegal) r
isLegal '_' = True
isLegal '.' = True
isLegal c = isAscii c && isAlphaNum c
+
+#if MIN_VERSION_ghc(8,8,0)
+ghcDL :: GHC.HasSrcSpan a => a -> GHC.Located (GHC.SrcSpanLess a)
+ghcDL = GHC.dL
+#else
+ghcDL :: GHC.Located a -> GHC.Located a
+ghcDL x = x
+#endif
diff --git a/stack-8.8.1.yaml b/stack-8.8.1.yaml
new file mode 100644
index 0000000..b7bc076
--- /dev/null
+++ b/stack-8.8.1.yaml
@@ -0,0 +1,45 @@
+resolver: nightly-2019-09-28
+packages:
+- '.'
+- 'vendor/cabal-helper-0.8.1.2'
+allow-newer: true
+extra-deps:
+ - cabal-plan-0.4.0.0
+ - blaze-html-0.9.1.1@sha256:66f01bef8455b3387e592819584dbd5e501fe0bb5620a3bad80ca8f92d2b2296
+ - cabal-install-3.0.0.0@sha256:5e3c4376e53c06521cca2c037074423dbb967e228af6174bf842ff38aa82b035
+ - haddock-library-1.7.0@sha256:8f230ebb680b559256d9c18ce4942ba5bf220b167804b4ebd5cc9e47cc4973cd
+ - servant-0.16.2@sha256:6c5d19d09a9dd2f2b2bf99193f944491f8374802678b79ec729e3f3ae51e216d
+ - servant-server-0.16.2@sha256:f6b36df7c4f1688ff9d48d272e6cfc5f001b3221d2a732e73faf44e8b9e1ea04
+ - wai-extra-3.0.28@sha256:6f3a8f9c750a4f4a1f03fef8e48413791a2268dfd1eedfb7b12c2b28ba6c7864
+ - warp-3.3.2@sha256:7bb7d6c913571ad03a9bf5dca1590f0fa343ba39092f10ba7f083aba0d59f777
+ - wreq-0.5.3.2@sha256:eb1d848e983a1d1b8960c28840b55e56d8b3d760e9d014b5d9d018b13439e63f
+ - HTTP-4000.3.14@sha256:d4a96774226d2ea5011cb27a6c89fff848e541469e53b9cd9b3a9488afebf323
+ - authenticate-oauth-1.6@sha256:ba9e93e7b949fa4799ae7b3cb302df38dc7fb0be0460803b6c48636317b2bcbb
+ - blaze-markup-0.8.2.2@sha256:fda3582c37167b7b26a3e973f8501e0889041de01416add83c592cf03bbb7a47
+ - http-client-tls-0.3.5.3@sha256:c97c3d88e6318a3056e42e2cd0913d5c4bff381f83341bb6ff06865fd12c8b52
+ - http-media-0.8.0.0@sha256:05215cafddb1a34cd70b3f1247953a753a4256a87228b68b8e748cdffa827363
+ - http2-2.0.3@sha256:c08885f0fd26ae035b169029b782cc693cc30e4d7a3b6f21a61de31085e8cfae
+ - resolv-0.1.1.3@sha256:bb759a2d7367aad1ce61b3ba877cf64a200ebab4bc7e61cf71c9e879932ae348
+ - wai-app-static-3.1.6.3@sha256:a9015b84eb1aa2922c85a6ed70a105b0209e54e04f0004f5fa12ec68c39a1f07
+ - connection-0.3.1@sha256:65da1c055610095733bcd228d85dff80804b23a5d18fede994a0f9fcd1b0c121
+ - crypto-pubkey-types-0.4.3@sha256:9bcf9ec7045f1043edac2b8331d9120bc055083578dbd953a3cccfc7452d9e8c
+ - tls-1.5.1@sha256:a3dd34b10decece313f861247233b1d7c6058c99b32fb128554612fe3394e45a
+ - x509-1.7.5@sha256:01185a9a17bee4e89287d9e32bfaa673133cf2b09a39759627bed1f72ea528fd
+ - x509-store-1.6.7@sha256:a707b2f4ba3c02ebacd7ecd19e9f0c0b211b58270329c2c775a2c1df26820212
+ - x509-system-1.6.6@sha256:3a1b9cc26715d7cb3cd1a3f8b6153f12c2d42187ac5df305c3973c78a061db05
+ - x509-validation-1.6.11@sha256:7798c62717265a395f1092e6ad576f64b7876c289bb84353bddc0bb5a66c6b26
+ - git: https://github.com/athas/hs-asn1.git
+ commit: cb054f8642e340138283ee73167cd494f531d67d
+ subdirs:
+ - data
+ - encoding
+ - parse
+ - types
+ - git: https://github.com/haskell-vanguard/hs-socks
+ commit: dcd853bfa7d29e7ec7df1dbc0eb5d93a3d43d83c
+ - git: https://github.com/ocharles/RSA
+ commit: bb712862c868975ab033e1079751d9e3787d3a33
+ - git: https://github.com/haskell/hackage-security
+ commit: 2057cdf2abba852881cd9d055c96f03cd8c829e7
+ subdirs:
+ - hackage-security