Skip to content

Make work stack-9.2.1.yaml and enable pedantic (-WError) for cabal #2606

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

Merged
merged 54 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
30994b8
Enable brittany for ghc-9.0.2
jneira Jan 17, 2022
442446d
Make works using cabal freeze
jneira Jan 16, 2022
87dd04d
Add stack 9.2.1 to ci
jneira Jan 17, 2022
0aafc17
Use new *molu versions
jneira Jan 17, 2022
5585cae
Enable rename for stack 9.2.1
jneira Jan 17, 2022
54329f8
Use last ghc-lib
jneira Jan 17, 2022
9294146
Use correct boot pkgs
jneira Jan 17, 2022
7899e43
Use last ghc-exactprint
jneira Jan 17, 2022
eb52367
Reorganize and use lens-5.1
jneira Jan 17, 2022
49ce94a
update retrie
jneira Jan 17, 2022
c116360
Comment class plugin package
jneira Jan 17, 2022
7b7f9fc
Handle Nothing case
jneira Jan 18, 2022
caa33d0
Restore ghc-typelits deps
jneira Jan 18, 2022
9af8ae8
More non-exhaustive patterns
jneira Jan 18, 2022
0ceaf64
More non-exhaustive patterns
jneira Jan 18, 2022
d96e514
Set pedantic (-WError) true for cabal
jneira Jan 18, 2022
7b43c62
Remove pedantic as we set it out in cabal.project
jneira Jan 18, 2022
0b4c99c
Not set pedantic for ghc-9.2.1
jneira Jan 18, 2022
e873ba4
Set pedantic in cabal.project's
jneira Jan 18, 2022
d38892c
More non-exhaustive patterns
jneira Jan 18, 2022
fa72a58
Not set pedantic for ghc-9.0.1
jneira Jan 18, 2022
a52b550
More incomplete patterns
jneira Jan 18, 2022
7e9c938
Fix WErrors
jneira Jan 18, 2022
02c09bb
Dodgy import
jneira Jan 18, 2022
2668760
Correct CPP conditions
jneira Jan 18, 2022
0eaf0d4
Not MonadFail in Prelude
jneira Jan 18, 2022
f5c5acd
Fix more warnings
jneira Jan 19, 2022
a75dae7
Restore missing fun
jneira Jan 19, 2022
6061889
unused imports
jneira Jan 19, 2022
67ef152
Enable refine imports
jneira Jan 19, 2022
464437c
more fixes
jneira Jan 19, 2022
6b09e62
Enable brittany in nix for 9.0.1
jneira Jan 19, 2022
6f654ab
Use newer prettyprinter
jneira Jan 19, 2022
497ee13
Return to master
jneira Jan 19, 2022
3038c6f
Enable tactics in stack-9.2.1.yaml
jneira Jan 19, 2022
97c710e
Enable pedantic in ci
jneira Jan 19, 2022
d7bbbd8
Avoid deprecation warning with CPP �
jneira Jan 19, 2022
a9cb9ed
Use default prettyprinter
jneira Jan 19, 2022
b050d8b
Update refinery for ghc-9.2.1
jneira Jan 19, 2022
87b8408
Ignore deprecations
jneira Jan 19, 2022
cdcea06
Use dev version of ghc-source-gen
jneira Jan 19, 2022
4a47b68
disable wingman for 9.2.1
jneira Jan 20, 2022
867175f
Enable wingman for 9.0.2
jneira Jan 20, 2022
dc6f67b
disable tactic with flag
jneira Jan 20, 2022
064c696
yaml grammar
jneira Jan 20, 2022
cc862ff
Merge branch 'master' into stack-ghc-9.2.1
jneira Jan 20, 2022
0818b87
Use setup-build action
jneira Jan 20, 2022
616f913
Correct workflow
jneira Jan 20, 2022
ab6bbcf
Build flags for al major os's
jneira Jan 20, 2022
bee6145
The integer twaek is needed for the solver
jneira Jan 20, 2022
efa8153
Disable tests beforehand
jneira Jan 20, 2022
aabb123
flags only affect local packages
jneira Jan 20, 2022
9d44a40
Exclude 8.6.5
jneira Jan 20, 2022
20f1fbb
Exclude 8.8.4
jneira Jan 20, 2022
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
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ jobs:
- STACK_FILE: "stack-9.0.2.yaml"
<<: *defaults

ghc-9.2.1:
environment:
- STACK_FILE: "stack-9.2.1.yaml"
<<: *defaults

ghc-default:
environment:
- STACK_FILE: "stack.yaml"
Expand All @@ -121,4 +126,5 @@ workflows:
- ghc-8.10.7
- ghc-9.0.1
- ghc-9.0.2
- ghc-9.2.1
- ghc-default
8 changes: 1 addition & 7 deletions .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,11 @@ jobs:
os: ${{ runner.os }}

- name: Build `hls-graph` with flags
run: cabal v2-build hls-graph --flags="pedantic embed-files stm-stats"
run: cabal v2-build hls-graph --flags="embed-files stm-stats"

- name: Build `hie-compat` with flags
run: cabal v2-build hie-compat --flags="ghc-lib"

- name: Build `hls-plugin-api` with flags
run: cabal v2-build hls-plugin-api --flags="pedantic"

- name: Build `hls-test-utils` with flags
run: cabal v2-build hls-test-utils --flags="pedantic"

- name: Build
run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe"

Expand Down
19 changes: 0 additions & 19 deletions cabal-ghc921.project
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ packages:
./plugins/hls-call-hierarchy-plugin
./plugins/hls-alternate-number-format-plugin

repository head.hackage.ghc.haskell.org
Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, i also tried to remove head.hackage to see we can take ride of

url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
key-threshold: 3
root-keys:
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d


with-compiler: ghc-9.2.1

tests: true
Expand All @@ -63,17 +53,8 @@ constraints:
-splice
-stylishhaskell
-tactic,
ghc-lib-parser ^>= 9.2,
attoparsec ^>= 0.14.3,
ghc-exactprint >= 1.3,
retrie >= 1.2,
direct-sqlite == 2.3.26,
lens >= 5.0.1,
primitive-unlifted ==0.1.3.1

allow-newer:
-- base,

-- for shake-bench
Chart:lens,
Chart-diagrams:lens,
Expand Down
2 changes: 2 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ optional-packages: vendored/*/*.cabal

tests: true

flags: +pedantic
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure we should do this here, rather only do it in CI. It's really annoying to develop with -Werror on!

Copy link
Member Author

Choose a reason for hiding this comment

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

hmm i prefer doing it right step by step instead a final cleaning out, but fair enough

Copy link
Collaborator

Choose a reason for hiding this comment

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

Running with -Werror means that if you have a binding that's temporarily unused then it's an error and nothing else will compile. It's really pretty bad IMO.


package *
ghc-options: -haddock
test-show-details: direct
Expand Down
2 changes: 0 additions & 2 deletions configuration-ghc-901.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

let
disabledPlugins = [
"hls-brittany-plugin"
"hls-stylish-haskell-plugin"
];

Expand All @@ -17,7 +16,6 @@ let
haskell-language-server =
hself.callCabal2nixWithOptions "haskell-language-server" ./.
(pkgs.lib.concatStringsSep " " [
"-f-brittany"
"-f-stylishhaskell"
]) { };

Expand Down
7 changes: 2 additions & 5 deletions hls-graph/src/Development/IDE/Graph/Internal/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ module Development.IDE.Graph.Internal.Types where

import Control.Applicative
import Control.Monad.Catch
#if __GLASGOW_HASKELL__ < 870
#if __GLASGOW_HASKELL__ < 808
-- Needed in GHC 8.6.5
import Control.Concurrent.STM.Stats (TVar, atomically)
import Control.Monad.Fail
#else
import GHC.Conc (TVar, atomically)
#endif
#if __GLASGOW_HASKELL__ < 880
import Control.Monad.Fail
import Prelude hiding (MonadFail)
#endif
import Control.Monad.IO.Class
import Control.Monad.Trans.Reader
import Data.Aeson (FromJSON, ToJSON)
Expand Down
21 changes: 12 additions & 9 deletions plugins/default/src/Ide/Plugin/Example.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,18 @@ mkDiag file diagSource sev loc msg = (file, D.ShowDiag,)
-- | Generate code actions.
codeAction :: PluginMethodHandler IdeState TextDocumentCodeAction
codeAction state _pid (CodeActionParams _ _ (TextDocumentIdentifier uri) _range CodeActionContext{_diagnostics=List _xs}) = liftIO $ do
let Just nfp = uriToNormalizedFilePath $ toNormalizedUri uri
Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp
let
title = "Add TODO Item 1"
tedit = [TextEdit (Range (Position 2 0) (Position 2 0))
"-- TODO1 added by Example Plugin directly\n"]
edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing Nothing
pure $ Right $ List
[ InR $ CodeAction title (Just CodeActionQuickFix) (Just $ List []) Nothing Nothing (Just edit) Nothing Nothing]
let mbnfp = uriToNormalizedFilePath $ toNormalizedUri uri
case mbnfp of
Just nfp -> do
Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp
let
title = "Add TODO Item 1"
tedit = [TextEdit (Range (Position 2 0) (Position 2 0))
"-- TODO1 added by Example Plugin directly\n"]
edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing Nothing
pure $ Right $ List
[ InR $ CodeAction title (Just CodeActionQuickFix) (Just $ List []) Nothing Nothing (Just edit) Nothing Nothing]
Nothing -> error $ "Unable to get a normalized file path from the uri: " ++ show uri

-- ---------------------------------------------------------------------

Expand Down
3 changes: 2 additions & 1 deletion plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RecordWildCards #-}

-- To avoid warning "Pattern match has inaccessible right hand side"
{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-}
module Ide.Plugin.Eval.Rules (GetEvalComments(..), rules,queueForEvaluation) where

import Control.Monad.IO.Class (MonadIO (liftIO))
Expand Down
13 changes: 6 additions & 7 deletions plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ import Development.IDE.GHC.Compat (BufSpan,
DynFlags,
extensionFlags,
ms_hspp_opts,
topDir)
topDir,
WarningFlag(Opt_WarnUnrecognisedPragmas),
wopt)
import qualified Development.IDE.GHC.Compat.Util as EnumSet
import "ghc-lib" GHC hiding
(DynFlags (..),
Expand All @@ -85,6 +87,7 @@ import Language.Haskell.GHC.ExactPrint.Delta (deltaOption
import Language.Haskell.GHC.ExactPrint.Parsers (postParseTransform)
import Language.Haskell.GHC.ExactPrint.Types (Rigidity (..))
import Language.Haskell.GhclibParserEx.Fixity as GhclibParserEx (applyFixities)
import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative))
#endif

import Ide.Logger
Expand All @@ -105,21 +108,17 @@ import Language.LSP.Types hiding
import qualified Language.LSP.Types as LSP
import qualified Language.LSP.Types.Lens as LSP

import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative),
Generic)
import Text.Regex.TDFA.Text ()

import Development.IDE.GHC.Compat (WarningFlag (Opt_WarnUnrecognisedPragmas),
wopt)
import Development.IDE.Spans.Pragmas (LineSplitTextEdits (LineSplitTextEdits),
NextPragmaInfo (NextPragmaInfo),
getNextPragmaInfo,
lineSplitDeleteTextEdit,
lineSplitInsertTextEdit,
lineSplitTextEdits,
nextPragmaLine)
import GHC.Generics (Generic)
import System.Environment (setEnv,
unsetEnv)
import Text.Regex.TDFA.Text ()
-- ---------------------------------------------------------------------

#ifdef HLINT_ON_GHC_LIB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@ commandProvider RunMetaprogram =


requireGHC88OrHigher :: TacticProvider -> TacticProvider
requireGHC88OrHigher tp tpd =
#if __GLASGOW_HASKELL__ >= 808
requireGHC88OrHigher tp tpd =
tp tpd
#else
requireGHC88OrHigher _ _=
mempty
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import Data.Functor ((<&>))
import Data.List (sortOn)
import Data.String (IsString)
import Data.Text (Text)
import Data.Text.Prettyprint.Doc hiding (parens)
import Data.Text.Prettyprint.Doc.Render.String (renderString)
import Prettyprinter hiding (parens)
import Prettyprinter.Render.String (renderString)
import Development.IDE.GHC.Compat (OccName)
import qualified Text.Megaparsec as P
import Wingman.Metaprogramming.Lexer (Parser, identifier, variable, parens)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Wingman.Metaprogramming.ProofState where
import Data.Bool (bool)
import Data.Functor ((<&>))
import qualified Data.Text as T
import Data.Text.Prettyprint.Doc
import Data.Text.Prettyprint.Doc.Render.Util.Panic
import Prettyprinter
import Prettyprinter.Render.Util.Panic
import Language.LSP.Types (sectionSeparator)
import Wingman.Judgements (jHypothesis)
import Wingman.Types
Expand Down
20 changes: 9 additions & 11 deletions plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ module Wingman.StaticPlugin
, pattern MetaprogramSyntax
) where

import Data.Data
import Development.IDE.GHC.Compat
import Development.IDE.GHC.Compat.Util
import GHC.LanguageExtensions.Type (Extension(EmptyCase, QuasiQuotes))
import Generics.SYB

import Ide.Types

#if __GLASGOW_HASKELL__ >= 808
import Data.Data
import Generics.SYB
#if __GLASGOW_HASKELL__ >= 900
import GHC.Driver.Plugins (purePlugin)
#else
import Plugins (purePlugin)
#endif
#endif

staticPlugin :: DynFlagsModifications
staticPlugin = mempty
Expand All @@ -44,7 +48,6 @@ pattern MetaprogramSourceText :: SourceText
pattern MetaprogramSourceText = SourceText "wingman-meta-program"



pattern WingmanMetaprogram :: FastString -> HsExpr p
pattern WingmanMetaprogram mp <-
#if __GLASGOW_HASKELL__ >= 900
Expand All @@ -56,7 +59,6 @@ pattern WingmanMetaprogram mp <-
#endif



enableQuasiQuotes :: DynFlags -> DynFlags
enableQuasiQuotes = flip xopt_set QuasiQuotes

Expand All @@ -80,11 +82,6 @@ metaprogrammingPlugin =
}
worker :: Monad m => [CommandLineOption] -> ModSummary -> HsParsedModule -> m HsParsedModule
worker _ _ pm = pure $ pm { hpm_module = addMetaprogrammingSyntax $ hpm_module pm }
#endif

metaprogramHoleName :: OccName
metaprogramHoleName = mkVarOcc "_$metaprogram"


mkMetaprogram :: SrcSpan -> FastString -> HsExpr GhcPs
mkMetaprogram ss mp =
Expand All @@ -98,14 +95,16 @@ mkMetaprogram ss mp =
$ L ss
$ mkRdrUnqual metaprogramHoleName


addMetaprogrammingSyntax :: Data a => a -> a
addMetaprogrammingSyntax =
everywhere $ mkT $ \case
L ss (MetaprogramSyntax mp) ->
L ss $ mkMetaprogram ss mp
(x :: LHsExpr GhcPs) -> x
#endif

metaprogramHoleName :: OccName
metaprogramHoleName = mkVarOcc "_$metaprogram"

pattern MetaprogramSyntax :: FastString -> HsExpr GhcPs
pattern MetaprogramSyntax mp <-
Expand All @@ -119,4 +118,3 @@ pattern MetaprogramSyntax mp <-
(mkRdrUnqual $ mkVarOcc "wingman")
noSrcSpan
mp

1 change: 0 additions & 1 deletion plugins/hls-tactics-plugin/src/Wingman/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import GHC.Exts (fromString)
import GHC.Generics
import GHC.SourceGen (var)
import Refinery.ProofState
import Refinery.Tactic
import Refinery.Tactic.Internal (TacticT(TacticT), RuleT (RuleT))
import System.IO.Unsafe (unsafePerformIO)
import Wingman.Debug
Expand Down
1 change: 1 addition & 0 deletions stack-8.6.5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ extra-deps:
- optparse-applicative-0.15.1.0
- ormolu-0.1.4.1
- parser-combinators-1.2.1
- prettyprinter-1.7.0
- primitive-0.7.1.0
- refinery-0.4.0.0
- regex-base-0.94.0.0
Expand Down
1 change: 1 addition & 0 deletions stack-8.8.4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ extra-deps:
- monad-dijkstra-0.1.1.2
- opentelemetry-0.6.1
- opentelemetry-extra-0.6.1
- prettyprinter-1.7.0
- refinery-0.4.0.0
- retrie-1.1.0.0
- semigroups-0.18.5
Expand Down
3 changes: 1 addition & 2 deletions stack-9.0.2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ packages:
- ./plugins/hls-retrie-plugin
- ./plugins/hls-splice-plugin
# - ./plugins/hls-tactics-plugin
# - ./plugins/hls-brittany-plugin
- ./plugins/hls-brittany-plugin
# - ./plugins/hls-stylish-haskell-plugin
- ./plugins/hls-floskell-plugin
- ./plugins/hls-fourmolu-plugin
Expand Down Expand Up @@ -101,7 +101,6 @@ flags:
ignore-plugins-ghc-bounds: true
tactic: false # Dependencies fail
stylishHaskell: false
brittany: false

retrie:
BuildExecutable: false
Expand Down
Loading