Merge branch 'fix-typed-holes'

This commit is contained in:
Alejandro Serrano 2014-06-10 17:09:46 +02:00
commit cedf59ace7
2 changed files with 10 additions and 2 deletions

View File

@ -15,6 +15,7 @@ module Language.Haskell.GhcMod.Gap (
, setHideAllPackages , setHideAllPackages
, addPackageFlags , addPackageFlags
, setDeferTypeErrors , setDeferTypeErrors
, setWarnTypedHoles
, setDumpSplices , setDumpSplices
, isDumpSplices , isDumpSplices
, filterOutChildren , filterOutChildren
@ -261,6 +262,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
---------------------------------------------------------------- ----------------------------------------------------------------
---------------------------------------------------------------- ----------------------------------------------------------------

View File

@ -24,7 +24,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
@ -135,7 +135,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