Skip to content

Commit

Permalink
Use object code for Template Haskell, emit desugarer warnings (haskel…
Browse files Browse the repository at this point in the history
…l/ghcide#836)

* Use object code for TH

* Set target location for TargetFiles

* Fix tests

* hlint

* fix build on 8.10

* fix ghc-lib

* address review comments

* hlint

* better error handling if module headers don't parse

* Always desugar, don't call interactive API functions

* deprioritize desugar when not TH, fix iface handling

* write hie file on save

* more tweaks

* fix tests

* disable desugarer warnings

* use ModGuts for exports map

* don't desugar

* use bytecode

* make HiFileStable early-cutoff

* restore object code

* re-enable desugar

* review comments

* Don't use ModIface for DocMap

* fix docs for the current module

* mark test as broken on windows
  • Loading branch information
wz1000 committed Oct 4, 2020
1 parent c82f253 commit 5676fcc
Show file tree
Hide file tree
Showing 17 changed files with 468 additions and 422 deletions.
17 changes: 13 additions & 4 deletions ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ loadSession dir = do
-- files in the project so that `knownFiles` can learn about them and
-- we can generate a complete module graph
let extendKnownTargets newTargets = do
knownTargets <- forM newTargets $ \TargetDetails{..} -> do
found <- filterM (IO.doesFileExist . fromNormalizedFilePath) targetLocations
return (targetTarget, found)
knownTargets <- forM newTargets $ \TargetDetails{..} ->
case targetTarget of
TargetFile f -> pure (targetTarget, [f])
TargetModule _ -> do
found <- filterM (IO.doesFileExist . fromNormalizedFilePath) targetLocations
return (targetTarget, found)
modifyVar_ knownTargetsVar $ traverseHashed $ \known -> do
let known' = HM.unionWith (<>) known $ HM.fromList knownTargets
when (known /= known') $
Expand Down Expand Up @@ -501,6 +504,7 @@ setCacheDir logger prefix hscComponents comps dflags = do
pure $ dflags
& setHiDir cacheDir
& setHieDir cacheDir
& setODir cacheDir


renderCradleError :: NormalizedFilePath -> CradleError -> FileDiagnostic
Expand Down Expand Up @@ -641,7 +645,7 @@ setOptions (ComponentOptions theOpts compRoot _) dflags = do
setLinkerOptions :: DynFlags -> DynFlags
setLinkerOptions df = df {
ghcLink = LinkInMemory
, hscTarget = HscNothing
, hscTarget = HscAsm
, ghcMode = CompManager
}

Expand All @@ -657,6 +661,11 @@ setHiDir f d =
-- override user settings to avoid conflicts leading to recompilation
d { hiDir = Just f}

setODir :: FilePath -> DynFlags -> DynFlags
setODir f d =
-- override user settings to avoid conflicts leading to recompilation
d { objectDir = Just f}

getCacheDir :: String -> [String] -> IO FilePath
getCacheDir prefix opts = getXdgDirectory XdgCache (cacheDir </> prefix ++ "-" ++ opts_hash)
where
Expand Down

0 comments on commit 5676fcc

Please sign in to comment.