From ac643887c50ff1529b274715acaaa9f3a6e14a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Tue, 6 Feb 2024 20:12:20 +0100 Subject: [PATCH 1/2] Promote more warnings to errors in ghcide --- ghcide/ghcide.cabal | 7 +------ ghcide/src/Development/IDE/Core/Rules.hs | 2 +- ghcide/src/Development/IDE/GHC/Compat/Parser.hs | 1 - ghcide/src/Development/IDE/LSP/Outline.hs | 2 -- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/ghcide/ghcide.cabal b/ghcide/ghcide.cabal index 4fb975e96f..15a4ab340f 100644 --- a/ghcide/ghcide.cabal +++ b/ghcide/ghcide.cabal @@ -216,12 +216,7 @@ library -- finished purging the warnings, so some are set to not be errors -- for now ghc-options: - -Werror -Wwarn=unused-packages -Wwarn=unrecognised-pragmas - -Wwarn=dodgy-imports -Wwarn=missing-signatures - -Wwarn=duplicate-exports -Wwarn=dodgy-exports - -Wwarn=incomplete-patterns -Wwarn=overlapping-patterns - -Wwarn=incomplete-record-updates - -Wwarn=ambiguous-fields + -Werror -Wwarn=unused-packages if flag(ekg) build-depends: diff --git a/ghcide/src/Development/IDE/Core/Rules.hs b/ghcide/src/Development/IDE/Core/Rules.hs index 3054a2b974..4f1c703760 100644 --- a/ghcide/src/Development/IDE/Core/Rules.hs +++ b/ghcide/src/Development/IDE/Core/Rules.hs @@ -1270,7 +1270,7 @@ mainRule recorder RulesConfig{..} = do reportImportCyclesRule recorder typeCheckRule recorder getDocMapRule recorder - loadGhcSession recorder def{fullModuleGraph} + loadGhcSession recorder GhcSessionDepsConfig{fullModuleGraph} getModIfaceFromDiskRule recorder getModIfaceFromDiskAndIndexRule recorder getModIfaceRule recorder diff --git a/ghcide/src/Development/IDE/GHC/Compat/Parser.hs b/ghcide/src/Development/IDE/GHC/Compat/Parser.hs index 3d87cc3a91..2b92076532 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Parser.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Parser.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE PatternSynonyms #-} -{-# HLINT ignore "Unused LANGUAGE pragma" #-} -- | Parser compatibility module. module Development.IDE.GHC.Compat.Parser ( diff --git a/ghcide/src/Development/IDE/LSP/Outline.hs b/ghcide/src/Development/IDE/LSP/Outline.hs index 09b515b15d..4f350b52d0 100644 --- a/ghcide/src/Development/IDE/LSP/Outline.hs +++ b/ghcide/src/Development/IDE/LSP/Outline.hs @@ -190,12 +190,10 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (ForD _ x)) = Just { _name = case x of ForeignImport{} -> name ForeignExport{} -> name - XForeignDecl{} -> "?" , _kind = SymbolKind_Object , _detail = case x of ForeignImport{} -> Just "import" ForeignExport{} -> Just "export" - XForeignDecl{} -> Nothing } where name = printOutputable $ unLoc $ fd_name x From 91b7227417ca4844c34efdf7b72c82fbf653a91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Hr=C4=8Dek?= Date: Tue, 6 Feb 2024 20:30:02 +0100 Subject: [PATCH 2/2] Small simplifications --- ghcide/ghcide.cabal | 10 ++++++---- ghcide/src/Development/IDE/Spans/AtPoint.hs | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ghcide/ghcide.cabal b/ghcide/ghcide.cabal index 15a4ab340f..5b4c84da5e 100644 --- a/ghcide/ghcide.cabal +++ b/ghcide/ghcide.cabal @@ -42,7 +42,10 @@ flag pedantic common warnings ghc-options: - -Wall -Wincomplete-uni-patterns -Wunused-packages + -Wall + -Wincomplete-uni-patterns + -Wunused-packages + -Wno-name-shadowing -Wno-unticked-promoted-constructors -fno-ignore-asserts @@ -233,7 +236,6 @@ executable ghcide-test-preprocessor import: warnings default-language: GHC2021 hs-source-dirs: test/preprocessor - ghc-options: -Wno-name-shadowing main-is: Main.hs build-depends: base >=4 && <5 @@ -248,7 +250,7 @@ executable ghcide import: warnings default-language: GHC2021 hs-source-dirs: exe - ghc-options: -threaded -rtsopts "-with-rtsopts=-I0 -A128M -T" -Wno-name-shadowing + ghc-options: -threaded -rtsopts "-with-rtsopts=-I0 -A128M -T" -- allow user RTS overrides @@ -347,7 +349,7 @@ test-suite ghcide-tests build-depends: ghc-typelits-knownnat hs-source-dirs: test/cabal test/exe test/src - ghc-options: -threaded -O0 -Wno-name-shadowing + ghc-options: -threaded -O0 main-is: Main.hs other-modules: diff --git a/ghcide/src/Development/IDE/Spans/AtPoint.hs b/ghcide/src/Development/IDE/Spans/AtPoint.hs index ba07e620ba..0c4d575883 100644 --- a/ghcide/src/Development/IDE/Spans/AtPoint.hs +++ b/ghcide/src/Development/IDE/Spans/AtPoint.hs @@ -439,10 +439,10 @@ defRowToSymbolInfo _ = Nothing pointCommand :: HieASTs t -> Position -> (HieAST t -> a) -> [a] pointCommand hf pos k = - catMaybes $ M.elems $ flip M.mapWithKey (getAsts hf) $ \fs ast -> + M.elems $ flip M.mapMaybeWithKey (getAsts hf) $ \fs ast -> -- Since GHC 9.2: -- getAsts :: Map HiePath (HieAst a) - -- type HiePath = LexialFastString + -- type HiePath = LexicalFastString -- -- but before: -- getAsts :: Map HiePath (HieAst a)