Disable fast check when QuasiQuotes is used
This commit is contained in:
parent
4b77af102b
commit
e55e9561b5
3
Debug.hs
3
Debug.hs
@ -25,8 +25,7 @@ debug opt cradle ver fileName = do
|
|||||||
[fast] <- withGHC fileName $ do
|
[fast] <- withGHC fileName $ do
|
||||||
void $ initializeFlagsWithCradle opt cradle gopts True
|
void $ initializeFlagsWithCradle opt cradle gopts True
|
||||||
setTargetFile fileName
|
setTargetFile fileName
|
||||||
slow <- needsTemplateHaskell <$> depanal [] False
|
pure . canCheckFast <$> depanal [] False
|
||||||
return [not slow]
|
|
||||||
return [
|
return [
|
||||||
"GHC version: " ++ ver
|
"GHC version: " ++ ver
|
||||||
, "Current directory: " ++ currentDir
|
, "Current directory: " ++ currentDir
|
||||||
|
11
GHCApi.hs
11
GHCApi.hs
@ -7,6 +7,7 @@ module GHCApi (
|
|||||||
, getDynamicFlags
|
, getDynamicFlags
|
||||||
, setSlowDynFlags
|
, setSlowDynFlags
|
||||||
, checkSlowAndSet
|
, checkSlowAndSet
|
||||||
|
, canCheckFast
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import CabalApi
|
import CabalApi
|
||||||
@ -128,8 +129,8 @@ setSlowDynFlags = (flip setFastOrNot Slow <$> getSessionDynFlags)
|
|||||||
-- So, this is necessary redundancy.
|
-- So, this is necessary redundancy.
|
||||||
checkSlowAndSet :: Ghc ()
|
checkSlowAndSet :: Ghc ()
|
||||||
checkSlowAndSet = do
|
checkSlowAndSet = do
|
||||||
slow <- needsTemplateHaskell <$> depanal [] False
|
fast <- canCheckFast <$> depanal [] False
|
||||||
when slow setSlowDynFlags
|
unless fast setSlowDynFlags
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
@ -150,3 +151,9 @@ setTargetFile file = do
|
|||||||
|
|
||||||
getDynamicFlags :: IO DynFlags
|
getDynamicFlags :: IO DynFlags
|
||||||
getDynamicFlags = runGhc (Just libdir) getSessionDynFlags
|
getDynamicFlags = runGhc (Just libdir) getSessionDynFlags
|
||||||
|
|
||||||
|
canCheckFast :: ModuleGraph -> Bool
|
||||||
|
canCheckFast = not . any (hasTHorQQ . ms_hspp_opts)
|
||||||
|
where
|
||||||
|
hasTHorQQ :: DynFlags -> Bool
|
||||||
|
hasTHorQQ dflags = any (\opt -> xopt opt dflags) [Opt_TemplateHaskell, Opt_QuasiQuotes]
|
||||||
|
Loading…
Reference in New Issue
Block a user