Fix older GHCs
This commit is contained in:
parent
50ab2091d6
commit
e360f7eb44
@ -42,6 +42,7 @@ module Language.Haskell.GhcMod.Gap (
|
||||
, lookupModulePackageInAllPackages
|
||||
, Language.Haskell.GhcMod.Gap.isSynTyCon
|
||||
, parseModuleHeader
|
||||
, mkErrStyle'
|
||||
) where
|
||||
|
||||
import Control.Applicative hiding (empty)
|
||||
@ -559,3 +560,10 @@ parseModuleHeader str dflags filename =
|
||||
POk pst rdr_module ->
|
||||
let (warns,_) = getMessages pst in
|
||||
Right (warns, rdr_module)
|
||||
|
||||
mkErrStyle' :: DynFlags -> PrintUnqualified -> PprStyle
|
||||
#if __GLASGOW_HASKELL__ >= 706
|
||||
mkErrStyle' = Outputable.mkErrStyle
|
||||
#else
|
||||
mkErrStyle' _ = Outputable.mkErrStyle
|
||||
#endif
|
||||
|
@ -134,7 +134,7 @@ ppErrMsg :: ErrMsg -> GmPprEnvM String
|
||||
ppErrMsg err = do
|
||||
dflags <- asks gpeDynFlags
|
||||
let unqual = errMsgContext err
|
||||
st = mkErrStyle dflags unqual
|
||||
st = Gap.mkErrStyle' dflags unqual
|
||||
let ext = showPage dflags st (errMsgExtraInfo err)
|
||||
m <- ppMsg st spn SevError msg
|
||||
return $ m ++ (if null ext then "" else "\n" ++ ext)
|
||||
|
@ -71,4 +71,8 @@ spec = do
|
||||
it "Uses the right qualification style" $ do
|
||||
withDirectory_ "test/data/nice-qualification" $ do
|
||||
res <- runD $ checkSyntax ["NiceQualification.hs"]
|
||||
#if __GLASGOW_HASKELL__ >= 708
|
||||
res `shouldBe` "NiceQualification.hs:4:8:Couldn't match expected type \8216IO ()\8217 with actual type \8216[Char]\8217\NULIn the expression: \"wrong type\"\NULIn an equation for \8216main\8217: main = \"wrong type\"\n"
|
||||
#else
|
||||
res `shouldBe` "NiceQualification.hs:4:8:Couldn't match expected type `IO ()' with actual type `[Char]'\NULIn the expression: \"wrong type\"\NULIn an equation for `main': main = \"wrong type\"\n"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user