@@ -669,10 +669,11 @@ removeImportTests = testGroup "remove import actions"
669 , "main = print stuffB"
669 , "main = print stuffB"
671 liftIO $ expectedContentAfterAction @=? contentAfterAction
671 liftIO $ expectedContentAfterAction @=? contentAfterAction
672− , testSession "redundant symbol binding" $ do
672+ , testSession "redundant operator" $ do
673 let contentA = T.unlines
673 let contentA = T.unlines
674 [ "module ModuleA where"
674 [ "module ModuleA where"
675 , "a !! b = a"
675 , "a !! b = a"
676 , "stuffB :: Integer"
677 , "stuffB :: Integer"
677 , "stuffB = 123"
678 , "stuffB = 123"
@@ -680,7 +681,7 @@ removeImportTests = testGroup "remove import actions"
680 let contentB = T.unlines
681 let contentB = T.unlines
681 [ "{-# OPTIONS_GHC -Wunused-imports #-}"
682 [ "{-# OPTIONS_GHC -Wunused-imports #-}"
682 , "module ModuleB where"
683 , "module ModuleB where"
683− , "import qualified ModuleA as A ((!!), stuffB, (!!))"
684+ , "import qualified ModuleA as A ((<?>), stuffB, (!!))"
684 , "main = print A.stuffB"
685 , "main = print A.stuffB"
686 docB <- openDoc' "ModuleB.hs" "haskell" contentB
687 docB <- openDoc' "ModuleB.hs" "haskell" contentB
@@ -688,9 +689,9 @@ removeImportTests = testGroup "remove import actions"
688 [CACodeAction action@CodeAction { _title = actionTitle }]
689 [CACodeAction action@CodeAction { _title = actionTitle }]
689 <- getCodeActions docB (Range (Position 2 0) (Position 2 5))
690 <- getCodeActions docB (Range (Position 2 0) (Position 2 5))
690#if MIN_GHC_API_VERSION(8,6,0)
691#if MIN_GHC_API_VERSION(8,6,0)
691− liftIO $ "Remove !! from import" @=? actionTitle
692+ liftIO $ "Remove !!, <?> from import" @=? actionTitle
693− liftIO $ "Remove A.!! from import" @=? actionTitle
694+ liftIO $ "Remove A.!!, A.<?> from import" @=? actionTitle
695 executeCodeAction action
696 executeCodeAction action
696 contentAfterAction <- documentContents docB
697 contentAfterAction <- documentContents docB
@@ -701,7 +702,7 @@ removeImportTests = testGroup "remove import actions"
701 , "main = print A.stuffB"
702 , "main = print A.stuffB"
703 liftIO $ expectedContentAfterAction @=? contentAfterAction
704 liftIO $ expectedContentAfterAction @=? contentAfterAction
704− , (`xfail` "known broken (#299)") $ testSession "redundant hierarchical import" $ do
705+ , testSession "redundant all import" $ do
705 let contentA = T.unlines
706 let contentA = T.unlines
706 [ "module ModuleA where"
707 [ "module ModuleA where"
707 , "data A = A"
708 , "data A = A"
@@ -729,6 +730,33 @@ removeImportTests = testGroup "remove import actions"
729 , "main = print stuffB"
730 , "main = print stuffB"
731 liftIO $ expectedContentAfterAction @=? contentAfterAction
732 liftIO $ expectedContentAfterAction @=? contentAfterAction
733+ , testSession "redundant constructor import" $ do
734+ let contentA = T.unlines
735+ [ "module ModuleA where"
739+ _docA <- openDoc' "ModuleA.hs" "haskell" contentA
740+ let contentB = T.unlines
741+ [ "{-# OPTIONS_GHC -Wunused-imports #-}"
742+ , "module ModuleB where"
743+ , "import ModuleA (D(A,B), E(F))"
746+ docB <- openDoc' "ModuleB.hs" "haskell" contentB
747+ _ <- waitForDiagnostics
748+ [CACodeAction action@CodeAction { _title = actionTitle }]
749+ <- getCodeActions docB (Range (Position 2 0) (Position 2 5))
750+ liftIO $ "Remove A, E, F from import" @=? actionTitle
751+ executeCodeAction action
752+ contentAfterAction <- documentContents docB
753+ let expectedContentAfterAction = T.unlines
754+ [ "{-# OPTIONS_GHC -Wunused-imports #-}"
755+ , "module ModuleB where"
756+ , "import ModuleA (D(B))"
759+ liftIO $ expectedContentAfterAction @=? contentAfterAction
734extendImportTests :: TestTree
762extendImportTests :: TestTree