Fix problems with GHC's Typed Holes
This commit is contained in:
parent
1e70c32b39
commit
c9b901f4f9
@ -15,6 +15,7 @@ module Language.Haskell.GhcMod.Gap (
|
|||||||
, setHideAllPackages
|
, setHideAllPackages
|
||||||
, addPackageFlags
|
, addPackageFlags
|
||||||
, setDeferTypeErrors
|
, setDeferTypeErrors
|
||||||
|
, setWarnTypedHoles
|
||||||
, setDumpSplices
|
, setDumpSplices
|
||||||
, isDumpSplices
|
, isDumpSplices
|
||||||
, filterOutChildren
|
, filterOutChildren
|
||||||
@ -259,6 +260,13 @@ setDeferTypeErrors dflag = dopt_set dflag Opt_DeferTypeErrors
|
|||||||
setDeferTypeErrors = id
|
setDeferTypeErrors = id
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
setWarnTypedHoles :: DynFlags -> DynFlags
|
||||||
|
#if __GLASGOW_HASKELL__ >= 708
|
||||||
|
setWarnTypedHoles dflag = wopt_set dflag Opt_WarnTypedHoles
|
||||||
|
#else
|
||||||
|
setWarnTypedHoles = id
|
||||||
|
#endif
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import qualified GHC as G
|
|||||||
import GHC.SYB.Utils (Stage(TypeChecker), everythingStaged)
|
import GHC.SYB.Utils (Stage(TypeChecker), everythingStaged)
|
||||||
import Language.Haskell.GhcMod.Doc (showPage, showOneLine, getStyle)
|
import Language.Haskell.GhcMod.Doc (showPage, showOneLine, getStyle)
|
||||||
import Language.Haskell.GhcMod.GHCApi
|
import Language.Haskell.GhcMod.GHCApi
|
||||||
import Language.Haskell.GhcMod.Gap (HasType(..), setDeferTypeErrors)
|
import Language.Haskell.GhcMod.Gap (HasType(..), setWarnTypedHoles, setDeferTypeErrors)
|
||||||
import qualified Language.Haskell.GhcMod.Gap as Gap
|
import qualified Language.Haskell.GhcMod.Gap as Gap
|
||||||
import Language.Haskell.GhcMod.Types
|
import Language.Haskell.GhcMod.Types
|
||||||
import Language.Haskell.GhcMod.Convert
|
import Language.Haskell.GhcMod.Convert
|
||||||
@ -130,7 +130,7 @@ pretty dflag style = showOneLine dflag style . Gap.typeForUser
|
|||||||
|
|
||||||
inModuleContext :: FilePath -> (DynFlags -> PprStyle -> Ghc a) -> Ghc a
|
inModuleContext :: FilePath -> (DynFlags -> PprStyle -> Ghc a) -> Ghc a
|
||||||
inModuleContext file action =
|
inModuleContext file action =
|
||||||
withDynFlags (setDeferTypeErrors . setNoWaringFlags) $ do
|
withDynFlags (setWarnTypedHoles . setDeferTypeErrors . setNoWaringFlags) $ do
|
||||||
setTargetFiles [file]
|
setTargetFiles [file]
|
||||||
Gap.withContext $ do
|
Gap.withContext $ do
|
||||||
dflag <- G.getSessionDynFlags
|
dflag <- G.getSessionDynFlags
|
||||||
|
Loading…
Reference in New Issue
Block a user