Skip to content

Commit c113a8b

Browse files
authored
Remove unused dependencies in hls-refactor-plugin (haskell#3953)
* Remove unused dependencies in hls-refactor-plugin * Don't use CPP at all
1 parent 66c12c7 commit c113a8b

File tree

2 files changed

+30
-46
lines changed

2 files changed

+30
-46
lines changed

plugins/hls-refactor-plugin/hls-refactor-plugin.cabal

+6-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ source-repository head
2121
type: git
2222
location: https://github.com/haskell/haskell-language-server.git
2323

24+
common warnings
25+
ghc-options: -Wall -Wunused-packages
26+
2427
library
28+
import: warnings
2529
-- Plugins that need exactprint have not been updated for 9.8 yet
2630
if impl(ghc >= 9.8)
2731
buildable: False
@@ -66,7 +70,6 @@ library
6670
ViewPatterns
6771
hs-source-dirs: src
6872
build-depends:
69-
, aeson
7073
, base >=4.12 && <5
7174
, ghc
7275
, bytestring
@@ -94,10 +97,11 @@ library
9497
-- FIXME: Only needed to workaround for qualified imports in GHC 9.4
9598
, regex-applicative
9699
, parser-combinators
97-
ghc-options: -Wall -Wno-name-shadowing
100+
ghc-options: -Wno-name-shadowing
98101
default-language: Haskell2010
99102

100103
test-suite tests
104+
import: warnings
101105
if impl(ghc >= 9.8)
102106
buildable: False
103107
else
@@ -116,25 +120,17 @@ test-suite tests
116120
, lens
117121
, lsp-types
118122
, text
119-
, aeson
120123
, hls-plugin-api
121124
, parser-combinators
122125
, data-default
123126
, extra
124-
, text-rope
125-
, containers
126-
-- ghc is included to enable the MIN_VERSION_ghc macro
127-
, ghc
128127
, ghcide
129128
, ghcide-test-utils
130129
, shake
131130
, hls-plugin-api
132131
, lsp-test
133-
, network-uri
134132
, directory
135-
, async
136133
, regex-tdfa
137-
, tasty-rerun
138134
, tasty-hunit
139135
, tasty-expected-failure
140136
, tasty

plugins/hls-refactor-plugin/test/Main.hs

+24-36
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
{-# LANGUAGE DataKinds #-}
44
{-# LANGUAGE DuplicateRecordFields #-}
55
{-# LANGUAGE GADTs #-}
6-
{-# LANGUAGE ImplicitParams #-}
76
{-# LANGUAGE LambdaCase #-}
8-
{-# LANGUAGE MultiWayIf #-}
97
{-# LANGUAGE NamedFieldPuns #-}
108
{-# LANGUAGE OverloadedStrings #-}
119
{-# LANGUAGE PatternSynonyms #-}
@@ -2388,11 +2386,9 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
23882386
, ""
23892387
, "f = 1"
23902388
])
2391-
#if MIN_VERSION_ghc(9,4,0)
2392-
[ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the type variable") ]
2393-
#else
2394-
[ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the following constraint") ]
2395-
#endif
2389+
(if ghcVersion >= GHC94
2390+
then [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the type variable") ]
2391+
else [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the following constraint") ])
23962392
"Add type annotation ‘Integer’ to ‘1’"
23972393
(T.unlines [ "{-# OPTIONS_GHC -Wtype-defaults #-}"
23982394
, "module A (f) where"
@@ -2409,11 +2405,9 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
24092405
, " let x = 3"
24102406
, " in x"
24112407
])
2412-
#if MIN_VERSION_ghc(9,4,0)
2413-
[ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the type variable") ]
2414-
#else
2415-
[ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the following constraint") ]
2416-
#endif
2408+
(if ghcVersion >= GHC94
2409+
then [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the type variable") ]
2410+
else [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the following constraint") ])
24172411
"Add type annotation ‘Integer’ to ‘3’"
24182412
(T.unlines [ "{-# OPTIONS_GHC -Wtype-defaults #-}"
24192413
, "module A where"
@@ -2431,11 +2425,9 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
24312425
, " let x = let y = 5 in y"
24322426
, " in x"
24332427
])
2434-
#if MIN_VERSION_ghc(9,4,0)
2435-
[ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the type variable") ]
2436-
#else
2437-
[ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the following constraint") ]
2438-
#endif
2428+
(if ghcVersion >= GHC94
2429+
then [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the type variable") ]
2430+
else [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the following constraint") ])
24392431
"Add type annotation ‘Integer’ to ‘5’"
24402432
(T.unlines [ "{-# OPTIONS_GHC -Wtype-defaults #-}"
24412433
, "module A where"
@@ -2454,15 +2446,15 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
24542446
, ""
24552447
, "f = seq \"debug\" traceShow \"debug\""
24562448
])
2457-
#if MIN_VERSION_ghc(9,4,0)
2458-
[ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the type variable")
2459-
, (DiagnosticSeverity_Warning, (6, 16), "Defaulting the type variable")
2460-
]
2461-
#else
2462-
[ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the following constraint")
2463-
, (DiagnosticSeverity_Warning, (6, 16), "Defaulting the following constraint")
2464-
]
2465-
#endif
2449+
(if ghcVersion >= GHC94
2450+
then
2451+
[ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the type variable")
2452+
, (DiagnosticSeverity_Warning, (6, 16), "Defaulting the type variable")
2453+
]
2454+
else
2455+
[ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the following constraint")
2456+
, (DiagnosticSeverity_Warning, (6, 16), "Defaulting the following constraint")
2457+
])
24662458
("Add type annotation ‘" <> listOfChar <> "’ to ‘\"debug\"")
24672459
(T.unlines [ "{-# OPTIONS_GHC -Wtype-defaults #-}"
24682460
, "{-# LANGUAGE OverloadedStrings #-}"
@@ -2482,11 +2474,9 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
24822474
, ""
24832475
, "f a = traceShow \"debug\" a"
24842476
])
2485-
#if MIN_VERSION_ghc(9,4,0)
2486-
[ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the type variable") ]
2487-
#else
2488-
[ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the following constraint") ]
2489-
#endif
2477+
(if ghcVersion >= GHC94
2478+
then [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the type variable") ]
2479+
else [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the following constraint") ])
24902480
("Add type annotation ‘" <> listOfChar <> "’ to ‘\"debug\"")
24912481
(T.unlines [ "{-# OPTIONS_GHC -Wtype-defaults #-}"
24922482
, "{-# LANGUAGE OverloadedStrings #-}"
@@ -2506,11 +2496,9 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
25062496
, ""
25072497
, "f = seq (\"debug\" :: [Char]) (seq (\"debug\" :: [Char]) (traceShow \"debug\"))"
25082498
])
2509-
#if MIN_VERSION_ghc(9,4,0)
2510-
[ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the type variable") ]
2511-
#else
2512-
[ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the following constraint") ]
2513-
#endif
2499+
(if ghcVersion >= GHC94
2500+
then [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the type variable") ]
2501+
else [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the following constraint") ])
25142502
("Add type annotation ‘" <> listOfChar <> "’ to ‘\"debug\"")
25152503
(T.unlines [ "{-# OPTIONS_GHC -Wtype-defaults #-}"
25162504
, "{-# LANGUAGE OverloadedStrings #-}"

0 commit comments

Comments
 (0)