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 all 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
12 changes: 10 additions & 2 deletions .github/actions/setup-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,19 @@ runs:
fi
shell: bash

# some alpines come with integer-simple instead of integer-gmp
- if: inputs.os == 'Linux'
name: Force integer-simple
run: |
if ghc --info | grep -q integer-simple ; then
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
fi
shell: bash

- if: inputs.os == 'Windows' && inputs.ghc == '8.8.4'
name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults
run: |
echo "package floskell" >> cabal.project
echo " ghc-options: -O0" >> cabal.project
echo -e 'package floskell\n ghc-options: -O0' >> cabal.project.local
shell: bash

# Shorten binary names as a workaround for filepath length limits in Windows,
Expand Down
50 changes: 9 additions & 41 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,15 @@ jobs:
apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static
- uses: actions/checkout@v2

- uses: haskell/actions/setup@v1
with:
ghc-version : ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
enable-stack: false

# some alpines come with integer-simple instead of integer-gmp
- name: Force integer-simple
if: matrix.os == 'ubuntu-18.04'
run: |
if ghc --info | grep -q integer-simple ; then
echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local
fi

- name: Use modified cabal.project
env:
GHCVER: ${{ matrix.ghc }}
- name: Disable tests and bechmarks
run: |
GHCVER2=${GHCVER//./}
ALT_PROJECT_FILE_MINOR=cabal-ghc${GHCVER2}.project
ALT_PROJECT_FILE_MAJOR=cabal-ghc${GHCVER2:0:2}.project
if [[ -f "$ALT_PROJECT_FILE_MINOR" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MINOR" cabal.project
elif [[ -f "$ALT_PROJECT_FILE_MAJOR" ]]; then
rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MAJOR" cabal.project
fi
echo -e 'tests: false' >> cabal.project.local
echo -e 'benchmarks: false' >> cabal.project.local

- name: Shorten binary names
run: |
sed -i.bak -e 's/haskell-language-server/hls/g' \
-e 's/haskell_language_server/hls/g' \
haskell-language-server.cabal cabal.project
sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \
src/**/*.hs exe/*.hs
- uses: ./.github/actions/setup-build
with:
ghc: ${{ matrix.ghc }}
os: ${{ runner.os }}

- name: (Windows) Platform specifics
if: matrix.os == 'windows-latest'
Expand All @@ -99,17 +74,10 @@ jobs:
run: |
echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV

- name: (Windows, GHC 8.8.4) Workaround segfaults
if: matrix.ghc == '8.8.4' && matrix.os == 'windows-latest'
run: |
echo "package floskell" >> cabal.project
echo " ghc-options: -O0" >> cabal.project

- name: Build the server
# Try building it twice in case of flakey builds on Windows
run: |
cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS || \
cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS -j1
cabal build exe:hls -O2 $LINUX_CABAL_ARGS || cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1

- name: Compress server binary
id: compress_server_binary
Expand Down Expand Up @@ -148,7 +116,7 @@ jobs:

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

- name: (GHC 8.10) Compress wrapper binary
if: matrix.ghc == '8.10.7'
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ jobs:
strategy:
fail-fast: true
matrix:
ghc: [ "8.10.7"
ghc: [ "9.2.1"
, "9.0.2"
, "8.10.7"
, "8.8.4"
, "8.6.5"
]
os: [ "ubuntu-latest"
]
Expand All @@ -57,20 +61,20 @@ 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
- if: matrix.ghc != '8.6.5' && matrix.ghc != '8.8.4'
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
- name: Build `ghcide` with flags
run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe"

# we have to clean up warnings for 9.0 and 9.2 before enable -WAll
- if: matrix.ghc != '9.0.2' && matrix.ghc != '9.2.1'
name: Build with pedantic (-WError)
run: cabal v2-build --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.

This will rebuild everything, I think? do we want that? seems like it'll make the workflow slow. Maybe it's okay.

Copy link
Member Author

Choose a reason for hiding this comment

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

only local packages (as --flags only affect them), even the ones without the flag as we have one package in the root of the local dependency tree with the flag available


flags_post_job:
if: always()
runs-on: ubuntu-latest
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
9 changes: 2 additions & 7 deletions hls-graph/src/Development/IDE/Graph/Internal/Types.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveFunctor #-}
Expand All @@ -14,16 +12,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 -Wno-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
@@ -1,4 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-deprecations #-}

module Wingman.Metaprogramming.Parser.Documentation where

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-deprecations #-}

module Wingman.Metaprogramming.ProofState where

Expand Down
Loading