Skip to content

Commit 3290d18

Browse files
committed
Don't use CPP at all
1 parent 4894c0d commit 3290d18

File tree

2 files changed

+30
-37
lines changed

2 files changed

+30
-37
lines changed

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

Lines changed: 6 additions & 1 deletion
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
@@ -93,10 +97,11 @@ library
9397
-- FIXME: Only needed to workaround for qualified imports in GHC 9.4
9498
, regex-applicative
9599
, parser-combinators
96-
ghc-options: -Wall -Wno-name-shadowing
100+
ghc-options: -Wno-name-shadowing
97101
default-language: Haskell2010
98102

99103
test-suite tests
104+
import: warnings
100105
if impl(ghc >= 9.8)
101106
buildable: False
102107
else

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

Lines changed: 24 additions & 36 deletions
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_GLASGOW_HASKELL(9,4,0,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_GLASGOW_HASKELL(9,4,0,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_GLASGOW_HASKELL(9,4,0,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_GLASGOW_HASKELL(9,4,0,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_GLASGOW_HASKELL(9,4,0,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_GLASGOW_HASKELL(9,4,0,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)