Compatibility with GHC 8.2.1
This commit is contained in:
@@ -166,4 +166,5 @@ removeForAlls' ty (Just (pre, ftype))
|
||||
| otherwise = ty
|
||||
|
||||
showOutputable :: Outputable a => DynFlags -> a -> String
|
||||
showOutputable dflag = unwords . lines . showPage dflag styleUnqualified . ppr
|
||||
showOutputable dflag =
|
||||
unwords . lines . showPage dflag (styleUnqualified dflag) . ppr
|
||||
|
||||
@@ -116,7 +116,9 @@ getSignature modSum lineNo colNo = do
|
||||
p@ParsedModule{pm_parsed_source = ps} <- G.parseModule modSum
|
||||
-- Inspect the parse tree to find the signature
|
||||
case listifyParsedSpans ps (lineNo, colNo) :: [G.LHsDecl G.RdrName] of
|
||||
#if __GLASGOW_HASKELL__ >= 800
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
[L loc (G.SigD (Ty.TypeSig names (G.HsWC _ (G.HsIB _ (L _ ty) _))))] ->
|
||||
#elif __GLASGOW_HASKELL__ >= 800
|
||||
[L loc (G.SigD (Ty.TypeSig names (G.HsIB _ (G.HsWC _ _ (L _ ty)))))] ->
|
||||
#elif __GLASGOW_HASKELL__ >= 710
|
||||
[L loc (G.SigD (Ty.TypeSig names (L _ ty) _))] ->
|
||||
@@ -133,7 +135,9 @@ getSignature modSum lineNo colNo = do
|
||||
case Gap.getClass lst of
|
||||
Just (clsName,loc) -> obtainClassInfo minfo clsName loc
|
||||
_ -> return Nothing
|
||||
#if __GLASGOW_HASKELL__ >= 800
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
[L loc (G.TyClD (G.FamDecl (G.FamilyDecl info (L _ name) (G.HsQTvs _ vars _) _ _ _)))] -> do
|
||||
#elif __GLASGOW_HASKELL__ >= 800
|
||||
[L loc (G.TyClD (G.FamDecl (G.FamilyDecl info (L _ name) (G.HsQTvs _ vars _) _ _)))] -> do
|
||||
#elif __GLASGOW_HASKELL__ >= 708
|
||||
[L loc (G.TyClD (G.FamDecl (G.FamilyDecl info (L _ name) (G.HsQTvs _ vars) _)))] -> do
|
||||
@@ -365,7 +369,11 @@ refine file lineNo colNo (Expression expr) =
|
||||
modSum <- fileModSummaryWithMapping file
|
||||
p <- G.parseModule modSum
|
||||
tcm@TypecheckedModule{tm_typechecked_source = tcs} <- G.typecheckModule p
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
ety <- G.exprType G.TM_Inst expr
|
||||
#else
|
||||
ety <- G.exprType expr
|
||||
#endif
|
||||
whenFound oopts (findVar dflag style tcm tcs lineNo colNo) $
|
||||
\(loc, name, rty, paren) ->
|
||||
let eArgs = getFnArgs ety
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module GhcMod.Exe.Test where
|
||||
|
||||
import Control.Applicative
|
||||
@@ -36,6 +38,15 @@ test f = runGmlT' [Left f] (fmap setHscInterpreted . deferErrors) $ do
|
||||
|
||||
return ""
|
||||
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
runTest :: GhcMonad m => String -> m (Maybe SomeException)
|
||||
runTest fn = do
|
||||
res <- execStmt ("quickCheck " ++ fn) execOptions
|
||||
return $ case res of
|
||||
ExecComplete (Right _) _ -> Nothing
|
||||
ExecComplete (Left se) _ -> Just se
|
||||
_ -> error "runTest"
|
||||
#else
|
||||
runTest :: GhcMonad m => String -> m (Maybe SomeException)
|
||||
runTest fn = do
|
||||
res <- runStmt ("quickCheck " ++ fn) RunToCompletion
|
||||
@@ -43,3 +54,4 @@ runTest fn = do
|
||||
RunOk [] -> Nothing
|
||||
RunException se -> Just se
|
||||
_ -> error "runTest"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user