Skip to content

Commit

Permalink
Actually enable pedantic flag in ci flags job (haskell#4224)
Browse files Browse the repository at this point in the history
* Actually enable pedantic flag in ci flags job

* Address reviwe comments

* Fixes after rebase

* Tweak warning configs
  • Loading branch information
jhrcek authored May 13, 2024
1 parent 61fd5c4 commit 4985793
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 65 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/flags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ jobs:
- name: Configue non-default flags for all components
run: |
cabal configure \
--constraint "hls-graph +embed-files +stm-stats" \
--constraint "haskell-language-server +pedantic" \
--constraint "hls-graph +embed-files +pedantic +stm-stats" \
--constraint "ghcide +ekg +executable +test-exe" \
--constraint "hls-plugin-api -use-fingertree" \
--constraint "all +pedantic"
--constraint "hls-plugin-api +pedantic -use-fingertree"
cat cabal.project.local
- name: Build everything with non-default flags
Expand Down
1 change: 0 additions & 1 deletion .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
- Main
- Experiments
- Development.Benchmark.Rules
- Development.IDE.Plugin.CodeAction
- Development.IDE.Plugin.Completions
- Development.IDE.Plugin.CodeAction.ExactPrint
- Development.IDE.Spans.Documentation
Expand Down
3 changes: 0 additions & 3 deletions ghcide/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ module Main(main) where

import Arguments (Arguments (..),
getArguments)
import Control.Monad.Extra (unless)
import Control.Monad.IO.Class (liftIO)
import Data.Default (def)
import Data.Function ((&))
import Data.Version (showVersion)
import Development.GitRev (gitHash)
import Development.IDE (action)
import Development.IDE.Core.OfInterest (kick)
import Development.IDE.Core.Rules (mainRule)
import qualified Development.IDE.Core.Rules as Rules
import Development.IDE.Core.Tracing (withTelemetryRecorder)
Expand Down
6 changes: 2 additions & 4 deletions ghcide/test/exe/DiagnosticTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ import Control.Monad.Extra (whenJust)
import Data.Default (def)
import Development.IDE.Plugin.Test (WaitForIdeRuleResult (..))
import System.Time.Extra
import Test.Hls (runSessionWithServer',
runSessionWithServerInTmpDirCont,
waitForProgressBegin,
waitForTypecheck)
import Test.Hls (runSessionWithServerInTmpDirCont,
waitForProgressBegin)
import Test.Hls.FileSystem (directCradle, file, text,
toAbsFp)
import Test.Tasty
Expand Down
43 changes: 17 additions & 26 deletions ghcide/test/exe/TestUtils.hs
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@

{-# LANGUAGE GADTs #-}

module TestUtils where

import Control.Applicative.Combinators
import Control.Concurrent.Async
import Control.Exception (bracket_, finally)
import Control.Lens ((.~))
import qualified Control.Lens as Lens
import qualified Control.Lens.Extras as Lens
import Control.Monad
import Control.Exception (bracket_, finally)
import Data.Foldable
import Data.Function ((&))
import Data.Maybe
import Development.IDE.GHC.Compat (GhcVersion (..), ghcVersion)
import qualified Development.IDE.Main as IDE
import Development.IDE.Test (configureCheckProject,
expectNoMoreDiagnostics)
import Development.IDE.GHC.Compat (GhcVersion (..), ghcVersion)
import qualified Development.IDE.Main as IDE
import Development.IDE.Test (configureCheckProject,
expectNoMoreDiagnostics)
import Development.IDE.Test.Runfiles
import Development.IDE.Types.Location
import Development.Shake (getDirectoryFilesIO)
import Ide.Logger (Recorder, WithPriority,
cmapWithPrio)
import qualified Language.LSP.Protocol.Lens as L
import Language.LSP.Protocol.Message
import Language.LSP.Protocol.Types hiding
(SemanticTokenAbsolute (..),
SemanticTokenRelative (..),
SemanticTokensEdit (..),
mkRange)
import Development.Shake (getDirectoryFilesIO)
import Ide.Logger (Recorder, WithPriority,
cmapWithPrio)
import Language.LSP.Protocol.Types hiding
(SemanticTokenAbsolute (..),
SemanticTokenRelative (..),
SemanticTokensEdit (..),
mkRange)
import Language.LSP.Test
import System.Directory
import System.Environment.Blank (getEnv, setEnv, unsetEnv)
import System.Environment.Blank (getEnv, setEnv, unsetEnv)
import System.FilePath
import System.Info.Extra (isMac, isWindows)
import System.Info.Extra (isMac, isWindows)
import qualified System.IO.Extra
import System.Process.Extra (createPipe)
import System.Process.Extra (createPipe)
import Test.Tasty
import Test.Tasty.ExpectedFailure
import Test.Tasty.HUnit

import Config (lspTestCaps)
import Config (lspTestCaps)
import LogType


Expand Down
37 changes: 18 additions & 19 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ common defaults
default-extensions: ExplicitNamespaces

common test-defaults
ghc-options: -threaded -rtsopts -with-rtsopts=-N
ghc-options: -threaded -rtsopts -with-rtsopts=-N
if impl(ghc >= 9.8)
-- We allow using partial functions in tests
ghc-options: -Wno-x-partial

-- Default warnings in HLS
common warnings
Expand Down Expand Up @@ -1676,25 +1679,23 @@ test-suite hls-refactor-plugin-tests
ghc-options: -O0
build-depends:
, base
, data-default
, directory
, extra
, filepath
, ghcide:ghcide
, haskell-language-server:hls-refactor-plugin
, hls-test-utils == 2.8.0.0
, lens
, lsp-test
, lsp-types
, text
, hls-plugin-api
, parser-combinators
, data-default
, extra
, ghcide:ghcide
, shake
, hls-plugin-api
, lsp-test
, directory
, regex-tdfa
, tasty-hunit
, tasty-expected-failure
, shake
, tasty
, tasty-expected-failure
, tasty-hunit
, text

-----------------------------
-- semantic tokens plugin
Expand Down Expand Up @@ -1763,19 +1764,17 @@ test-suite hls-semantic-tokens-plugin-tests
, aeson
, base
, containers
, data-default
, filepath
, ghcide == 2.8.0.0
, haskell-language-server:hls-semantic-tokens-plugin
, hls-test-utils == 2.8.0.0
, hls-plugin-api
, hls-plugin-api == 2.8.0.0
, hls-test-utils == 2.8.0.0
, lens
, lsp
, text-rope
, lsp-test
, text
, data-default
, ghcide == 2.8.0.0
, hls-plugin-api == 2.8.0.0
, data-default
, text-rope

-----------------------------
-- notes plugin
Expand Down
6 changes: 5 additions & 1 deletion hls-test-utils/hls-test-utils.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ library
, temporary
, text

ghc-options: -Wall -Wunused-packages -Wno-name-shadowing
ghc-options:
-Wall
-Wunused-packages
-Wno-name-shadowing
-Wno-unticked-promoted-constructors

if flag(pedantic)
ghc-options: -Werror
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ module Ide.Plugin.Literals (

import Data.Maybe (maybeToList)
import Data.Text (Text)
import qualified Data.Text as T
#if __GLASGOW_HASKELL__ >= 908
import qualified Data.Text.Encoding as T
#else
import qualified Data.Text as T
#endif
import Development.IDE.GHC.Compat hiding (getSrcSpan)
import Development.IDE.Graph.Classes (NFData (rnf))
Expand Down
1 change: 0 additions & 1 deletion plugins/hls-class-plugin/test/Main.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ We build parsers combining the following three kinds of them:
-}

-- | Line parser
type LineParser a = forall m. Monad m => ParsecT Void String m a
type LineParser a = forall m. ParsecT Void String m a

-- | Line comment group parser
type LineGroupParser = Parsec Void [(Range, RawLineComment)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1085,11 +1085,14 @@ suggestImportDisambiguation df (Just txt) ps fileContents diag@Diagnostic {..}
_ -> False
]
++ [HideOthers restImports | not (null restImports)]
] ++ [ ( renderUniquify mode T.empty symbol True
, disambiguateSymbol ps fileContents diag symbol mode
) | local, not (null targetsWithRestImports)
, let mode = HideOthers (uncurry (:) (head targetsWithRestImports))
]
] ++ case targetsWithRestImports of
(m,ms):_ | local ->
let mode = HideOthers (m:ms)
in [( renderUniquify mode T.empty symbol True
, disambiguateSymbol ps fileContents diag symbol mode
)]
_ -> []

renderUniquify HideOthers {} modName symbol local =
"Use " <> (if local then "local definition" else modName) <> " for " <> symbol <> ", hiding other imports"
renderUniquify (ToQualified _ qual) _ symbol _ =
Expand Down

0 comments on commit 4985793

Please sign in to comment.