From c556c7be8180e38471e8ba0c8710fb73e6c7e18d Mon Sep 17 00:00:00 2001 From: Lei Zhu Date: Sun, 16 Oct 2022 22:22:09 +0800 Subject: [PATCH] Support 9.4 --- .github/workflows/test.yml | 2 +- cabal.project | 7 ++++++- haskell-language-server.cabal | 4 ++-- plugins/hls-hlint-plugin/hls-hlint-plugin.cabal | 10 +--------- plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs | 5 ++++- plugins/hls-hlint-plugin/test/Main.hs | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78bcf83e15..f045446c43 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -221,7 +221,7 @@ jobs: name: Test hls-rename-plugin test suite run: cabal test hls-rename-plugin --test-options="$TEST_OPTS" || cabal test hls-rename-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-rename-plugin --test-options="$TEST_OPTS" - - if: matrix.test && matrix.ghc != '9.4.2' + - if: matrix.test name: Test hls-hlint-plugin test suite run: cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || cabal test hls-hlint-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-hlint-plugin --test-options="$TEST_OPTS" diff --git a/cabal.project b/cabal.project index 2a2ee425a6..85e6f63272 100644 --- a/cabal.project +++ b/cabal.project @@ -48,7 +48,7 @@ package * write-ghc-environment-files: never -index-state: 2022-09-14T16:53:13Z +index-state: 2022-10-07T12:19:15Z constraints: -- For GHC 9.4, older versions of entropy fail to build on Windows @@ -76,6 +76,11 @@ source-repository-package -- https://github.com/tibbe/ekg-json/pull/12 -- END DELETE +source-repository-package + type: git + location: https://github.com/July541/apply-refact.git + tag: dcaa4904f002280fe4a9590e9a2792d3a6bac489 + allow-newer: -- ghc-9.4 Chart-diagrams:lens, diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index d44b072928..4d9745b554 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -246,7 +246,7 @@ common tactic cpp-options: -Dhls_tactic common hlint - if flag(hlint) && (impl(ghc < 9.4.1) || flag(ignore-plugins-ghc-bounds)) + if flag(hlint) build-depends: hls-hlint-plugin ^>= 1.1 cpp-options: -Dhls_hlint @@ -271,7 +271,7 @@ common splice cpp-options: -Dhls_splice common alternateNumberFormat - if flag(alternateNumberFormat) + if flag(alternateNumberFormat) build-depends: hls-alternate-number-format-plugin ^>= 1.2 cpp-options: -Dhls_alternateNumberFormat diff --git a/plugins/hls-hlint-plugin/hls-hlint-plugin.cabal b/plugins/hls-hlint-plugin/hls-hlint-plugin.cabal index a29c40e033..cc3c8c23b5 100644 --- a/plugins/hls-hlint-plugin/hls-hlint-plugin.cabal +++ b/plugins/hls-hlint-plugin/hls-hlint-plugin.cabal @@ -30,10 +30,6 @@ flag pedantic manual: True library - if impl(ghc >= 9.3) - buildable: False - else - buildable: True exposed-modules: Ide.Plugin.Hlint hs-source-dirs: src build-depends: @@ -51,7 +47,7 @@ library , ghc-exactprint >=0.6.3.4 , ghcide ^>=1.8 , hashable - , hlint < 3.5 + , hlint < 3.6 , hls-plugin-api ^>=1.5 , hslogger , lens @@ -81,10 +77,6 @@ library TypeOperators test-suite tests - if impl(ghc >= 9.3) - buildable: False - else - buildable: True type: exitcode-stdio-1.0 default-language: Haskell2010 hs-source-dirs: test diff --git a/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs b/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs index 9f75dff9f3..3119371c4f 100644 --- a/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs +++ b/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs @@ -68,6 +68,9 @@ import Development.IDE.GHC.Compat (DynFlags, wopt) import qualified Development.IDE.GHC.Compat.Util as EnumSet +#if MIN_GHC_API_VERSION(9,4,0) +import qualified "ghc-lib-parser" GHC.Data.Strict as Strict +#endif #if MIN_GHC_API_VERSION(9,0,0) import "ghc-lib-parser" GHC.Types.SrcLoc hiding (RealSrcSpan) @@ -157,7 +160,7 @@ instance Pretty Log where #if !MIN_GHC_API_VERSION(9,0,0) type BufSpan = () #endif -pattern RealSrcSpan :: GHC.RealSrcSpan -> Maybe BufSpan -> GHC.SrcSpan +pattern RealSrcSpan :: GHC.RealSrcSpan -> Strict.Maybe BufSpan -> GHC.SrcSpan #if MIN_GHC_API_VERSION(9,0,0) pattern RealSrcSpan x y = GHC.RealSrcSpan x y #else diff --git a/plugins/hls-hlint-plugin/test/Main.hs b/plugins/hls-hlint-plugin/test/Main.hs index ee1ab380d6..49bd1555ca 100644 --- a/plugins/hls-hlint-plugin/test/Main.hs +++ b/plugins/hls-hlint-plugin/test/Main.hs @@ -181,11 +181,11 @@ suggestionsTests = doc <- openDoc "IgnoreAnnHlint.hs" "haskell" expectNoMoreDiagnostics 3 doc "hlint" - , knownBrokenForGhcVersions [GHC92] "apply-refact has different behavior on v0.10" $ + , knownBrokenForGhcVersions [GHC92, GHC94] "apply-refact has different behavior on v0.10+" $ testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do testRefactor "Comments.hs" "Redundant bracket" expectedComments - , onlyRunForGhcVersions [GHC92] "only run test for apply-refact-0.10" $ + , onlyRunForGhcVersions [GHC92, GHC94] "only run test for apply-refact-0.10+" $ testCase "apply-refact preserve regular comments" $ runHlintSession "" $ do testRefactor "Comments.hs" "Redundant bracket" expectedComments'