Skip to content
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

Promote more warnings to errors in ghcide #4054

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions ghcide/ghcide.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -216,12 +219,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:
Expand All @@ -238,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

Expand All @@ -253,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
Expand Down Expand Up @@ -352,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:
Expand Down
2 changes: 1 addition & 1 deletion ghcide/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@
{ source_version = ver
, old_value = m_old
, get_file_version = use GetModificationTime_{missingFileDiagnostics = False}
, get_linkable_hashes = \fs -> map (snd . fromJust . hirCoreFp) <$> uses_ GetModIface fs

Check warning on line 858 in ghcide/src/Development/IDE/Core/Rules.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Suggestion in getModIfaceFromDiskRule in module Development.IDE.Core.Rules: Use fmap ▫︎ Found: "\\ fs -> map (snd . fromJust . hirCoreFp) <$> uses_ GetModIface fs" ▫︎ Perhaps: "fmap (map (snd . fromJust . hirCoreFp)) . uses_ GetModIface"
, regenerate = regenerateHiFile session f ms
}
r <- loadInterface (hscEnv session) ms linkableType recompInfo
Expand Down Expand Up @@ -1136,7 +1136,7 @@
-- thus bump its modification time, forcing this rule to be rerun every time.
exists <- liftIO $ doesFileExist obj_file
mobj_time <- liftIO $
if exists

Check warning on line 1139 in ghcide/src/Development/IDE/Core/Rules.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Warning in getLinkableRule in module Development.IDE.Core.Rules: Use whenMaybe ▫︎ Found: "if exists then Just <$> getModTime obj_file else pure Nothing" ▫︎ Perhaps: "whenMaybe exists (getModTime obj_file)"
then Just <$> getModTime obj_file
else pure Nothing
case mobj_time of
Expand Down Expand Up @@ -1270,7 +1270,7 @@
reportImportCyclesRule recorder
typeCheckRule recorder
getDocMapRule recorder
loadGhcSession recorder def{fullModuleGraph}
loadGhcSession recorder GhcSessionDepsConfig{fullModuleGraph}
getModIfaceFromDiskRule recorder
getModIfaceFromDiskAndIndexRule recorder
getModIfaceRule recorder
Expand Down
1 change: 0 additions & 1 deletion ghcide/src/Development/IDE/GHC/Compat/Parser.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE PatternSynonyms #-}
{-# HLINT ignore "Unused LANGUAGE pragma" #-}

-- | Parser compatibility module.
module Development.IDE.GHC.Compat.Parser (
Expand Down
2 changes: 0 additions & 2 deletions ghcide/src/Development/IDE/LSP/Outline.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of those "trees that grow" constructors that apparently can't happen in parsed AST, so is marked as redundant pattern match.

}
where name = printOutputable $ unLoc $ fd_name x

Expand Down
4 changes: 2 additions & 2 deletions ghcide/src/Development/IDE/Spans/AtPoint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading