Merge pull request #270 from serras/fix-typed-holes

Fix problems with GHC's Typed Holes
This commit is contained in:
Kazu Yamamoto 2014-06-10 10:20:28 +09:00
commit 595776e2ab
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
@ -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
---------------------------------------------------------------- ----------------------------------------------------------------
---------------------------------------------------------------- ----------------------------------------------------------------

View File

@ -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