-
-
Notifications
You must be signed in to change notification settings - Fork 399
Cleanup cabal files, ghc compat code, fix ghc warnings #4222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
347cc70
ef218be
5548caf
6287e23
1c1d508
2315402
30e57ac
c018b7e
93734ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,6 @@ module Development.IDE.Core.Rules( | |
getHieAstsRule, | ||
getBindingsRule, | ||
needsCompilationRule, | ||
computeLinkableTypeForDynFlags, | ||
generateCoreRule, | ||
getImportMapRule, | ||
regenerateHiFile, | ||
|
@@ -58,7 +57,6 @@ module Development.IDE.Core.Rules( | |
) where | ||
|
||
import Control.Applicative | ||
import Control.Concurrent.Async (concurrently) | ||
import Control.Concurrent.STM.Stats (atomically) | ||
import Control.Concurrent.STM.TVar | ||
import Control.Concurrent.Strict | ||
|
@@ -90,10 +88,8 @@ import Data.List.Extra (nubOrdOn) | |
import qualified Data.Map as M | ||
import Data.Maybe | ||
import Data.Proxy | ||
import qualified Data.Set as Set | ||
import qualified Data.Text as T | ||
import qualified Data.Text.Encoding as T | ||
import qualified Data.Text.Utf16.Rope as Rope | ||
import Data.Time (UTCTime (..)) | ||
import Data.Time.Clock.POSIX (posixSecondsToUTCTime) | ||
import Data.Tuple.Extra | ||
|
@@ -123,7 +119,6 @@ import Development.IDE.GHC.Compat hiding | |
import qualified Development.IDE.GHC.Compat as Compat hiding | ||
(nest, | ||
vcat) | ||
import Development.IDE.GHC.Compat.Env | ||
import qualified Development.IDE.GHC.Compat.Util as Util | ||
import Development.IDE.GHC.Error | ||
import Development.IDE.GHC.Util hiding | ||
|
@@ -1148,36 +1143,23 @@ needsCompilationRule file = do | |
-- that we just threw away, and thus have to recompile all dependencies once | ||
-- again, this time keeping the object code. | ||
-- A file needs to be compiled if any file that depends on it uses TemplateHaskell or needs to be compiled | ||
ms <- msrModSummary . fst <$> useWithStale_ GetModSummaryWithoutTimestamps file | ||
(modsums,needsComps) <- liftA2 | ||
(,) (map (fmap (msrModSummary . fst)) <$> usesWithStale GetModSummaryWithoutTimestamps revdeps) | ||
(uses NeedsCompilation revdeps) | ||
pure $ computeLinkableType ms modsums (map join needsComps) | ||
pure $ computeLinkableType modsums (map join needsComps) | ||
pure (Just $ encodeLinkableType res, Just res) | ||
where | ||
computeLinkableType :: ModSummary -> [Maybe ModSummary] -> [Maybe LinkableType] -> Maybe LinkableType | ||
computeLinkableType this deps xs | ||
computeLinkableType :: [Maybe ModSummary] -> [Maybe LinkableType] -> Maybe LinkableType | ||
computeLinkableType deps xs | ||
| Just ObjectLinkable `elem` xs = Just ObjectLinkable -- If any dependent needs object code, so do we | ||
| Just BCOLinkable `elem` xs = Just this_type -- If any dependent needs bytecode, then we need to be compiled | ||
| any (maybe False uses_th_qq) deps = Just this_type -- If any dependent needs TH, then we need to be compiled | ||
| Just BCOLinkable `elem` xs = Just BCOLinkable -- If any dependent needs bytecode, then we need to be compiled | ||
| any (maybe False uses_th_qq) deps = Just BCOLinkable -- If any dependent needs TH, then we need to be compiled | ||
| otherwise = Nothing -- If none of these conditions are satisfied, we don't need to compile | ||
where | ||
this_type = computeLinkableTypeForDynFlags (ms_hspp_opts this) | ||
|
||
uses_th_qq :: ModSummary -> Bool | ||
uses_th_qq (ms_hspp_opts -> dflags) = | ||
xopt LangExt.TemplateHaskell dflags || xopt LangExt.QuasiQuotes dflags | ||
|
||
-- | How should we compile this module? | ||
-- (assuming we do in fact need to compile it). | ||
-- Depends on whether it uses unboxed tuples or sums | ||
computeLinkableTypeForDynFlags :: DynFlags -> LinkableType | ||
computeLinkableTypeForDynFlags d | ||
= BCOLinkable | ||
where -- unboxed_tuples_or_sums is only used in GHC < 9.2 | ||
_unboxed_tuples_or_sums = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting simplification #1: this is unused on GHCs we support, which means this function doesn't depend on DynFlags and we can just hardcode BCOLinkable in bunch of places leading to bunch of simplifications in this and other modules. Please search for 3 new hardcoded There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems plausible! |
||
xopt LangExt.UnboxedTuples d || xopt LangExt.UnboxedSums d | ||
|
||
-- | Tracks which linkables are current, so we don't need to unload them | ||
newtype CompiledLinkables = CompiledLinkables { getCompiledLinkables :: Var (ModuleEnv UTCTime) } | ||
instance IsIdeGlobal CompiledLinkables | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,18 +58,17 @@ import qualified GHC.Parser.Lexer as Lexer | |
type PsMessages = (Bag WarnMsg, Bag ErrMsg) | ||
#endif | ||
|
||
getPsMessages :: PState -> DynFlags -> PsMessages | ||
getPsMessages pst _dflags = --dfags is only used if GHC < 9.2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting simplification #2: few more unused DynFlags arguments removed because supported GHCs don't need them anymore. |
||
getPsMessages :: PState -> PsMessages | ||
getPsMessages pst = | ||
#if MIN_VERSION_ghc(9,3,0) | ||
uncurry PsMessages $ Lexer.getPsMessages pst | ||
#else | ||
bimap (fmap pprWarning) (fmap pprError) $ | ||
getMessages pst | ||
#endif | ||
|
||
applyPluginsParsedResultAction :: HscEnv -> DynFlags -> ModSummary -> Parser.ApiAnns -> ParsedSource -> PsMessages -> IO (ParsedSource, PsMessages) | ||
applyPluginsParsedResultAction env _dflags ms hpm_annotations parsed msgs = do | ||
-- dflags is only used in GHC < 9.2 | ||
applyPluginsParsedResultAction :: HscEnv -> ModSummary -> Parser.ApiAnns -> ParsedSource -> PsMessages -> IO (ParsedSource, PsMessages) | ||
applyPluginsParsedResultAction env ms hpm_annotations parsed msgs = do | ||
-- Apply parsedResultAction of plugins | ||
let applyPluginAction p opts = parsedResultAction p opts ms | ||
#if MIN_VERSION_ghc(9,3,0) | ||
|
Uh oh!
There was an error while loading. Please reload this page.