Skip to content

Commit

Permalink
Add -Wunused-packages, consolidate warning configs, fix few more warn…
Browse files Browse the repository at this point in the history
…ings
  • Loading branch information
jhrcek committed Apr 15, 2024
1 parent 2390949 commit ad741d4
Show file tree
Hide file tree
Showing 27 changed files with 44 additions and 34 deletions.
3 changes: 0 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ test-show-details: direct

benchmarks: True

package *
ghc-options: -Wunused-packages

package lsp
flags: +demo

Expand Down
1 change: 0 additions & 1 deletion lsp-test/bench/SimpleBench.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}

module Main where

Expand Down
1 change: 1 addition & 0 deletions lsp-test/example/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Language.LSP.Protocol.Message
import Language.LSP.Protocol.Types
import Language.LSP.Test

main :: IO ()
main = runSession "lsp-demo-reactor-server" fullCaps "test/data/" $ do
doc <- openDoc "Rename.hs" "haskell"

Expand Down
2 changes: 0 additions & 2 deletions lsp-test/func-test/FuncTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ import Control.Monad.IO.Class
import Data.Aeson qualified as J
import Data.Maybe
import Data.Proxy
import Data.Set qualified as Set
import Language.LSP.Protocol.Lens qualified as L
import Language.LSP.Protocol.Message
import Language.LSP.Protocol.Types
import Language.LSP.Server
import Language.LSP.Test qualified as Test
import System.Exit
import System.IO
import System.Process
import Test.Hspec
import UnliftIO
Expand Down
11 changes: 9 additions & 2 deletions lsp-test/lsp-test.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ source-repository head
type: git
location: https://github.com/haskell/lsp

common warnings
ghc-options: -Wunused-packages

library
import: warnings
hs-source-dirs: src
default-language: GHC2021
exposed-modules: Language.LSP.Test
Expand Down Expand Up @@ -89,6 +93,7 @@ library
ghc-options: -W

test-suite tests
import: warnings
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Test.hs
Expand All @@ -114,6 +119,7 @@ test-suite tests
, unliftio

test-suite func-test
import: warnings
type: exitcode-stdio-1.0
hs-source-dirs: func-test
default-language: GHC2021
Expand All @@ -122,7 +128,6 @@ test-suite func-test
, base
, aeson
, co-log-core
, containers
, hspec
, lens
, lsp
Expand All @@ -132,6 +137,7 @@ test-suite func-test
, unliftio

test-suite example
import: warnings
type: exitcode-stdio-1.0
hs-source-dirs: example
default-language: GHC2021
Expand All @@ -144,11 +150,12 @@ test-suite example
build-tool-depends: lsp:lsp-demo-reactor-server

benchmark simple-bench
import: warnings
type: exitcode-stdio-1.0
hs-source-dirs: bench
default-language: GHC2021
main-is: SimpleBench.hs
ghc-options: -Wall -O2 -eventlog -rtsopts
ghc-options: -Wall -O2 -rtsopts
build-depends:
, base
, extra
Expand Down
2 changes: 1 addition & 1 deletion lsp-test/src/Language/LSP/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

{- |
Module : Language.LSP.Test
Expand Down
2 changes: 1 addition & 1 deletion lsp-test/src/Language/LSP/Test/Decoding.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module Language.LSP.Test.Decoding where

Expand Down
2 changes: 1 addition & 1 deletion lsp-test/src/Language/LSP/Test/Files.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module Language.LSP.Test.Files (
swapFiles,
Expand Down
2 changes: 1 addition & 1 deletion lsp-test/src/Language/LSP/Test/Parsing.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module Language.LSP.Test.Parsing (
-- $receiving
Expand Down
2 changes: 1 addition & 1 deletion lsp-test/src/Language/LSP/Test/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module Language.LSP.Test.Session
( Session(..)
Expand Down
2 changes: 1 addition & 1 deletion lsp-test/test/DummyServer.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module DummyServer where

Expand Down
2 changes: 1 addition & 1 deletion lsp-test/test/Test.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

import Control.Applicative.Combinators
import Control.Concurrent
Expand Down
8 changes: 7 additions & 1 deletion lsp-types/lsp-types.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ flag force-ospath
description:
Force a version bound on filepath library, to enable 'OsPath'.

common warnings
ghc-options: -Wunused-packages

library
import: warnings
hs-source-dirs: src generated
default-language: GHC2021

Expand All @@ -53,7 +57,6 @@ library
GADTs
NegativeLiterals
OverloadedStrings
StandaloneKindSignatures
StrictData
TypeFamilies
UndecidableInstances
Expand Down Expand Up @@ -563,6 +566,7 @@ library
Language.LSP.Protocol.Internal.Types.WorkspaceOptions

library metamodel
import: warnings
-- We don't currently re-export this from the main
-- library, but it's here if people want it
visibility: public
Expand All @@ -584,6 +588,7 @@ library metamodel
, text >=1 && <2.2

library lsp-types-quickcheck
import: warnings
visibility: public
hs-source-dirs: quickcheck generated
default-language: GHC2021
Expand Down Expand Up @@ -630,6 +635,7 @@ executable generator
, witherable

test-suite lsp-types-test
import: warnings
type: exitcode-stdio-1.0
hs-source-dirs: test
default-language: GHC2021
Expand Down
1 change: 0 additions & 1 deletion lsp-types/metamodel/Language/LSP/MetaModel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Language.LSP.MetaModel (module Export, metaModel) where
import Language.LSP.MetaModel.Types as Export

import Data.FileEmbed (makeRelativeToProject)
import Language.Haskell.TH qualified as TH

-- | The metamodel used to generate the LSP types in this package.
metaModel :: MetaModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module Language.LSP.Protocol.QuickCheck.Common where
import Data.Foldable
import Data.Row qualified as R
import Data.Row.Records qualified as R
import Data.Void
import GHC.TypeLits
import Language.LSP.Protocol.Message
import Language.LSP.Protocol.Types
Expand Down
2 changes: 1 addition & 1 deletion lsp-types/src/Data/IxMap.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ViewPatterns #-}

module Data.IxMap where
Expand Down
2 changes: 1 addition & 1 deletion lsp-types/src/Language/LSP/Protocol/Message/LspId.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module Language.LSP.Protocol.Message.LspId where

Expand Down
2 changes: 1 addition & 1 deletion lsp-types/src/Language/LSP/Protocol/Message/Method.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UndecidableSuperClasses #-}
{-# OPTIONS_GHC -Wno-orphans #-}

Expand Down
2 changes: 1 addition & 1 deletion lsp-types/src/Language/LSP/Protocol/Message/Parsing.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module Language.LSP.Protocol.Message.Parsing where

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module Language.LSP.Protocol.Message.Registration where

Expand Down
2 changes: 1 addition & 1 deletion lsp-types/src/Language/LSP/Protocol/Message/Types.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

module Language.LSP.Protocol.Message.Types where

Expand Down
2 changes: 1 addition & 1 deletion lsp-types/test/JsonSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UndecidableInstances #-}
-- we're using some deprecated stuff from the LSP spec, that's fine
{-# OPTIONS_GHC -fno-warn-deprecations #-}
Expand Down
2 changes: 1 addition & 1 deletion lsp/example/Reactor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}

{- |
This is an example language server built with haskell-lsp using a 'Reactor'
Expand Down
14 changes: 9 additions & 5 deletions lsp/lsp.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ source-repository head
type: git
location: https://github.com/haskell/lsp

common warnings
ghc-options: -Wall -Wunused-packages -Wno-unticked-promoted-constructors

library
import: warnings
hs-source-dirs: src
default-language: GHC2021
ghc-options: -Wall -fprint-explicit-kinds
ghc-options: -fprint-explicit-kinds
reexported-modules:
, Language.LSP.Protocol.Types
, Language.LSP.Protocol.Lens
Expand All @@ -47,7 +51,6 @@ library
Language.LSP.Server.Core
Language.LSP.Server.Processing

ghc-options: -Wall
build-depends:
, aeson >=2 && <2.3
, async ^>=2.2
Expand Down Expand Up @@ -78,10 +81,10 @@ library
, uuid >=1.3

executable lsp-demo-reactor-server
import: warnings
main-is: Reactor.hs
hs-source-dirs: example
default-language: GHC2021
ghc-options: -Wall -Wno-unticked-promoted-constructors
build-depends:
, aeson
, base
Expand All @@ -97,10 +100,10 @@ executable lsp-demo-reactor-server
buildable: False

executable lsp-demo-simple-server
import: warnings
main-is: Simple.hs
hs-source-dirs: example
default-language: GHC2021
ghc-options: -Wall -Wno-unticked-promoted-constructors
build-depends:
, base
, lsp
Expand All @@ -115,6 +118,7 @@ flag demo
default: False

test-suite lsp-test
import: warnings
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
Expand All @@ -134,5 +138,5 @@ test-suite lsp-test
, unordered-containers

build-tool-depends: hspec-discover:hspec-discover
ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: GHC2021
2 changes: 1 addition & 1 deletion lsp/src/Language/LSP/Server/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE CUSKs #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
Expand Down
2 changes: 1 addition & 1 deletion lsp/src/Language/LSP/Server/Processing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}
-- there's just so much!
{-# OPTIONS_GHC -Wno-name-shadowing #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
Expand Down
2 changes: 1 addition & 1 deletion lsp/src/Language/LSP/VFS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeInType #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ViewPatterns #-}

{- |
Expand Down

0 comments on commit ad741d4

Please sign in to comment.