Skip to content

Commit 418edd5

Browse files
committed
Mark unused-binding diagnostic test broken on GHC 9.6
TcRnUnusedName gained structured provenance only in GHC 9.8, so 9.6 cannot identify unused top-level binds to attach the action to.
1 parent b687332 commit 418edd5

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

plugins/hls-export-plugin/src/Ide/Plugin/Export.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import Development.IDE.Core.PluginUtils (runActionE, useE)
1313
import Development.IDE.Core.Shake (getDiagnostics)
1414
import Development.IDE.GHC.Compat
1515
-- TcRnUnusedName (and its provenance) only became a structured diagnostic in
16-
-- GHC 9.8. On 9.6 we cannot single out unused top-level binds this way.
16+
-- GHC 9.8 (GHC #20115, MR !10350). On 9.6 we cannot single out unused top-level
17+
-- binds this way.
1718
#if MIN_VERSION_ghc(9,8,0)
1819
import Development.IDE.GHC.Compat.Error (_TcRnMessage,
1920
msgEnvelopeErrorL)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,9 @@ main = defaultTestRunner $ testGroup "Export"
265265
]
266266

267267
, testGroup "Export fixes the unused-binding warning"
268-
[ testCase "Export action attaches the -Wunused-top-binds diagnostic" $ runExport $ \_dir -> do
268+
[ knownBrokenForGhcVersions [GHC96]
269+
"TcRnUnusedName provenance is unstructured before GHC 9.8 (GHC #20115)" $
270+
testCase "Export action attaches the -Wunused-top-binds diagnostic" $ runExport $ \_dir -> do
269271
doc <- openDoc "ExportUnusedFix.hs" "haskell"
270272
waitForKickDone
271273
actions <- rights . map toEither <$> getCodeActions doc (rangeAt 6 0) -- on `unused`

0 commit comments

Comments
 (0)