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
|
||||
void $ initializeFlagsWithCradle opt cradle gopts True
|
||||
setTargetFile fileName
|
||||
slow <- needsTemplateHaskell <$> depanal [] False
|
||||
return [not slow]
|
||||
pure . canCheckFast <$> depanal [] False
|
||||
return [
|
||||
"GHC version: " ++ ver
|
||||
, "Current directory: " ++ currentDir
|
||||
|
11
GHCApi.hs
11
GHCApi.hs
@ -7,6 +7,7 @@ module GHCApi (
|
||||
, getDynamicFlags
|
||||
, setSlowDynFlags
|
||||
, checkSlowAndSet
|
||||
, canCheckFast
|
||||
) where
|
||||
|
||||
import CabalApi
|
||||
@ -128,8 +129,8 @@ setSlowDynFlags = (flip setFastOrNot Slow <$> getSessionDynFlags)
|
||||
-- So, this is necessary redundancy.
|
||||
checkSlowAndSet :: Ghc ()
|
||||
checkSlowAndSet = do
|
||||
slow <- needsTemplateHaskell <$> depanal [] False
|
||||
when slow setSlowDynFlags
|
||||
fast <- canCheckFast <$> depanal [] False
|
||||
unless fast setSlowDynFlags
|
||||
|
||||
----------------------------------------------------------------
|
||||
|
||||
@ -150,3 +151,9 @@ setTargetFile file = do
|
||||
|
||||
getDynamicFlags :: IO DynFlags
|
||||
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