From f21140762318770ba98a9dee76012a688a0ed20b Mon Sep 17 00:00:00 2001 From: Nick Suchecki Date: Sat, 5 Mar 2022 11:44:34 -0500 Subject: [PATCH 1/7] Add change-type-signature test suite and enable alternate-number-format for 9.2 --- .github/workflows/test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ef51c971a9..f59d4b4bb9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -224,7 +224,7 @@ jobs: name: Test hls-module-name-plugin test suite run: cabal test hls-module-name-plugin --test-options="$TEST_OPTS" || cabal test hls-module-name-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-module-name-plugin --test-options="$TEST_OPTS" - - if: matrix.test && matrix.ghc != '9.2.1' + - if: matrix.test name: Test hls-alternate-number-format-plugin test suite run: cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" @@ -236,6 +236,10 @@ jobs: name: Test hls-selection-range-plugin test suite run: cabal test hls-selection-range-plugin --test-options="$TEST_OPTS" || cabal test hls-selection-range-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-selection-range-plugin --test-options="$TEST_OPTS" + - if: matrix.test + name: Test hls-change-type-signature test suite + run: cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS" || cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-change-type-signature-plugin --test-options="$TEST_OPTS" + test_post_job: if: always() runs-on: ubuntu-latest From bf2b23e13451cb39c3be1944c7218e6898bb9046 Mon Sep 17 00:00:00 2001 From: Nick Suchecki Date: Sat, 5 Mar 2022 14:14:03 -0500 Subject: [PATCH 2/7] Revert 9.2.1 enable tests for alternate-number-format --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f59d4b4bb9..a6c5b85ea1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -224,7 +224,7 @@ jobs: name: Test hls-module-name-plugin test suite run: cabal test hls-module-name-plugin --test-options="$TEST_OPTS" || cabal test hls-module-name-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-module-name-plugin --test-options="$TEST_OPTS" - - if: matrix.test + - if: matrix.test && matrix.ghc != '9.2.1' name: Test hls-alternate-number-format-plugin test suite run: cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-alternate-number-format-plugin --test-options="$TEST_OPTS" From 1f32c6af3ca7a24e538082909df5e79c361c5b94 Mon Sep 17 00:00:00 2001 From: Nick Suchecki Date: Sun, 6 Mar 2022 16:16:08 -0500 Subject: [PATCH 3/7] Clean up test file --- plugins/hls-change-type-signature-plugin/test/Main.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/hls-change-type-signature-plugin/test/Main.hs b/plugins/hls-change-type-signature-plugin/test/Main.hs index 2cfb7b35c4..849a990780 100644 --- a/plugins/hls-change-type-signature-plugin/test/Main.hs +++ b/plugins/hls-change-type-signature-plugin/test/Main.hs @@ -1,5 +1,6 @@ module Main where +import Control.Monad (void) import Data.Either (rights) import Data.Text (Text) import qualified Data.Text as T @@ -50,9 +51,6 @@ testRegexes = testGroup "Regex Testing" [ testRegexOne , testRegexTwo ] - where - regex1 = errorMessageRegexes !! 0 - regex2 = errorMessageRegexes !! 1 testRegexOne :: TestTree testRegexOne = testGroup "Regex One" [ @@ -84,7 +82,7 @@ goldenChangeSignature fp = goldenWithHaskellDoc changeTypeSignaturePlugin (fp <> codeActionTest :: FilePath -> Int -> Int -> TestTree codeActionTest fp line col = goldenChangeSignature fp $ \doc -> do - waitForDiagnostics -- code actions are triggered from Diagnostics + void $ waitForDiagnostics -- code actions are triggered from Diagnostics actions <- getCodeActions doc (pointRange line col) foundActions <- findChangeTypeActions actions liftIO $ length foundActions @?= 1 From 1eaa3e1fcace33702dec8975022dc2896d6873ed Mon Sep 17 00:00:00 2001 From: Nick Suchecki Date: Sun, 6 Mar 2022 22:56:40 -0500 Subject: [PATCH 4/7] GHC 9.2.1 test fixes --- .../src/Ide/Plugin/ChangeTypeSignature.hs | 31 ++++++------- .../test/Main.hs | 43 +++++++++++-------- .../test/testdata/TLocalBinding.expected.hs | 6 ++- .../test/testdata/TLocalBinding.hs | 4 +- .../testdata/TLocalBindingShadow1.expected.hs | 6 ++- .../test/testdata/TLocalBindingShadow1.hs | 6 ++- .../testdata/TLocalBindingShadow2.expected.hs | 6 ++- .../test/testdata/TLocalBindingShadow2.hs | 4 +- .../test/testdata/ghc921-error1.txt | 9 ++++ .../test/testdata/ghc921-error2.txt | 9 ++++ .../test/testdata/ghc921-error3.txt | 9 ++++ 11 files changed, 88 insertions(+), 45 deletions(-) create mode 100644 plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error1.txt create mode 100644 plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error2.txt create mode 100644 plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error3.txt diff --git a/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs b/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs index ff86652710..8c3c5f7f1d 100644 --- a/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs +++ b/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs @@ -11,16 +11,16 @@ import Control.Monad.IO.Class (MonadIO (liftIO)) import Control.Monad.Trans.Except (ExceptT) import Data.Foldable (asum) import qualified Data.HashMap.Strict as Map -import Data.Maybe (mapMaybe) +import Data.Maybe (isJust, mapMaybe) import Data.Text (Text) import qualified Data.Text as T -import Development.IDE (realSrcSpanToRange) +import Development.IDE (ideLogger, realSrcSpanToRange) import Development.IDE.Core.RuleTypes (GetParsedModule (GetParsedModule)) import Development.IDE.Core.Service (IdeState, runAction) -import Development.IDE.Core.Shake (use) +import Development.IDE.Core.Shake (logger, use) import Development.IDE.GHC.Compat import Development.IDE.GHC.Util (prettyPrint) -import Generics.SYB (extQ, something) +import Generics.SYB (everything, extQ, something) import Ide.PluginUtils (getNormalizedFilePath, handleMaybeM, response) import Ide.Types (PluginDescriptor (..), @@ -66,7 +66,7 @@ data ChangeSignature = ChangeSignature { , declSrcSpan :: RealSrcSpan -- | the diagnostic to solve , diagnostic :: Diagnostic - } + } -- | Constraint needed to trackdown OccNames in signatures type SigName = (HasOccName (IdP GhcPs)) @@ -99,6 +99,8 @@ errorMessageRegexes :: [Text] errorMessageRegexes = [ -- be sure to add new Error Messages Regexes at the bottom to not fail any existing tests "Expected type: (.+)\n +Actual type: (.+)\n(.|\n)+In an equation for ‘(.+)’" , "Couldn't match expected type ‘(.+)’ with actual type ‘(.+)’\n(.|\n)+In an equation for ‘(.+)’" + -- GHC >9.2 version of the first error regex + , "Expected: (.+)\n +Actual: (.+)\n(.|\n)+In an equation for ‘(.+)’" ] -- | Given a String with the name of a declaration, GHC's "Expected Type", find the declaration that matches @@ -129,25 +131,18 @@ findSigLocOfStringDecl decls expectedType declName = something (const Nothing `e compareId (L _ id') = declName == occNameString (occName id') - -- | Pretty Print the Type Signature (to validate GHC Error Message) sigToText :: Sig GhcPs -> Maybe Text sigToText = \case - ts@TypeSig {} -> stripSignature $ T.pack $ prettyPrint ts + ts@TypeSig {} -> Just $ stripSignature $ T.pack $ prettyPrint ts _ -> Nothing -stripSignature :: Text -> Maybe Text +stripSignature :: Text -> Text -- for whatever reason incoming signatures MAY have new lines after "::" or "=>" -stripSignature sig = case T.filter (/= '\n') sig =~ sigRegex :: (Text, Text, Text, [Text]) of - -- No constraints (Monad m =>) - (_, _, _, [sig']) -> Just $ T.strip sig' - -- Ignore constraints (Monad m =>) - (_, _, _, [_, sig']) -> Just $ T.strip sig' - _ -> Nothing - where - -- we want to test everthing after the constraints (GHC never gives us the constraint in the expected signature) - sigRegex = ".* :: (.*=>)?(.*)" :: Text - +stripSignature (T.filter (/= '\n') -> sig) = if T.isInfixOf " => " sig + -- remove constraints + then T.strip $ snd $ T.breakOnEnd " => " sig + else T.strip $ snd $ T.breakOnEnd " :: " sig changeSigToCodeAction :: Uri -> ChangeSignature -> Command |? CodeAction changeSigToCodeAction uri ChangeSignature{..} = InR CodeAction { _title = mkChangeSigTitle declName actualType diff --git a/plugins/hls-change-type-signature-plugin/test/Main.hs b/plugins/hls-change-type-signature-plugin/test/Main.hs index 849a990780..e20d92a6b6 100644 --- a/plugins/hls-change-type-signature-plugin/test/Main.hs +++ b/plugins/hls-change-type-signature-plugin/test/Main.hs @@ -8,25 +8,23 @@ import qualified Data.Text.IO as TIO import Ide.Plugin.ChangeTypeSignature (errorMessageRegexes) import qualified Ide.Plugin.ChangeTypeSignature as ChangeTypeSignature import System.FilePath ((<.>), ()) -import Test.Hls (CodeAction (..), - CodeActionKind (CodeActionQuickFix), - Command, IdeState, +import Test.Hls (CodeAction (..), Command, + GhcVersion (GHC92), IdeState, PluginDescriptor, Position (Position), Range (Range), Session, TestName, TestTree, TextDocumentIdentifier, - assertBool, assertFailure, + assertFailure, defaultTestRunner, executeCodeAction, getCodeActions, - goldenWithHaskellDoc, liftIO, - openDoc, runSessionWithServer, - testCase, testGroup, toEither, - type (|?) (InR), - waitForDiagnostics, - waitForProgressDone, (@=?), - (@?=)) + goldenWithHaskellDoc, + knownBrokenForGhcVersions, + liftIO, openDoc, + runSessionWithServer, testCase, + testGroup, toEither, type (|?), + waitForDiagnostics, (@?=)) import Text.Regex.TDFA ((=~)) main :: IO () @@ -37,19 +35,20 @@ changeTypeSignaturePlugin = ChangeTypeSignature.descriptor "changeTypeSignature" test :: TestTree test = testGroup "changeTypeSignature" [ - codeActionTest "TExpectedActual" 4 11 - , codeActionTest "TRigidType" 4 14 - , codeActionTest "TLocalBinding" 6 21 - , codeActionTest "TLocalBindingShadow1" 10 7 - , codeActionTest "TLocalBindingShadow2" 6 21 + testRegexes + , codeActionTest "TExpectedActual" 4 11 + , knownBrokenForGhcVersions [GHC92] "Error Message in 9.2 does not provide enough info" $ codeActionTest "TRigidType" 4 14 + , codeActionTest "TLocalBinding" 7 22 + , codeActionTest "TLocalBindingShadow1" 11 8 + , codeActionTest "TLocalBindingShadow2" 7 21 , codeActionProperties "TErrorGivenPartialSignature" [(4, 13)] $ \actions -> liftIO $ length actions @?= 0 - , testRegexes ] testRegexes :: TestTree testRegexes = testGroup "Regex Testing" [ testRegexOne , testRegexTwo + , testRegex921One ] testRegexOne :: TestTree @@ -74,6 +73,16 @@ testRegexTwo = testGroup "Regex Two" [ where regex = errorMessageRegexes !! 1 +-- test ghc-9.2.1 error message regex +testRegex921One :: TestTree +testRegex921One = testGroup "Regex One" [ + regexTest "ghc921-error1.txt" regex True + , regexTest "ghc921-error2.txt" regex True + , regexTest "ghc921-error3.txt" regex True + ] + where + regex = errorMessageRegexes !! 2 + testDataDir :: FilePath testDataDir = "test" "testdata" diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.expected.hs b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.expected.hs index 4e15704726..388cf26dd5 100644 --- a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.expected.hs +++ b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.expected.hs @@ -1,6 +1,8 @@ module TLocalBinding where +import Control.Monad (forM) + local :: Int -> Int -local x = let test :: [Int] -> Int - test = head . reverse +local x = let test :: Int -> Int + test = forM in x + 1 diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.hs b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.hs index 3937213237..388cf26dd5 100644 --- a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.hs +++ b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.hs @@ -1,6 +1,8 @@ module TLocalBinding where +import Control.Monad (forM) + local :: Int -> Int local x = let test :: Int -> Int - test = head . reverse + test = forM in x + 1 diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow1.expected.hs b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow1.expected.hs index b8a5243f18..5e7a1ce2ea 100644 --- a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow1.expected.hs +++ b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow1.expected.hs @@ -1,9 +1,11 @@ module TLocalBindingShadow1 where +import Control.Monad (forM) + local :: Int -> Int local x = let test :: Int -> Int test = (+2) in test x -test :: [Double] -> Double -test = head . reverse +test :: [Double] -> (Double -> m0 b0) -> m0 [b0] +test = forM diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow1.hs b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow1.hs index 80a2cce85e..8d7511df41 100644 --- a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow1.hs +++ b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow1.hs @@ -1,9 +1,11 @@ module TLocalBindingShadow1 where +import Control.Monad (forM) + local :: Int -> Int local x = let test :: Int -> Int test = (+2) in test x -test :: Int -> Double -test = head . reverse +test :: [Double] -> Double +test = forM diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow2.expected.hs b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow2.expected.hs index 749ebc56b1..8dcb28794c 100644 --- a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow2.expected.hs +++ b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow2.expected.hs @@ -1,8 +1,10 @@ module TLocalBindingShadow2 where +import Control.Monad (forM) + local :: Int -> Int -local x = let test :: [Int] -> Int - test = head . reverse +local x = let test :: t0 a0 -> (a0 -> m0 b0) -> m0 (t0 b0) + test = forM in test x test :: String -> String diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow2.hs b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow2.hs index c274a462bc..6db8dbbfd3 100644 --- a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow2.hs +++ b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBindingShadow2.hs @@ -1,8 +1,10 @@ module TLocalBindingShadow2 where +import Control.Monad (forM) + local :: Int -> Int local x = let test :: Int -> Int - test = head . reverse + test = forM in test x test :: String -> String diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error1.txt b/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error1.txt new file mode 100644 index 0000000000..3ade6af3da --- /dev/null +++ b/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error1.txt @@ -0,0 +1,9 @@ + • Couldn't match type ‘Data.Set.Internal.Set Int’ with ‘Int’ + Expected: Int -> [Int] + Actual: Data.Set.Internal.Set Int -> [Int] + • In the second argument of ‘(.)’, namely ‘toList’ + In the expression: head . toList + In an equation for ‘test’: test = head . toList + | +83 | test = head . toList + | ^^^^^^ diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error2.txt b/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error2.txt new file mode 100644 index 0000000000..f76fb50189 --- /dev/null +++ b/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error2.txt @@ -0,0 +1,9 @@ + • Couldn't match type ‘b0 -> a0 -> b0’ with ‘Int’ + Expected: Int -> Int + Actual: (b0 -> a0 -> b0) -> b0 -> t0 a0 -> b0 + • Probable cause: ‘foldl’ is applied to too few arguments + In the expression: foldl + In an equation for ‘test’: test = foldl + | +83 | test = foldl + | diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error3.txt b/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error3.txt new file mode 100644 index 0000000000..5b5adc1e8b --- /dev/null +++ b/plugins/hls-change-type-signature-plugin/test/testdata/ghc921-error3.txt @@ -0,0 +1,9 @@ + • Couldn't match type ‘[Int]’ with ‘Int’ + Expected: Int -> [Int] + Actual: [Int] -> [Int] + • In the second argument of ‘(.)’, namely ‘reverse’ + In the expression: head . reverse + In an equation for ‘test’: test = head . reverse + | +84 | test = head . reverse + | From 059522e32109c07e66ae0baa294ac57bdadf7862 Mon Sep 17 00:00:00 2001 From: Nick Suchecki Date: Sun, 6 Mar 2022 22:59:11 -0500 Subject: [PATCH 5/7] -Wall fixes --- .../src/Ide/Plugin/ChangeTypeSignature.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs b/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs index 8c3c5f7f1d..7de639c13c 100644 --- a/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs +++ b/plugins/hls-change-type-signature-plugin/src/Ide/Plugin/ChangeTypeSignature.hs @@ -11,16 +11,16 @@ import Control.Monad.IO.Class (MonadIO (liftIO)) import Control.Monad.Trans.Except (ExceptT) import Data.Foldable (asum) import qualified Data.HashMap.Strict as Map -import Data.Maybe (isJust, mapMaybe) +import Data.Maybe (mapMaybe) import Data.Text (Text) import qualified Data.Text as T -import Development.IDE (ideLogger, realSrcSpanToRange) +import Development.IDE (realSrcSpanToRange) import Development.IDE.Core.RuleTypes (GetParsedModule (GetParsedModule)) import Development.IDE.Core.Service (IdeState, runAction) -import Development.IDE.Core.Shake (logger, use) +import Development.IDE.Core.Shake (use) import Development.IDE.GHC.Compat import Development.IDE.GHC.Util (prettyPrint) -import Generics.SYB (everything, extQ, something) +import Generics.SYB (extQ, something) import Ide.PluginUtils (getNormalizedFilePath, handleMaybeM, response) import Ide.Types (PluginDescriptor (..), From 28bcf8c9722d1801bd2ca53897f1bcf072c4ac48 Mon Sep 17 00:00:00 2001 From: Nick Suchecki Date: Mon, 7 Mar 2022 08:42:01 -0500 Subject: [PATCH 6/7] Add to fix test failures --- plugins/hls-change-type-signature-plugin/test/Main.hs | 4 +++- .../test/testdata/TLocalBinding.expected.hs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/hls-change-type-signature-plugin/test/Main.hs b/plugins/hls-change-type-signature-plugin/test/Main.hs index e20d92a6b6..d3f3b72a5c 100644 --- a/plugins/hls-change-type-signature-plugin/test/Main.hs +++ b/plugins/hls-change-type-signature-plugin/test/Main.hs @@ -24,6 +24,7 @@ import Test.Hls (CodeAction (..), Command, liftIO, openDoc, runSessionWithServer, testCase, testGroup, toEither, type (|?), + waitForAllProgressDone, waitForDiagnostics, (@?=)) import Text.Regex.TDFA ((=~)) @@ -40,7 +41,7 @@ test = testGroup "changeTypeSignature" [ , knownBrokenForGhcVersions [GHC92] "Error Message in 9.2 does not provide enough info" $ codeActionTest "TRigidType" 4 14 , codeActionTest "TLocalBinding" 7 22 , codeActionTest "TLocalBindingShadow1" 11 8 - , codeActionTest "TLocalBindingShadow2" 7 21 + , codeActionTest "TLocalBindingShadow2" 7 22 , codeActionProperties "TErrorGivenPartialSignature" [(4, 13)] $ \actions -> liftIO $ length actions @?= 0 ] @@ -92,6 +93,7 @@ goldenChangeSignature fp = goldenWithHaskellDoc changeTypeSignaturePlugin (fp <> codeActionTest :: FilePath -> Int -> Int -> TestTree codeActionTest fp line col = goldenChangeSignature fp $ \doc -> do void $ waitForDiagnostics -- code actions are triggered from Diagnostics + void $ waitForAllProgressDone -- apparently some tests need this to get the CodeAction to show up actions <- getCodeActions doc (pointRange line col) foundActions <- findChangeTypeActions actions liftIO $ length foundActions @?= 1 diff --git a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.expected.hs b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.expected.hs index 388cf26dd5..dcff692d2c 100644 --- a/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.expected.hs +++ b/plugins/hls-change-type-signature-plugin/test/testdata/TLocalBinding.expected.hs @@ -3,6 +3,6 @@ module TLocalBinding where import Control.Monad (forM) local :: Int -> Int -local x = let test :: Int -> Int +local x = let test :: t0 a0 -> (a0 -> m0 b0) -> m0 (t0 b0) test = forM in x + 1 From 7f916f41cadf0719b760147162e8d000a0379b81 Mon Sep 17 00:00:00 2001 From: Nick Suchecki Date: Mon, 7 Mar 2022 11:31:29 -0500 Subject: [PATCH 7/7] Bump Version --- plugins/hls-change-type-signature-plugin/README.md | 5 +++++ .../hls-change-type-signature-plugin.cabal | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/hls-change-type-signature-plugin/README.md b/plugins/hls-change-type-signature-plugin/README.md index 0c93f53296..f0766e7f86 100644 --- a/plugins/hls-change-type-signature-plugin/README.md +++ b/plugins/hls-change-type-signature-plugin/README.md @@ -14,3 +14,8 @@ If the plugin receives enough information it can correctly change the signature. ## Changelog ### 1.0.0.0 - First Release + +### 1.0.1.0 +- Fix 9.2 Test failures (`waitForProgressDone`) +- Add extra test scenarios for error message diffs in 9.2 +- Remove regex parsing for simple `Text` manipulation diff --git a/plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal b/plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal index 64bc9b8a4a..25214d8bd7 100644 --- a/plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal +++ b/plugins/hls-change-type-signature-plugin/hls-change-type-signature-plugin.cabal @@ -1,6 +1,6 @@ cabal-version: 2.4 name: hls-change-type-signature-plugin -version: 1.0.0.0 +version: 1.0.1.0 synopsis: Change a declarations type signature with a Code Action description: Please see the README on GitHub at