Skip to content

Commit 2558035

Browse files
authored
Make work stack-9.2.1.yaml and enable pedantic (-WError) for cabal (haskell#2606)
* Enable brittany for ghc-9.0.2 * Make works using cabal freeze * Add stack 9.2.1 to ci * Use new *molu versions * Enable rename for stack 9.2.1 * Use last ghc-lib * Use correct boot pkgs * Use last ghc-exactprint * Reorganize and use lens-5.1 * update retrie * Comment class plugin package * Handle Nothing case * Restore ghc-typelits deps * More non-exhaustive patterns * More non-exhaustive patterns * Set pedantic (-WError) true for cabal * Remove pedantic as we set it out in cabal.project * Not set pedantic for ghc-9.2.1 * Set pedantic in cabal.project's * More non-exhaustive patterns * Not set pedantic for ghc-9.0.1 * More incomplete patterns * Fix WErrors * Dodgy import * Correct CPP conditions * Not MonadFail in Prelude * Fix more warnings * Restore missing fun * unused imports * Enable refine imports * more fixes * Enable brittany in nix for 9.0.1 * Use newer prettyprinter * Return to master * Enable tactics in stack-9.2.1.yaml * Enable pedantic in ci * Avoid deprecation warning with CPP � * Use default prettyprinter * Update refinery for ghc-9.2.1 * Ignore deprecations * Use dev version of ghc-source-gen * disable wingman for 9.2.1 * Enable wingman for 9.0.2 * disable tactic with flag * yaml grammar * Use setup-build action * Correct workflow * Build flags for al major os's * The integer twaek is needed for the solver * Disable tests beforehand * flags only affect local packages * Exclude 8.6.5 * Exclude 8.8.4
1 parent 905f8f7 commit 2558035

File tree

20 files changed

+171
-176
lines changed

20 files changed

+171
-176
lines changed

.circleci/config.yml

+6
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ jobs:
105105
- STACK_FILE: "stack-9.0.2.yaml"
106106
<<: *defaults
107107

108+
ghc-9.2.1:
109+
environment:
110+
- STACK_FILE: "stack-9.2.1.yaml"
111+
<<: *defaults
112+
108113
ghc-default:
109114
environment:
110115
- STACK_FILE: "stack.yaml"
@@ -121,4 +126,5 @@ workflows:
121126
- ghc-8.10.7
122127
- ghc-9.0.1
123128
- ghc-9.0.2
129+
- ghc-9.2.1
124130
- ghc-default

.github/actions/setup-build/action.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,19 @@ runs:
5454
fi
5555
shell: bash
5656

57+
# some alpines come with integer-simple instead of integer-gmp
58+
- if: inputs.os == 'Linux'
59+
name: Force integer-simple
60+
run: |
61+
if ghc --info | grep -q integer-simple ; then
62+
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
63+
fi
64+
shell: bash
65+
5766
- if: inputs.os == 'Windows' && inputs.ghc == '8.8.4'
5867
name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults
5968
run: |
60-
echo "package floskell" >> cabal.project
61-
echo " ghc-options: -O0" >> cabal.project
69+
echo -e 'package floskell\n ghc-options: -O0' >> cabal.project.local
6270
shell: bash
6371

6472
# Shorten binary names as a workaround for filepath length limits in Windows,

.github/workflows/build.yml

+9-41
Original file line numberDiff line numberDiff line change
@@ -41,40 +41,15 @@ jobs:
4141
apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
4242
- uses: actions/checkout@v2
4343

44-
- uses: haskell/actions/setup@v1
45-
with:
46-
ghc-version : ${{ matrix.ghc }}
47-
cabal-version: ${{ matrix.cabal }}
48-
enable-stack: false
49-
50-
# some alpines come with integer-simple instead of integer-gmp
51-
- name: Force integer-simple
52-
if: matrix.os == 'ubuntu-18.04'
53-
run: |
54-
if ghc --info | grep -q integer-simple ; then
55-
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
56-
fi
57-
58-
- name: Use modified cabal.project
59-
env:
60-
GHCVER: ${{ matrix.ghc }}
44+
- name: Disable tests and bechmarks
6145
run: |
62-
GHCVER2=${GHCVER//./}
63-
ALT_PROJECT_FILE_MINOR=cabal-ghc${GHCVER2}.project
64-
ALT_PROJECT_FILE_MAJOR=cabal-ghc${GHCVER2:0:2}.project
65-
if [[ -f "$ALT_PROJECT_FILE_MINOR" ]]; then
66-
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MINOR" cabal.project
67-
elif [[ -f "$ALT_PROJECT_FILE_MAJOR" ]]; then
68-
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MAJOR" cabal.project
69-
fi
46+
echo -e 'tests: false' >> cabal.project.local
47+
echo -e 'benchmarks: false' >> cabal.project.local
7048
71-
- name: Shorten binary names
72-
run: |
73-
sed -i.bak -e 's/haskell-language-server/hls/g' \
74-
-e 's/haskell_language_server/hls/g' \
75-
haskell-language-server.cabal cabal.project
76-
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
77-
src/**/*.hs exe/*.hs
49+
- uses: ./.github/actions/setup-build
50+
with:
51+
ghc: ${{ matrix.ghc }}
52+
os: ${{ runner.os }}
7853

7954
- name: (Windows) Platform specifics
8055
if: matrix.os == 'windows-latest'
@@ -99,17 +74,10 @@ jobs:
9974
run: |
10075
echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV
10176
102-
- name: (Windows, GHC 8.8.4) Workaround segfaults
103-
if: matrix.ghc == '8.8.4' && matrix.os == 'windows-latest'
104-
run: |
105-
echo "package floskell" >> cabal.project
106-
echo " ghc-options: -O0" >> cabal.project
107-
10877
- name: Build the server
10978
# Try building it twice in case of flakey builds on Windows
11079
run: |
111-
cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS || \
112-
cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS -j1
80+
cabal build exe:hls -O2 $LINUX_CABAL_ARGS || cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1
11381
11482
- name: Compress server binary
11583
id: compress_server_binary
@@ -148,7 +116,7 @@ jobs:
148116

149117
- name: (GHC 8.10) Build the wrapper
150118
if: matrix.ghc == '8.10.7'
151-
run: cabal build --disable-tests exe:hls-wrapper -O2 $LINUX_CABAL_ARGS
119+
run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS
152120

153121
- name: (GHC 8.10) Compress wrapper binary
154122
if: matrix.ghc == '8.10.7'

.github/workflows/flags.yml

+14-10
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ jobs:
4343
strategy:
4444
fail-fast: true
4545
matrix:
46-
ghc: [ "8.10.7"
46+
ghc: [ "9.2.1"
47+
, "9.0.2"
48+
, "8.10.7"
49+
, "8.8.4"
50+
, "8.6.5"
4751
]
4852
os: [ "ubuntu-latest"
4953
]
@@ -57,20 +61,20 @@ jobs:
5761
os: ${{ runner.os }}
5862

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

62-
- name: Build `hie-compat` with flags
66+
- if: matrix.ghc != '8.6.5' && matrix.ghc != '8.8.4'
67+
name: Build `hie-compat` with flags
6368
run: cabal v2-build hie-compat --flags="ghc-lib"
6469

65-
- name: Build `hls-plugin-api` with flags
66-
run: cabal v2-build hls-plugin-api --flags="pedantic"
67-
68-
- name: Build `hls-test-utils` with flags
69-
run: cabal v2-build hls-test-utils --flags="pedantic"
70-
71-
- name: Build
70+
- name: Build `ghcide` with flags
7271
run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe"
7372

73+
# we have to clean up warnings for 9.0 and 9.2 before enable -WAll
74+
- if: matrix.ghc != '9.0.2' && matrix.ghc != '9.2.1'
75+
name: Build with pedantic (-WError)
76+
run: cabal v2-build --flags="pedantic"
77+
7478
flags_post_job:
7579
if: always()
7680
runs-on: ubuntu-latest

cabal-ghc921.project

-19
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ packages:
2727
./plugins/hls-call-hierarchy-plugin
2828
./plugins/hls-alternate-number-format-plugin
2929

30-
repository head.hackage.ghc.haskell.org
31-
url: https://ghc.gitlab.haskell.org/head.hackage/
32-
secure: True
33-
key-threshold: 3
34-
root-keys:
35-
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
36-
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
37-
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
38-
39-
4030
with-compiler: ghc-9.2.1
4131

4232
tests: true
@@ -63,17 +53,8 @@ constraints:
6353
-splice
6454
-stylishhaskell
6555
-tactic,
66-
ghc-lib-parser ^>= 9.2,
67-
attoparsec ^>= 0.14.3,
68-
ghc-exactprint >= 1.3,
69-
retrie >= 1.2,
70-
direct-sqlite == 2.3.26,
71-
lens >= 5.0.1,
72-
primitive-unlifted ==0.1.3.1
7356

7457
allow-newer:
75-
-- base,
76-
7758
-- for shake-bench
7859
Chart:lens,
7960
Chart-diagrams:lens,

hls-graph/src/Development/IDE/Graph/Internal/Types.hs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
{-# LANGUAGE CPP #-}
42
{-# LANGUAGE DeriveAnyClass #-}
53
{-# LANGUAGE DeriveFunctor #-}
@@ -14,16 +12,13 @@ module Development.IDE.Graph.Internal.Types where
1412

1513
import Control.Applicative
1614
import Control.Monad.Catch
17-
#if __GLASGOW_HASKELL__ < 870
15+
#if __GLASGOW_HASKELL__ < 808
1816
-- Needed in GHC 8.6.5
1917
import Control.Concurrent.STM.Stats (TVar, atomically)
18+
import Control.Monad.Fail
2019
#else
2120
import GHC.Conc (TVar, atomically)
2221
#endif
23-
#if __GLASGOW_HASKELL__ < 880
24-
import Control.Monad.Fail
25-
import Prelude hiding (MonadFail)
26-
#endif
2722
import Control.Monad.IO.Class
2823
import Control.Monad.Trans.Reader
2924
import Data.Aeson (FromJSON, ToJSON)

plugins/default/src/Ide/Plugin/Example.hs

+12-9
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,18 @@ mkDiag file diagSource sev loc msg = (file, D.ShowDiag,)
109109
-- | Generate code actions.
110110
codeAction :: PluginMethodHandler IdeState TextDocumentCodeAction
111111
codeAction state _pid (CodeActionParams _ _ (TextDocumentIdentifier uri) _range CodeActionContext{_diagnostics=List _xs}) = liftIO $ do
112-
let Just nfp = uriToNormalizedFilePath $ toNormalizedUri uri
113-
Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp
114-
let
115-
title = "Add TODO Item 1"
116-
tedit = [TextEdit (Range (Position 2 0) (Position 2 0))
117-
"-- TODO1 added by Example Plugin directly\n"]
118-
edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing Nothing
119-
pure $ Right $ List
120-
[ InR $ CodeAction title (Just CodeActionQuickFix) (Just $ List []) Nothing Nothing (Just edit) Nothing Nothing]
112+
let mbnfp = uriToNormalizedFilePath $ toNormalizedUri uri
113+
case mbnfp of
114+
Just nfp -> do
115+
Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp
116+
let
117+
title = "Add TODO Item 1"
118+
tedit = [TextEdit (Range (Position 2 0) (Position 2 0))
119+
"-- TODO1 added by Example Plugin directly\n"]
120+
edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing Nothing
121+
pure $ Right $ List
122+
[ InR $ CodeAction title (Just CodeActionQuickFix) (Just $ List []) Nothing Nothing (Just edit) Nothing Nothing]
123+
Nothing -> error $ "Unable to get a normalized file path from the uri: " ++ show uri
121124

122125
-- ---------------------------------------------------------------------
123126

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
{-# LANGUAGE LambdaCase #-}
33
{-# LANGUAGE PatternSynonyms #-}
44
{-# LANGUAGE RecordWildCards #-}
5-
5+
-- To avoid warning "Pattern match has inaccessible right hand side"
6+
{-# OPTIONS_GHC -Wno-overlapping-patterns #-}
67
module Ide.Plugin.Eval.Rules (GetEvalComments(..), rules,queueForEvaluation) where
78

89
import Control.Monad.IO.Class (MonadIO (liftIO))

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ import Development.IDE.GHC.Compat (BufSpan,
5959
DynFlags,
6060
extensionFlags,
6161
ms_hspp_opts,
62-
topDir)
62+
topDir,
63+
WarningFlag(Opt_WarnUnrecognisedPragmas),
64+
wopt)
6365
import qualified Development.IDE.GHC.Compat.Util as EnumSet
6466
import "ghc-lib" GHC hiding
6567
(DynFlags (..),
@@ -85,6 +87,7 @@ import Language.Haskell.GHC.ExactPrint.Delta (deltaOption
8587
import Language.Haskell.GHC.ExactPrint.Parsers (postParseTransform)
8688
import Language.Haskell.GHC.ExactPrint.Types (Rigidity (..))
8789
import Language.Haskell.GhclibParserEx.Fixity as GhclibParserEx (applyFixities)
90+
import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative))
8891
#endif
8992

9093
import Ide.Logger
@@ -105,21 +108,17 @@ import Language.LSP.Types hiding
105108
import qualified Language.LSP.Types as LSP
106109
import qualified Language.LSP.Types.Lens as LSP
107110

108-
import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative),
109-
Generic)
110-
import Text.Regex.TDFA.Text ()
111-
112-
import Development.IDE.GHC.Compat (WarningFlag (Opt_WarnUnrecognisedPragmas),
113-
wopt)
114111
import Development.IDE.Spans.Pragmas (LineSplitTextEdits (LineSplitTextEdits),
115112
NextPragmaInfo (NextPragmaInfo),
116113
getNextPragmaInfo,
117114
lineSplitDeleteTextEdit,
118115
lineSplitInsertTextEdit,
119116
lineSplitTextEdits,
120117
nextPragmaLine)
118+
import GHC.Generics (Generic)
121119
import System.Environment (setEnv,
122120
unsetEnv)
121+
import Text.Regex.TDFA.Text ()
123122
-- ---------------------------------------------------------------------
124123

125124
#ifdef HLINT_ON_GHC_LIB

plugins/hls-tactics-plugin/src/Wingman/LanguageServer/TacticProviders.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,11 @@ commandProvider RunMetaprogram =
160160

161161

162162
requireGHC88OrHigher :: TacticProvider -> TacticProvider
163-
requireGHC88OrHigher tp tpd =
164163
#if __GLASGOW_HASKELL__ >= 808
164+
requireGHC88OrHigher tp tpd =
165165
tp tpd
166166
#else
167+
requireGHC88OrHigher _ _=
167168
mempty
168169
#endif
169170

plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE OverloadedStrings #-}
2+
{-# OPTIONS_GHC -Wno-deprecations #-}
23

34
module Wingman.Metaprogramming.Parser.Documentation where
45

plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
{-# LANGUAGE CPP #-}
12
{-# LANGUAGE NamedFieldPuns #-}
23
{-# LANGUAGE OverloadedStrings #-}
4+
{-# OPTIONS_GHC -Wno-deprecations #-}
35

46
module Wingman.Metaprogramming.ProofState where
57

0 commit comments

Comments
 (0)