Skip to content

Commit f335001

Browse files
committed
Don't suggest -Wno-deferred-out-of-scope-variables
Fixes haskell#4440
1 parent d923d82 commit f335001

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

plugins/hls-pragmas-plugin/src/Ide/Plugin/Pragmas.hs

+6-2
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,13 @@ suggestDisableWarning Diagnostic {_code}
126126
pure ("Disable \"" <> w <> "\" warnings", OptGHC w)
127127
| otherwise = []
128128

129-
-- Don't suggest disabling type errors as a solution to all type errors
130129
warningBlacklist :: [T.Text]
131-
warningBlacklist = ["deferred-type-errors"]
130+
warningBlacklist =
131+
-- Don't suggest disabling type errors as a solution to all type errors.
132+
[ "deferred-type-errors"
133+
-- Don't suggest disabling out of scope errors as a solution to all out of scope errors.
134+
, "deferred-out-of-scope-variables"
135+
]
132136

133137
-- ---------------------------------------------------------------------
134138

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

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ codeActionTests' =
114114
cas <- map fromAction <$> getAllCodeActions doc
115115
liftIO $ "Disable \"deferred-type-errors\" warnings" `notElem` map (^. L.title) cas @? "Doesn't contain deferred-type-errors code action"
116116
liftIO $ length cas == 0 @? "Expected no code actions, but got: " <> show cas
117+
, goldenWithPragmas pragmasSuggestPlugin "doesn't suggest disabling out of scope variables" "DeferredOutOfScopeVariables" $ \doc -> do
118+
_ <- waitForDiagnosticsFrom doc
119+
cas <- map fromAction <$> getAllCodeActions doc
120+
liftIO $ "Disable \"deferred-out-of-scope-variables\" warnings" `notElem` map (^. L.title) cas @? "Doesn't contain deferred-out-of-scope-variables code action"
121+
liftIO $ length cas == 0 @? "Expected no code actions, but got: " <> show cas
117122
]
118123

119124
completionTests :: TestTree
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module DeferredOutOfScopeVariables where
2+
3+
f :: ()
4+
f = let x = Doesn'tExist
5+
in undefined
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module DeferredOutOfScopeVariables where
2+
3+
f :: ()
4+
f = let x = Doesn'tExist
5+
in undefined

0 commit comments

Comments
 (0)