Skip to content

Commit 124691f

Browse files
authored
Cleanup disabled warnings (#4341)
* Cleanup unnecessarily disabled warnings * Fix stack nighly build * stylish
1 parent 147fb4a commit 124691f

File tree

10 files changed

+31
-64
lines changed

10 files changed

+31
-64
lines changed

ghcide/src/Development/IDE/Core/Compile.hs

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ module Development.IDE.Core.Compile
3838
, shareUsages
3939
) where
4040

41-
import Control.Concurrent.Extra
4241
import Control.Concurrent.STM.Stats hiding (orElse)
4342
import Control.DeepSeq (NFData (..), force,
4443
rnf)
@@ -72,8 +71,7 @@ import Data.Tuple.Extra (dupe)
7271
import Debug.Trace
7372
import Development.IDE.Core.FileStore (resetInterfaceStore)
7473
import Development.IDE.Core.Preprocessor
75-
import Development.IDE.Core.ProgressReporting (ProgressReporting (..),
76-
progressReportingOutsideState)
74+
import Development.IDE.Core.ProgressReporting (ProgressReporting (..))
7775
import Development.IDE.Core.RuleTypes
7876
import Development.IDE.Core.Shake
7977
import Development.IDE.Core.Tracing (withTrace)

ghcide/test/data/ignore-fatal/IgnoreFatal.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- "missing signature" is declared a fatal warning in the cabal file,
22
-- but is ignored in this module.
33

4-
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
4+
{-# OPTIONS_GHC -Wno-missing-signatures #-}
55

66
module IgnoreFatal where
77

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Code.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{-# LANGUAGE LambdaCase #-}
22
{-# LANGUAGE OverloadedStrings #-}
33
{-# LANGUAGE ViewPatterns #-}
4-
{-# OPTIONS_GHC -Wwarn -fno-warn-orphans #-}
4+
{-# OPTIONS_GHC -Wwarn #-}
55

66
-- | Expression execution
77
module Ide.Plugin.Eval.Code (Statement, testRanges, resultRange, propSetup, testCheck, asStatements,myExecStmt) where

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs

+13-26
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{-# LANGUAGE OverloadedStrings #-}
66
{-# LANGUAGE RecordWildCards #-}
77
{-# LANGUAGE ViewPatterns #-}
8-
{-# OPTIONS_GHC -fno-warn-type-defaults -Wno-unused-imports #-}
8+
{-# OPTIONS_GHC -Wno-type-defaults #-}
99

1010
{- |
1111
A plugin inspired by the REPLoid feature of <https://github.com/jyp/dante Dante>, <https://www.haskell.org/haddock/doc/html/ch03s08.html#idm140354810775744 Haddock>'s Examples and Properties and <https://hackage.haskell.org/package/doctest Doctest>.
@@ -18,13 +18,12 @@ module Ide.Plugin.Eval.CodeLens (
1818
) where
1919

2020
import Control.Applicative (Alternative ((<|>)))
21-
import Control.Arrow (second, (>>>))
22-
import Control.Exception (bracket_, try)
21+
import Control.Arrow (second)
22+
import Control.Exception (bracket_)
2323
import qualified Control.Exception as E
24-
import Control.Lens (_1, _3, ix, (%~),
25-
(<&>), (^.))
26-
import Control.Monad (guard, join,
27-
void, when)
24+
import Control.Lens (ix, (%~), (^.))
25+
import Control.Monad (guard, void,
26+
when)
2827
import Control.Monad.IO.Class (MonadIO (liftIO))
2928
import Control.Monad.Trans.Except (ExceptT (..),
3029
runExceptT)
@@ -44,25 +43,18 @@ import Data.Typeable (Typeable)
4443
import Development.IDE.Core.Rules (IdeState,
4544
runAction)
4645
import Development.IDE.Core.RuleTypes (LinkableResult (linkableHomeMod),
47-
NeedsCompilation (NeedsCompilation),
4846
TypeCheck (..),
4947
tmrTypechecked)
50-
import Development.IDE.Core.Shake (shakeExtras,
51-
useNoFile_,
52-
useWithStale_,
53-
use_, uses_)
48+
import Development.IDE.Core.Shake (useNoFile_, use_,
49+
uses_)
5450
import Development.IDE.GHC.Compat hiding (typeKind,
5551
unitState)
56-
import Development.IDE.GHC.Compat.Util (GhcException,
57-
OverridingBool (..),
58-
bagToList)
52+
import Development.IDE.GHC.Compat.Util (OverridingBool (..))
5953
import Development.IDE.GHC.Util (evalGhcEnv,
60-
modifyDynFlags,
61-
printOutputable)
54+
modifyDynFlags)
6255
import Development.IDE.Import.DependencyInformation (transitiveDeps,
6356
transitiveModuleDeps)
64-
import Development.IDE.Types.Location (toNormalizedFilePath',
65-
uriToFilePath')
57+
import Development.IDE.Types.Location (toNormalizedFilePath')
6658
import GHC (ClsInst,
6759
ExecOptions (execLineNumber, execSourceFile),
6860
FamInst,
@@ -87,23 +79,19 @@ import Development.IDE.Core.RuleTypes (GetLinkable (GetL
8779
ModSummaryResult (msrModSummary))
8880
import Development.IDE.Core.Shake (VFSModified (VFSUnmodified))
8981
import qualified Development.IDE.GHC.Compat.Core as Compat (InteractiveImport (IIModule))
90-
import qualified Development.IDE.GHC.Compat.Core as SrcLoc (HasSrcSpan (getLoc),
91-
unLoc)
82+
import qualified Development.IDE.GHC.Compat.Core as SrcLoc (unLoc)
9283
import Development.IDE.Types.HscEnvEq (HscEnvEq (hscEnv))
9384
import qualified GHC.LanguageExtensions.Type as LangExt (Extension (..))
9485

95-
import Control.Concurrent.STM.Stats (atomically)
9686
import Development.IDE.Core.FileStore (setSomethingModified)
9787
import Development.IDE.Core.PluginUtils
98-
import Development.IDE.Graph (ShakeOptions (shakeExtra))
9988
import Development.IDE.Types.Shake (toKey)
10089
import GHC.Types.SrcLoc (UnhelpfulSpanReason (UnhelpfulInteractive))
10190
import Ide.Logger (Priority (..),
10291
Recorder,
10392
WithPriority,
10493
logWith)
10594
import Ide.Plugin.Error (PluginError (PluginInternalError),
106-
handleMaybe,
10795
handleMaybeM)
10896
import Ide.Plugin.Eval.Code (Statement,
10997
asStatements,
@@ -117,8 +105,7 @@ import Ide.Plugin.Eval.Config (EvalConfig (..),
117105
import Ide.Plugin.Eval.GHC (addImport,
118106
addPackages,
119107
hasPackage,
120-
setSessionAndInteractiveDynFlags,
121-
showDynFlags)
108+
setSessionAndInteractiveDynFlags)
122109
import Ide.Plugin.Eval.Parse.Comments (commentsToSections)
123110
import Ide.Plugin.Eval.Parse.Option (parseSetFlags)
124111
import Ide.Plugin.Eval.Rules (queueForEvaluation,

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/GHC.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{-# LANGUAGE CPP #-}
22
{-# LANGUAGE LambdaCase #-}
3-
{-# OPTIONS_GHC -fno-warn-unused-imports -Wno-orphans #-}
3+
{-# OPTIONS_GHC -Wno-orphans #-}
44

55
-- |GHC API utilities
66
module Ide.Plugin.Eval.GHC (

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs

+13-22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
{-# LANGUAGE CPP #-}
2-
{-# LANGUAGE NoMonomorphismRestriction #-}
3-
{-# OPTIONS_GHC -Wno-orphans -Wno-unused-imports #-}
4-
{-# LANGUAGE RecordWildCards #-}
1+
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE RecordWildCards #-}
3+
{-# OPTIONS_GHC -Wno-orphans #-}
54

6-
-- |Debug utilities
5+
-- | Debug utilities
76
module Ide.Plugin.Eval.Util (
87
timed,
98
isLiterate,
@@ -15,39 +14,31 @@ module Ide.Plugin.Eval.Util (
1514

1615
import Control.Exception (SomeException, evaluate,
1716
fromException)
18-
import Control.Monad.Error.Class (MonadError (throwError))
1917
import Control.Monad.IO.Class (MonadIO (liftIO))
2018
import Control.Monad.Trans.Class (MonadTrans (lift))
2119
import Control.Monad.Trans.Except (ExceptT (..),
2220
runExceptT)
2321
import Data.Aeson (Value)
24-
import Data.Bifunctor (second)
2522
import Data.String (IsString (fromString))
26-
import qualified Data.Text as T
27-
import Development.IDE (IdeState,
28-
printOutputable)
29-
import qualified Development.IDE.Core.PluginUtils as PluginUtils
30-
import qualified Development.IDE.GHC.Compat.Core as Core
31-
import qualified Development.IDE.GHC.Compat.Core as SrcLoc
3223
import Development.IDE.GHC.Compat.Outputable
3324
import Development.IDE.GHC.Compat.Util (MonadCatch, bagToList,
3425
catch)
35-
import GHC.Exts (toList)
36-
import GHC.Stack (HasCallStack, callStack,
37-
srcLocFile,
38-
srcLocStartCol,
39-
srcLocStartLine)
4026
import Ide.Plugin.Error
4127
import Ide.Types (HandlerM,
4228
pluginSendRequest)
4329
import Language.LSP.Protocol.Message
4430
import Language.LSP.Protocol.Types
45-
import Language.LSP.Server
4631
import System.FilePath (takeExtension)
4732
import qualified System.Time.Extra as Extra
48-
import System.Time.Extra (duration, showDuration)
33+
import System.Time.Extra (duration)
4934
import UnliftIO.Exception (catchAny)
5035

36+
#if !MIN_VERSION_ghc(9,8,0)
37+
import qualified Data.Text as T
38+
import Development.IDE (printOutputable)
39+
import qualified Development.IDE.GHC.Compat.Core as Core
40+
#endif
41+
5142
timed :: MonadIO m => (t -> Extra.Seconds -> m a) -> t -> m b -> m b
5243
timed out name op = do
5344
(secs, r) <- duration op
@@ -107,6 +98,6 @@ prettyWarnings = unlines . map prettyWarn
10798

10899
prettyWarn :: Core.Warn -> String
109100
prettyWarn Core.Warn{..} =
110-
T.unpack (printOutputable $ SrcLoc.getLoc warnMsg) <> ": warning:\n"
111-
<> " " <> SrcLoc.unLoc warnMsg
101+
T.unpack (printOutputable $ Core.getLoc warnMsg) <> ": warning:\n"
102+
<> " " <> Core.unLoc warnMsg
112103
#endif

plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs

-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
{-# LANGUAGE ViewPatterns #-}
1414
{-# OPTIONS_GHC -Wno-orphans #-}
1515

16-
-- On 9.4 we get a new redundant constraint warning, but deleting the
17-
-- constraint breaks the build on earlier versions. Rather than apply
18-
-- lots of CPP, we just disable the warning until later.
19-
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
20-
2116
#ifdef GHC_LIB
2217
#define MIN_GHC_API_VERSION(x,y,z) MIN_VERSION_ghc_lib_parser(x,y,z)
2318
#else

plugins/hls-module-name-plugin/src/Ide/Plugin/ModuleName.hs

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
{-# LANGUAGE RecordWildCards #-}
55
{-# LANGUAGE ViewPatterns #-}
66

7-
{-# OPTIONS_GHC -Wwarn -fno-warn-type-defaults #-}
8-
97
{- | Keep the module name in sync with its file path.
108
119
Provide CodeLenses to:

src/Ide/Arguments.hs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
{-# LANGUAGE CPP #-}
44
{-# LANGUAGE RecordWildCards #-}
55
{-# LANGUAGE TemplateHaskell #-}
6-
{-# OPTIONS_GHC -Wno-dodgy-imports #-} -- GHC no longer exports def in GHC 8.6 and above
76

87
module Ide.Arguments
98
( Arguments(..)

src/Ide/Main.hs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
-- Copyright (c) 2019 The DAML Authors. All rights reserved.
22
-- SPDX-License-Identifier: Apache-2.0
33
{-# LANGUAGE CPP #-}
4-
{-# OPTIONS_GHC -Wno-dodgy-imports #-} -- GHC no longer exports def in GHC 8.6 and above
54
{-# LANGUAGE OverloadedStrings #-}
65
{-# LANGUAGE RecordWildCards #-}
76
{-# LANGUAGE TypeFamilies #-}
@@ -18,7 +17,7 @@ import Data.Text (Text)
1817
import qualified Data.Text as T
1918
import Data.Text.Lazy.Encoding (decodeUtf8)
2019
import qualified Data.Text.Lazy.IO as LT
21-
import Development.IDE.Core.Rules hiding (Log, logToPriority)
20+
import Development.IDE.Core.Rules hiding (Log)
2221
import Development.IDE.Core.Tracing (withTelemetryRecorder)
2322
import Development.IDE.Main (isLSP)
2423
import qualified Development.IDE.Main as IDEMain

0 commit comments

Comments
 (0)