From 30994b80a52f6b491c2fa5a7ddf7f83be5200a99 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 22:27:44 +0100 Subject: [PATCH 01/53] Enable brittany for ghc-9.0.2 --- stack-9.0.2.yaml | 3 +-- stack-9.2.1.yaml | 35 ++++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/stack-9.0.2.yaml b/stack-9.0.2.yaml index 8a6fc004b3..d83a76ce85 100644 --- a/stack-9.0.2.yaml +++ b/stack-9.0.2.yaml @@ -20,7 +20,7 @@ packages: - ./plugins/hls-retrie-plugin - ./plugins/hls-splice-plugin # - ./plugins/hls-tactics-plugin -# - ./plugins/hls-brittany-plugin +- ./plugins/hls-brittany-plugin # - ./plugins/hls-stylish-haskell-plugin - ./plugins/hls-floskell-plugin - ./plugins/hls-fourmolu-plugin @@ -101,7 +101,6 @@ flags: ignore-plugins-ghc-bounds: true tactic: false # Dependencies fail stylishHaskell: false - brittany: false retrie: BuildExecutable: false diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 597fd8b587..6338ab9305 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -23,18 +23,24 @@ packages: # - ./plugins/hls-tactics-plugin # - ./plugins/hls-brittany-plugin # - ./plugins/hls-stylish-haskell-plugin -# - ./plugins/hls-floskell-plugin -# - ./plugins/hls-fourmolu-plugin +- ./plugins/hls-floskell-plugin +- ./plugins/hls-fourmolu-plugin - ./plugins/hls-pragmas-plugin - ./plugins/hls-module-name-plugin -# - ./plugins/hls-ormolu-plugin +- ./plugins/hls-ormolu-plugin # - ./plugins/hls-alternate-number-format-plugin extra-deps: - +- aeson-2.0.3.0 +- base-compat-0.12.1 +- base-compat-batteries-0.12.1 +- brittany-0.14.0.0 +- butcher-1.3.3.2 - bytestring-encoding-0.1.1.0 +- data-tree-print-0.1.0.2 - dependent-map-0.4.0.0 -- extra-1.7.9 # for ghcide, https://github.com/haskell/haskell-language-server/pull/2131 +- dependent-sum-0.7.1.0 +- extra-1.7.10 - hspec-2.7.10 # for hls-test-utils - hspec-core-2.7.10 # for hls-test-utils - some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66 @@ -42,8 +48,9 @@ extra-deps: - heapsize-0.3.0.1 - hiedb-0.4.1.0 - implicit-hie-0.1.2.6 -- implicit-hie-cradle-0.5.0.0 +- implicit-hie-cradle-0.3.0.5 - monad-dijkstra-0.1.1.3 +- multistate-0.8.0.3 - retrie-1.1.0.0 - unix-compat-0.5.4 @@ -65,11 +72,13 @@ extra-deps: - primitive-extras-0.10.1.4 # boot libraries -- Cabal-3.6.2.0 -- directory-1.3.7.0 +- Cabal-3.6.0.0 +- directory-1.3.6.2 - ghc-boot-9.2.1 - process-1.6.13.2 -- time-1.12.1 +- time-1.9.3 +- unix-2.7.2.2 +- Win32-2.12.0.1 # currently needed for ghcide>extra, etc. allow-newer: true @@ -92,20 +101,20 @@ flags: ignore-plugins-ghc-bounds: true alternateNumberFormat: false brittany: false - callhierarchy: false class: false eval: false - floskell: false - fourmolu: false haddockComments: false hlint: false +<<<<<<< HEAD importLens: false ormolu: false +======= + refineImports: false +>>>>>>> 46fcf65f (Enable brittany for ghc-9.0.2) retrie: false splice: false stylishhaskell: false tactic: false - importLens: false retrie: BuildExecutable: false From 442446dd7b3c7d3eea8cb486a43b89e536b10cdd Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 16 Jan 2022 23:16:59 +0100 Subject: [PATCH 02/53] Make works using cabal freeze --- stack-9.2.1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 6338ab9305..88fef627a8 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -48,7 +48,7 @@ extra-deps: - heapsize-0.3.0.1 - hiedb-0.4.1.0 - implicit-hie-0.1.2.6 -- implicit-hie-cradle-0.3.0.5 +- implicit-hie-cradle-0.5.0.0 - monad-dijkstra-0.1.1.3 - multistate-0.8.0.3 - retrie-1.1.0.0 From 87dd04dc5688868a6f0f01e3d30f9fe5e7b5fa2a Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 07:57:56 +0100 Subject: [PATCH 03/53] Add stack 9.2.1 to ci --- .circleci/config.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index faae427dbe..b0f465db57 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -105,6 +105,11 @@ jobs: - STACK_FILE: "stack-9.0.2.yaml" <<: *defaults + ghc-9.2.1: + environment: + - STACK_FILE: "stack-9.2.1.yaml" + <<: *defaults + ghc-default: environment: - STACK_FILE: "stack.yaml" @@ -121,4 +126,5 @@ workflows: - ghc-8.10.7 - ghc-9.0.1 - ghc-9.0.2 + - ghc-9.2.1 - ghc-default From 0aafc172883cabcd362c3a1394d61588fd9bf658 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 07:59:58 +0100 Subject: [PATCH 04/53] Use new *molu versions --- stack-9.2.1.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 88fef627a8..a104d3c872 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -41,6 +41,7 @@ extra-deps: - dependent-map-0.4.0.0 - dependent-sum-0.7.1.0 - extra-1.7.10 +- fourmolu-0.5.0.0 - hspec-2.7.10 # for hls-test-utils - hspec-core-2.7.10 # for hls-test-utils - some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66 @@ -51,6 +52,7 @@ extra-deps: - implicit-hie-cradle-0.5.0.0 - monad-dijkstra-0.1.1.3 - multistate-0.8.0.3 +- ormolu-0.4.0.0 - retrie-1.1.0.0 - unix-compat-0.5.4 From 5585caeb25c492c2d44f8b7e18602cd656263886 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 08:17:01 +0100 Subject: [PATCH 05/53] Enable rename for stack 9.2.1 --- stack-9.2.1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index a104d3c872..043f590c02 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -17,7 +17,7 @@ packages: - ./plugins/hls-qualify-imported-names-plugin # - ./plugins/hls-refine-imports-plugin # - ./plugins/hls-hlint-plugin -# - ./plugins/hls-rename-plugin +- ./plugins/hls-rename-plugin # - ./plugins/hls-retrie-plugin # - ./plugins/hls-splice-plugin # - ./plugins/hls-tactics-plugin From 54329f890c423f24b5fb9d18378615e6a8844c7d Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 08:34:58 +0100 Subject: [PATCH 06/53] Use last ghc-lib --- stack-9.2.1.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 043f590c02..473cfef1ef 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -42,6 +42,9 @@ extra-deps: - dependent-sum-0.7.1.0 - extra-1.7.10 - fourmolu-0.5.0.0 +- ghc-lib-9.2.1.20220109 +- ghc-lib-parser-9.2.1.20220109 +- ghc-lib-parser-ex-9.2.0.1 - hspec-2.7.10 # for hls-test-utils - hspec-core-2.7.10 # for hls-test-utils - some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66 From 9294146a69f0df711a2297e54ada17cd85b5d037 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 09:28:29 +0100 Subject: [PATCH 07/53] Use correct boot pkgs --- stack-9.2.1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 473cfef1ef..caf9e7672d 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -81,7 +81,7 @@ extra-deps: - directory-1.3.6.2 - ghc-boot-9.2.1 - process-1.6.13.2 -- time-1.9.3 +- time-1.11.1.1 - unix-2.7.2.2 - Win32-2.12.0.1 From 7899e437d01f092df1d53b0ba490e83fc112cc7c Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 11:44:07 +0100 Subject: [PATCH 08/53] Use last ghc-exactprint --- stack-9.2.1.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index caf9e7672d..b04fbc5ffd 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -42,6 +42,7 @@ extra-deps: - dependent-sum-0.7.1.0 - extra-1.7.10 - fourmolu-0.5.0.0 +- ghc-exactprint-1.4.1 - ghc-lib-9.2.1.20220109 - ghc-lib-parser-9.2.1.20220109 - ghc-lib-parser-ex-9.2.0.1 From eb52367fd09cc8c5b7f23250bf4769e2b699f809 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 12:33:37 +0100 Subject: [PATCH 09/53] Reorganize and use lens-5.1 --- stack-9.2.1.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index b04fbc5ffd..289fd38c4e 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -41,23 +41,24 @@ extra-deps: - dependent-map-0.4.0.0 - dependent-sum-0.7.1.0 - extra-1.7.10 +- floskell-0.10.6 - fourmolu-0.5.0.0 - ghc-exactprint-1.4.1 - ghc-lib-9.2.1.20220109 - ghc-lib-parser-9.2.1.20220109 - ghc-lib-parser-ex-9.2.0.1 -- hspec-2.7.10 # for hls-test-utils -- hspec-core-2.7.10 # for hls-test-utils -- some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66 -- floskell-0.10.6 - heapsize-0.3.0.1 - hiedb-0.4.1.0 +- hspec-2.7.10 # for hls-test-utils +- hspec-core-2.7.10 # for hls-test-utils - implicit-hie-0.1.2.6 - implicit-hie-cradle-0.5.0.0 +- lens-5.1 - monad-dijkstra-0.1.1.3 - multistate-0.8.0.3 - ormolu-0.4.0.0 - retrie-1.1.0.0 +- some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66 - unix-compat-0.5.4 # hls-graph dependencies From 49ce94ad8810849f7efd3c5bb267c0cca57bfe21 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Mon, 17 Jan 2022 15:23:45 +0100 Subject: [PATCH 10/53] update retrie --- stack-9.2.1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 289fd38c4e..14c6de7f51 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -57,7 +57,7 @@ extra-deps: - monad-dijkstra-0.1.1.3 - multistate-0.8.0.3 - ormolu-0.4.0.0 -- retrie-1.1.0.0 +- retrie-1.2.0.1 - some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66 - unix-compat-0.5.4 From c1163601f833b7ede7d605797ac11a4ad3a853f5 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 17 Jan 2022 21:10:04 +0100 Subject: [PATCH 11/53] Comment class plugin package --- stack-9.2.1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 14c6de7f51..148b59f23e 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -10,7 +10,7 @@ packages: - ./hls-test-utils - ./shake-bench - ./plugins/hls-call-hierarchy-plugin -- ./plugins/hls-class-plugin +# - ./plugins/hls-class-plugin # - ./plugins/hls-haddock-comments-plugin # - ./plugins/hls-eval-plugin - ./plugins/hls-explicit-imports-plugin From 7b7f9fc2ae0bc1f45d2ca7b79f47b92cfff8dc46 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 07:38:46 +0100 Subject: [PATCH 12/53] Handle Nothing case --- plugins/default/src/Ide/Plugin/Example.hs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins/default/src/Ide/Plugin/Example.hs b/plugins/default/src/Ide/Plugin/Example.hs index 6fbbaad67a..9511b00b06 100644 --- a/plugins/default/src/Ide/Plugin/Example.hs +++ b/plugins/default/src/Ide/Plugin/Example.hs @@ -109,15 +109,18 @@ mkDiag file diagSource sev loc msg = (file, D.ShowDiag,) -- | Generate code actions. codeAction :: PluginMethodHandler IdeState TextDocumentCodeAction codeAction state _pid (CodeActionParams _ _ (TextDocumentIdentifier uri) _range CodeActionContext{_diagnostics=List _xs}) = liftIO $ do - let Just nfp = uriToNormalizedFilePath $ toNormalizedUri uri - Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp - let - title = "Add TODO Item 1" - tedit = [TextEdit (Range (Position 2 0) (Position 2 0)) - "-- TODO1 added by Example Plugin directly\n"] - edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing Nothing - pure $ Right $ List - [ InR $ CodeAction title (Just CodeActionQuickFix) (Just $ List []) Nothing Nothing (Just edit) Nothing Nothing] + let mbnfp = uriToNormalizedFilePath $ toNormalizedUri uri + case mbnfp of + Just nfp -> do + Just (ParsedModule{},_) <- runIdeAction "example" (shakeExtras state) $ useWithStaleFast GetParsedModule nfp + let + title = "Add TODO Item 1" + tedit = [TextEdit (Range (Position 2 0) (Position 2 0)) + "-- TODO1 added by Example Plugin directly\n"] + edit = WorkspaceEdit (Just $ Map.singleton uri $ List tedit) Nothing Nothing + pure $ Right $ List + [ InR $ CodeAction title (Just CodeActionQuickFix) (Just $ List []) Nothing Nothing (Just edit) Nothing Nothing] + Nothing -> error $ "Unable to get a normalized file path from the uri: " ++ show uri -- --------------------------------------------------------------------- From caa33d06c102cd204f84389bb4cb83724580e9f6 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 08:06:37 +0100 Subject: [PATCH 13/53] Restore ghc-typelits deps --- stack-9.2.1.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 148b59f23e..67161cd909 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -61,10 +61,6 @@ extra-deps: - some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66 - unix-compat-0.5.4 -# hls-graph dependencies -- stm-containers-1.2 -- stm-hamt-1.2.0.7 - # shake-bench dependencies - Chart-1.9.3 - Chart-diagrams-1.9.3 @@ -73,11 +69,19 @@ extra-deps: - statestack-0.3 - operational-0.2.4.1 +# hls-graph dependencies +- stm-containers-1.2 +- stm-hamt-1.2.0.7 + # primitive-unlifted-1.0.0 is not buildable with ghc-9.0.2 # see https://gitlab.haskell.org/ghc/ghc/-/issues/20908 - primitive-unlifted-0.1.3.1 - primitive-extras-0.10.1.4 +# for ghcide test suite +- ghc-typelits-knownnat-0.7.6 +- ghc-typelits-natnormalise-0.7.6 + # boot libraries - Cabal-3.6.0.0 - directory-1.3.6.2 From 9af8ae8899ce1dec50989324b69e6dc2b8c0a4c8 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 10:52:07 +0100 Subject: [PATCH 14/53] More non-exhaustive patterns --- test/functional/HieBios.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/functional/HieBios.hs b/test/functional/HieBios.hs index 1ab9f2837e..df742abcdb 100644 --- a/test/functional/HieBios.hs +++ b/test/functional/HieBios.hs @@ -17,9 +17,12 @@ tests = testGroup "hie-bios" [ runSession hlsCommand fullCaps "test/testdata/hieBiosMainIs" $ do doc <- openDoc "Main.hs" "haskell" Just mainHoverText <- getHover doc (Position 3 1) - let (HoverContents (MarkupContent _ x)) = mainHoverText ^. L.contents - liftIO $ "main :: IO ()" `T.isInfixOf` x - @? "found hover text for main" + let hoverContents = mainHoverText ^. L.contents + case hoverContents of + (HoverContents (MarkupContent _ x)) -> do + liftIO $ "main :: IO ()" `T.isInfixOf` x + @? "found hover text for main" + _ -> error $ "Unexpected hover contents: " ++ show hoverContents , testCase "reports errors in hie.yaml" $ do writeFile (hieBiosErrorPath "hie.yaml") "" From 0ceaf6414860e13014537858853a0451a25f4789 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 11:55:09 +0100 Subject: [PATCH 15/53] More non-exhaustive patterns --- test/functional/FunctionalCodeAction.hs | 42 +++++++++++++++---------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/test/functional/FunctionalCodeAction.hs b/test/functional/FunctionalCodeAction.hs index fd12fe39d1..321ba401b5 100644 --- a/test/functional/FunctionalCodeAction.hs +++ b/test/functional/FunctionalCodeAction.hs @@ -56,11 +56,13 @@ renameTests = testGroup "rename suggestions" [ cars <- getAllCodeActions doc cmd <- liftIO $ inspectCommand cars ["Replace with", "putStrLn"] - let Just (List [args]) = cmd ^. L.arguments - editParams = args ^. ix "fallbackWorkspaceEdit" . _Object - liftIO $ do - (editParams & has (ix "changes")) @? "Contains changes" - not (editParams & has (ix "documentChanges")) @? "Doesn't contain documentChanges" + let mbArgs = cmd ^. L.arguments + case mbArgs of + Just (List [args]) -> liftIO $ do + let editParams = args ^. ix "fallbackWorkspaceEdit" . _Object + (editParams & has (ix "changes")) @? "Contains changes" + not (editParams & has (ix "documentChanges")) @? "Doesn't contain documentChanges" + _ -> error $ "Unexpected arguments: " ++ show mbArgs executeCommand cmd _ <- anyRequest @@ -115,14 +117,16 @@ packageTests = testGroup "add package suggestions" [ in liftIO $ any (`T.isPrefixOf` (diag ^. L.message)) prefixes @? "Contains prefix" acts <- getAllCodeActions doc - let (InR action:_) = acts + case acts of + (InR action:_) -> do + liftIO $ do + action ^. L.title @?= "Add text as a dependency" + action ^. L.kind @?= Just CodeActionQuickFix + "package:add" `T.isSuffixOf` (action ^. L.command . _Just . L.command) @? "Command contains package:add" - liftIO $ do - action ^. L.title @?= "Add text as a dependency" - action ^. L.kind @?= Just CodeActionQuickFix - "package:add" `T.isSuffixOf` (action ^. L.command . _Just . L.command) @? "Command contains package:add" + executeCodeAction action - executeCodeAction action + _ -> error $ "Unexpected code actions: " ++ show acts contents <- skipManyTill anyMessage $ getDocumentEdit . TextDocumentIdentifier =<< getDocUri "add-package-test.cabal" liftIO $ @@ -175,14 +179,18 @@ redundantImportTests = testGroup "redundant import code actions" [ liftIO $ actionTitles `shouldContain` ["Remove import", "Remove all redundant imports"] - let Just removeAction = find (\x -> x ^. L.title == "Remove import") allActions + let mbRemoveAction = find (\x -> x ^. L.title == "Remove import") allActions - liftIO $ do - forM_ allActions $ \a -> a ^. L.kind @?= Just CodeActionQuickFix - forM_ allActions $ \a -> a ^. L.command @?= Nothing - forM_ allActions $ \a -> isJust (a ^. L.edit) @? "Has edit" + case mbRemoveAction of + Just removeAction -> do + liftIO $ do + forM_ allActions $ \a -> a ^. L.kind @?= Just CodeActionQuickFix + forM_ allActions $ \a -> a ^. L.command @?= Nothing + forM_ allActions $ \a -> isJust (a ^. L.edit) @? "Has edit" + + executeCodeAction removeAction - executeCodeAction removeAction + Nothing -> error $ "Unexpected code actions: " ++ show allActions -- No command/applyworkspaceedit should be here, since action -- provides workspace edit property which skips round trip to From d96e5140b3bed0c64c900fb04a360a144df96c67 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 12:06:39 +0100 Subject: [PATCH 16/53] Set pedantic (-WError) true for cabal --- cabal-ghc921.project | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/cabal-ghc921.project b/cabal-ghc921.project index 2ad661358a..c72cd6557e 100644 --- a/cabal-ghc921.project +++ b/cabal-ghc921.project @@ -27,20 +27,12 @@ packages: ./plugins/hls-call-hierarchy-plugin ./plugins/hls-alternate-number-format-plugin -repository head.hackage.ghc.haskell.org - url: https://ghc.gitlab.haskell.org/head.hackage/ - secure: True - key-threshold: 3 - root-keys: - f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 - 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 - 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - - with-compiler: ghc-9.2.1 tests: true +flags: +pedantic + package * ghc-options: -haddock test-show-details: direct @@ -63,17 +55,8 @@ constraints: -splice -stylishhaskell -tactic, - ghc-lib-parser ^>= 9.2, - attoparsec ^>= 0.14.3, - ghc-exactprint >= 1.3, - retrie >= 1.2, - direct-sqlite == 2.3.26, - lens >= 5.0.1, - primitive-unlifted ==0.1.3.1 allow-newer: - -- base, - -- for shake-bench Chart:lens, Chart-diagrams:lens, From 7b43c627ac6ff4f350fc50b15d803f7343595582 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 12:18:16 +0100 Subject: [PATCH 17/53] Remove pedantic as we set it out in cabal.project --- .github/workflows/flags.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index 6f2f3d0b6d..be0f5af92a 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -57,17 +57,11 @@ jobs: os: ${{ runner.os }} - name: Build `hls-graph` with flags - run: cabal v2-build hls-graph --flags="pedantic embed-files stm-stats" + run: cabal v2-build hls-graph --flags="embed-files stm-stats" - name: Build `hie-compat` with flags run: cabal v2-build hie-compat --flags="ghc-lib" - - name: Build `hls-plugin-api` with flags - run: cabal v2-build hls-plugin-api --flags="pedantic" - - - name: Build `hls-test-utils` with flags - run: cabal v2-build hls-test-utils --flags="pedantic" - - name: Build run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe" From 0b4c99c44e654a79fc593d76f068bfb86d7505cd Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 12:33:28 +0100 Subject: [PATCH 18/53] Not set pedantic for ghc-9.2.1 --- cabal-ghc921.project | 2 -- 1 file changed, 2 deletions(-) diff --git a/cabal-ghc921.project b/cabal-ghc921.project index c72cd6557e..fc08879367 100644 --- a/cabal-ghc921.project +++ b/cabal-ghc921.project @@ -31,8 +31,6 @@ with-compiler: ghc-9.2.1 tests: true -flags: +pedantic - package * ghc-options: -haddock test-show-details: direct From e873ba44208260c1678f1242c73bf57812cef382 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 12:43:05 +0100 Subject: [PATCH 19/53] Set pedantic in cabal.project's --- cabal-ghc90.project | 2 ++ cabal.project | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cabal-ghc90.project b/cabal-ghc90.project index 3ef649ff8b..0291f84d78 100644 --- a/cabal-ghc90.project +++ b/cabal-ghc90.project @@ -29,6 +29,8 @@ packages: tests: true +flags: +pedantic + package * ghc-options: -haddock test-show-details: direct diff --git a/cabal.project b/cabal.project index 66b4e41302..1692848b60 100644 --- a/cabal.project +++ b/cabal.project @@ -34,6 +34,8 @@ optional-packages: vendored/*/*.cabal tests: true +flags: +pedantic + package * ghc-options: -haddock test-show-details: direct From d38892cb788af391b8a664299d5cfeb5f09a3fd1 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 13:17:51 +0100 Subject: [PATCH 20/53] More non-exhaustive patterns --- test/functional/Completion.hs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/functional/Completion.hs b/test/functional/Completion.hs index 5b5052f1ac..cd816d90fb 100644 --- a/test/functional/Completion.hs +++ b/test/functional/Completion.hs @@ -37,14 +37,15 @@ tests = testGroup "completions" [ compls <- getCompletions doc (Position 5 9) let item = head $ filter ((== "putStrLn") . (^. label)) compls resolvedRes <- request SCompletionItemResolve item - let Right resolved = resolvedRes ^. result - liftIO $ print resolved - liftIO $ do - resolved ^. label @?= "putStrLn" - resolved ^. kind @?= Just CiFunction - resolved ^. detail @?= Just "String -> IO ()\nPrelude" - resolved ^. insertTextFormat @?= Just Snippet - resolved ^. insertText @?= Just "putStrLn ${1:String}" + let eResolved = resolvedRes ^. result + case eResolved of + Right resolved -> liftIO $ do + resolved ^. label @?= "putStrLn" + resolved ^. kind @?= Just CiFunction + resolved ^. detail @?= Just "String -> IO ()\nPrelude" + resolved ^. insertTextFormat @?= Just Snippet + resolved ^. insertText @?= Just "putStrLn ${1:String}" + _ -> error $ "Unexpected resolved value: " ++ show eResolved , testCase "completes imports" $ runSession (hlsCommand <> " --test") fullCaps "test/testdata/completion" $ do doc <- openDoc "Completion.hs" "haskell" From fa72a583596c00a42d22a80d3f2ebd6d18603814 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 13:19:31 +0100 Subject: [PATCH 21/53] Not set pedantic for ghc-9.0.1 --- cabal-ghc90.project | 2 -- 1 file changed, 2 deletions(-) diff --git a/cabal-ghc90.project b/cabal-ghc90.project index 0291f84d78..3ef649ff8b 100644 --- a/cabal-ghc90.project +++ b/cabal-ghc90.project @@ -29,8 +29,6 @@ packages: tests: true -flags: +pedantic - package * ghc-options: -haddock test-show-details: direct From a52b55059ba4ac9ce99eb324f9e7464ed60975e8 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 15:50:53 +0100 Subject: [PATCH 22/53] More incomplete patterns --- test/functional/Progress.hs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/test/functional/Progress.hs b/test/functional/Progress.hs index d131fc6175..e4f84f82ce 100644 --- a/test/functional/Progress.hs +++ b/test/functional/Progress.hs @@ -44,16 +44,19 @@ tests = [] -- this is a test so exceptions result in fails - let LSP.List [evalLens] = getResponseResult codeLensResponse - let command = evalLens ^?! L.command . _Just - - _ <- sendRequest SWorkspaceExecuteCommand $ - ExecuteCommandParams - Nothing - (command ^. L.command) - (decode $ encode $ fromJust $ command ^. L.arguments) - - expectProgressMessages ["Evaluating"] activeProgressTokens + let response = getResponseResult codeLensResponse + case response of + LSP.List [evalLens] -> do + let command = evalLens ^?! L.command . _Just + + _ <- sendRequest SWorkspaceExecuteCommand $ + ExecuteCommandParams + Nothing + (command ^. L.command) + (decode $ encode $ fromJust $ command ^. L.arguments) + + expectProgressMessages ["Evaluating"] activeProgressTokens + _ -> error $ "Unexpected response result: " ++ show response , requiresOrmoluPlugin $ testCase "ormolu plugin sends progress notifications" $ do runSession hlsCommand progressCaps "test/testdata/format" $ do sendConfigurationChanged (formatLspConfig "ormolu") From 7e9c938fcba7423aa483ee7454d8aada3b6a9534 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 20:58:04 +0100 Subject: [PATCH 23/53] Fix WErrors --- plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs | 9 +++------ .../src/Wingman/Metaprogramming/Parser/Documentation.hs | 4 ++-- .../src/Wingman/Metaprogramming/ProofState.hs | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs b/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs index c4da71d5cc..d5717a7604 100644 --- a/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs +++ b/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs @@ -105,12 +105,6 @@ import Language.LSP.Types hiding import qualified Language.LSP.Types as LSP import qualified Language.LSP.Types.Lens as LSP -import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative), - Generic) -import Text.Regex.TDFA.Text () - -import Development.IDE.GHC.Compat (WarningFlag (Opt_WarnUnrecognisedPragmas), - wopt) import Development.IDE.Spans.Pragmas (LineSplitTextEdits (LineSplitTextEdits), NextPragmaInfo (NextPragmaInfo), getNextPragmaInfo, @@ -118,8 +112,11 @@ import Development.IDE.Spans.Pragmas (LineSplitTe lineSplitInsertTextEdit, lineSplitTextEdits, nextPragmaLine) +import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative), + Generic) import System.Environment (setEnv, unsetEnv) +import Text.Regex.TDFA.Text () -- --------------------------------------------------------------------- #ifdef HLINT_ON_GHC_LIB diff --git a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs index 7b047513f8..018e59b2ff 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs @@ -6,8 +6,8 @@ import Data.Functor ((<&>)) import Data.List (sortOn) import Data.String (IsString) import Data.Text (Text) -import Data.Text.Prettyprint.Doc hiding (parens) -import Data.Text.Prettyprint.Doc.Render.String (renderString) +import Prettyprinter hiding (parens) +import Prettyprinter.Render.String (renderString) import Development.IDE.GHC.Compat (OccName) import qualified Text.Megaparsec as P import Wingman.Metaprogramming.Lexer (Parser, identifier, variable, parens) diff --git a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs index 5563b75c63..a908e99031 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs @@ -6,8 +6,8 @@ module Wingman.Metaprogramming.ProofState where import Data.Bool (bool) import Data.Functor ((<&>)) import qualified Data.Text as T -import Data.Text.Prettyprint.Doc -import Data.Text.Prettyprint.Doc.Render.Util.Panic +import Prettyprinter +import Prettyprinter.Render.Util.Panic import Language.LSP.Types (sectionSeparator) import Wingman.Judgements (jHypothesis) import Wingman.Types From 02c09bb0c6b6fca4e3f1525cb25cdb6610ae7a09 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 21:34:26 +0100 Subject: [PATCH 24/53] Dodgy import --- hls-graph/src/Development/IDE/Graph/Internal/Types.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/hls-graph/src/Development/IDE/Graph/Internal/Types.hs b/hls-graph/src/Development/IDE/Graph/Internal/Types.hs index 9706061971..056b6bd0a6 100644 --- a/hls-graph/src/Development/IDE/Graph/Internal/Types.hs +++ b/hls-graph/src/Development/IDE/Graph/Internal/Types.hs @@ -22,7 +22,6 @@ import GHC.Conc (TVar, atomically) #endif #if __GLASGOW_HASKELL__ < 880 import Control.Monad.Fail -import Prelude hiding (MonadFail) #endif import Control.Monad.IO.Class import Control.Monad.Trans.Reader From 2668760f10e7a413cb326bafaaa7b724f0fe01e0 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 22:07:32 +0100 Subject: [PATCH 25/53] Correct CPP conditions --- hls-graph/src/Development/IDE/Graph/Internal/Types.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hls-graph/src/Development/IDE/Graph/Internal/Types.hs b/hls-graph/src/Development/IDE/Graph/Internal/Types.hs index 056b6bd0a6..993c95a234 100644 --- a/hls-graph/src/Development/IDE/Graph/Internal/Types.hs +++ b/hls-graph/src/Development/IDE/Graph/Internal/Types.hs @@ -14,15 +14,14 @@ module Development.IDE.Graph.Internal.Types where import Control.Applicative import Control.Monad.Catch -#if __GLASGOW_HASKELL__ < 870 +#if __GLASGOW_HASKELL__ < 808 -- Needed in GHC 8.6.5 import Control.Concurrent.STM.Stats (TVar, atomically) +import Control.Monad.Fail +import Prelude hiding (MonadFail) #else import GHC.Conc (TVar, atomically) #endif -#if __GLASGOW_HASKELL__ < 880 -import Control.Monad.Fail -#endif import Control.Monad.IO.Class import Control.Monad.Trans.Reader import Data.Aeson (FromJSON, ToJSON) From 0eaf0d4aabb342e6ff4b508c46112546e8286ae5 Mon Sep 17 00:00:00 2001 From: jneira Date: Tue, 18 Jan 2022 22:15:52 +0100 Subject: [PATCH 26/53] Not MonadFail in Prelude --- hls-graph/src/Development/IDE/Graph/Internal/Types.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/hls-graph/src/Development/IDE/Graph/Internal/Types.hs b/hls-graph/src/Development/IDE/Graph/Internal/Types.hs index 993c95a234..4e12bfc024 100644 --- a/hls-graph/src/Development/IDE/Graph/Internal/Types.hs +++ b/hls-graph/src/Development/IDE/Graph/Internal/Types.hs @@ -18,7 +18,6 @@ import Control.Monad.Catch -- Needed in GHC 8.6.5 import Control.Concurrent.STM.Stats (TVar, atomically) import Control.Monad.Fail -import Prelude hiding (MonadFail) #else import GHC.Conc (TVar, atomically) #endif From f5c5acd45b6f0a80da2fb79b519155bec1dd0c0f Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 14:47:39 +0100 Subject: [PATCH 27/53] Fix more warnings --- .../src/Ide/Plugin/Eval/Rules.hs | 3 ++- .../hls-hlint-plugin/src/Ide/Plugin/Hlint.hs | 8 ++++--- .../src/Wingman/StaticPlugin.hs | 22 +++++-------------- stack-9.2.1.yaml | 4 ---- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs index dfca81fabc..6b5cb84437 100644 --- a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs +++ b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs @@ -2,7 +2,8 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RecordWildCards #-} - +-- To avoid warning "Pattern match has inaccessible right hand side" +{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-} module Ide.Plugin.Eval.Rules (GetEvalComments(..), rules,queueForEvaluation) where import Control.Monad.IO.Class (MonadIO (liftIO)) diff --git a/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs b/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs index d5717a7604..4d079e8421 100644 --- a/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs +++ b/plugins/hls-hlint-plugin/src/Ide/Plugin/Hlint.hs @@ -59,7 +59,9 @@ import Development.IDE.GHC.Compat (BufSpan, DynFlags, extensionFlags, ms_hspp_opts, - topDir) + topDir, + WarningFlag(Opt_WarnUnrecognisedPragmas), + wopt) import qualified Development.IDE.GHC.Compat.Util as EnumSet import "ghc-lib" GHC hiding (DynFlags (..), @@ -85,6 +87,7 @@ import Language.Haskell.GHC.ExactPrint.Delta (deltaOption import Language.Haskell.GHC.ExactPrint.Parsers (postParseTransform) import Language.Haskell.GHC.ExactPrint.Types (Rigidity (..)) import Language.Haskell.GhclibParserEx.Fixity as GhclibParserEx (applyFixities) +import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative)) #endif import Ide.Logger @@ -112,8 +115,7 @@ import Development.IDE.Spans.Pragmas (LineSplitTe lineSplitInsertTextEdit, lineSplitTextEdits, nextPragmaLine) -import GHC.Generics (Associativity (LeftAssociative, NotAssociative, RightAssociative), - Generic) +import GHC.Generics (Generic) import System.Environment (setEnv, unsetEnv) import Text.Regex.TDFA.Text () diff --git a/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs b/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs index ce7fb8863b..80fc467c34 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs @@ -14,9 +14,10 @@ import Development.IDE.GHC.Compat.Util import GHC.LanguageExtensions.Type (Extension(EmptyCase, QuasiQuotes)) import Generics.SYB import Ide.Types + #if __GLASGOW_HASKELL__ >= 900 import GHC.Driver.Plugins (purePlugin) -#else +#elsif __GLASGOW_HASKELL__ >= 808 import Plugins (purePlugin) #endif @@ -39,12 +40,9 @@ staticPlugin = mempty #endif } - pattern MetaprogramSourceText :: SourceText pattern MetaprogramSourceText = SourceText "wingman-meta-program" - - pattern WingmanMetaprogram :: FastString -> HsExpr p pattern WingmanMetaprogram mp <- #if __GLASGOW_HASKELL__ >= 900 @@ -55,12 +53,6 @@ pattern WingmanMetaprogram mp <- (L _ ( HsVar _ _)) #endif - - -enableQuasiQuotes :: DynFlags -> DynFlags -enableQuasiQuotes = flip xopt_set QuasiQuotes - - -- | Wingman wants to support destructing of empty cases, but these are a parse -- error by default. So we want to enable 'EmptyCase', but then that leads to -- silent errors without 'Opt_WarnIncompletePatterns'. @@ -80,11 +72,6 @@ metaprogrammingPlugin = } worker :: Monad m => [CommandLineOption] -> ModSummary -> HsParsedModule -> m HsParsedModule worker _ _ pm = pure $ pm { hpm_module = addMetaprogrammingSyntax $ hpm_module pm } -#endif - -metaprogramHoleName :: OccName -metaprogramHoleName = mkVarOcc "_$metaprogram" - mkMetaprogram :: SrcSpan -> FastString -> HsExpr GhcPs mkMetaprogram ss mp = @@ -98,14 +85,16 @@ mkMetaprogram ss mp = $ L ss $ mkRdrUnqual metaprogramHoleName - addMetaprogrammingSyntax :: Data a => a -> a addMetaprogrammingSyntax = everywhere $ mkT $ \case L ss (MetaprogramSyntax mp) -> L ss $ mkMetaprogram ss mp (x :: LHsExpr GhcPs) -> x +#endif +metaprogramHoleName :: OccName +metaprogramHoleName = mkVarOcc "_$metaprogram" pattern MetaprogramSyntax :: FastString -> HsExpr GhcPs pattern MetaprogramSyntax mp <- @@ -119,4 +108,3 @@ pattern MetaprogramSyntax mp <- (mkRdrUnqual $ mkVarOcc "wingman") noSrcSpan mp - diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 67161cd909..bbbb02ed10 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -116,12 +116,8 @@ flags: eval: false haddockComments: false hlint: false -<<<<<<< HEAD importLens: false ormolu: false -======= - refineImports: false ->>>>>>> 46fcf65f (Enable brittany for ghc-9.0.2) retrie: false splice: false stylishhaskell: false From a75dae73394ba859fc6d4044dedc3f890eef6b98 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Wed, 19 Jan 2022 15:14:14 +0100 Subject: [PATCH 28/53] Restore missing fun --- plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs b/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs index 80fc467c34..c9e2076182 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs @@ -62,6 +62,9 @@ allowEmptyCaseButWithWarning = #if __GLASGOW_HASKELL__ >= 808 +enableQuasiQuotes :: DynFlags -> DynFlags +enableQuasiQuotes = flip xopt_set QuasiQuotes + metaprogrammingPlugin :: StaticPlugin metaprogrammingPlugin = StaticPlugin $ PluginWithArgs pluginDefinition [] From 60618897bff11681761f272ebe02e39eb81767c3 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Wed, 19 Jan 2022 15:28:25 +0100 Subject: [PATCH 29/53] unused imports --- .../hls-tactics-plugin/src/Wingman/StaticPlugin.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs b/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs index c9e2076182..cc71d2b985 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs @@ -8,18 +8,22 @@ module Wingman.StaticPlugin , pattern MetaprogramSyntax ) where -import Data.Data import Development.IDE.GHC.Compat import Development.IDE.GHC.Compat.Util -import GHC.LanguageExtensions.Type (Extension(EmptyCase, QuasiQuotes)) -import Generics.SYB +import GHC.LanguageExtensions.Type (Extension(EmptyCase)) + import Ide.Types +#if __GLASGOW_HASKELL__ >= 808 +import Data.Data +import Generics.SYB +import GHC.LanguageExtensions.Type (Extension(QuasiQuotes)) #if __GLASGOW_HASKELL__ >= 900 import GHC.Driver.Plugins (purePlugin) -#elsif __GLASGOW_HASKELL__ >= 808 +#else import Plugins (purePlugin) #endif +#endif staticPlugin :: DynFlagsModifications staticPlugin = mempty From 67ef15263becb7091e75e7da75eaf7809a83c648 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 19:12:01 +0100 Subject: [PATCH 30/53] Enable refine imports --- stack-9.2.1.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index bbbb02ed10..4ffd6d7820 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -15,7 +15,7 @@ packages: # - ./plugins/hls-eval-plugin - ./plugins/hls-explicit-imports-plugin - ./plugins/hls-qualify-imported-names-plugin -# - ./plugins/hls-refine-imports-plugin +- ./plugins/hls-refine-imports-plugin # - ./plugins/hls-hlint-plugin - ./plugins/hls-rename-plugin # - ./plugins/hls-retrie-plugin @@ -116,8 +116,6 @@ flags: eval: false haddockComments: false hlint: false - importLens: false - ormolu: false retrie: false splice: false stylishhaskell: false From 464437c0f19c01d515155f81645347880e370179 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 21:12:44 +0100 Subject: [PATCH 31/53] more fixes --- .../src/Wingman/LanguageServer/TacticProviders.hs | 3 ++- .../hls-tactics-plugin/src/Wingman/StaticPlugin.hs | 13 ++++++++----- plugins/hls-tactics-plugin/src/Wingman/Types.hs | 1 - 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/hls-tactics-plugin/src/Wingman/LanguageServer/TacticProviders.hs b/plugins/hls-tactics-plugin/src/Wingman/LanguageServer/TacticProviders.hs index a9ed4e791e..fb6f5693b1 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/LanguageServer/TacticProviders.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/LanguageServer/TacticProviders.hs @@ -160,10 +160,11 @@ commandProvider RunMetaprogram = requireGHC88OrHigher :: TacticProvider -> TacticProvider -requireGHC88OrHigher tp tpd = #if __GLASGOW_HASKELL__ >= 808 +requireGHC88OrHigher tp tpd = tp tpd #else +requireGHC88OrHigher _ _= mempty #endif diff --git a/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs b/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs index cc71d2b985..563a1fcc63 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs @@ -10,14 +10,13 @@ module Wingman.StaticPlugin import Development.IDE.GHC.Compat import Development.IDE.GHC.Compat.Util -import GHC.LanguageExtensions.Type (Extension(EmptyCase)) +import GHC.LanguageExtensions.Type (Extension(EmptyCase, QuasiQuotes)) import Ide.Types #if __GLASGOW_HASKELL__ >= 808 import Data.Data import Generics.SYB -import GHC.LanguageExtensions.Type (Extension(QuasiQuotes)) #if __GLASGOW_HASKELL__ >= 900 import GHC.Driver.Plugins (purePlugin) #else @@ -44,9 +43,11 @@ staticPlugin = mempty #endif } + pattern MetaprogramSourceText :: SourceText pattern MetaprogramSourceText = SourceText "wingman-meta-program" + pattern WingmanMetaprogram :: FastString -> HsExpr p pattern WingmanMetaprogram mp <- #if __GLASGOW_HASKELL__ >= 900 @@ -57,6 +58,11 @@ pattern WingmanMetaprogram mp <- (L _ ( HsVar _ _)) #endif + +enableQuasiQuotes :: DynFlags -> DynFlags +enableQuasiQuotes = flip xopt_set QuasiQuotes + + -- | Wingman wants to support destructing of empty cases, but these are a parse -- error by default. So we want to enable 'EmptyCase', but then that leads to -- silent errors without 'Opt_WarnIncompletePatterns'. @@ -66,9 +72,6 @@ allowEmptyCaseButWithWarning = #if __GLASGOW_HASKELL__ >= 808 -enableQuasiQuotes :: DynFlags -> DynFlags -enableQuasiQuotes = flip xopt_set QuasiQuotes - metaprogrammingPlugin :: StaticPlugin metaprogrammingPlugin = StaticPlugin $ PluginWithArgs pluginDefinition [] diff --git a/plugins/hls-tactics-plugin/src/Wingman/Types.hs b/plugins/hls-tactics-plugin/src/Wingman/Types.hs index df64258f46..621cc9752e 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Types.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Types.hs @@ -38,7 +38,6 @@ import GHC.Exts (fromString) import GHC.Generics import GHC.SourceGen (var) import Refinery.ProofState -import Refinery.Tactic import Refinery.Tactic.Internal (TacticT(TacticT), RuleT (RuleT)) import System.IO.Unsafe (unsafePerformIO) import Wingman.Debug From 6b09e625a0a8c0829de0d0ea1c8785cf00f240b4 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 21:17:05 +0100 Subject: [PATCH 32/53] Enable brittany in nix for 9.0.1 --- configuration-ghc-901.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/configuration-ghc-901.nix b/configuration-ghc-901.nix index 62d83c9cc0..5d63d795d6 100644 --- a/configuration-ghc-901.nix +++ b/configuration-ghc-901.nix @@ -3,7 +3,6 @@ let disabledPlugins = [ - "hls-brittany-plugin" "hls-stylish-haskell-plugin" ]; @@ -17,7 +16,6 @@ let haskell-language-server = hself.callCabal2nixWithOptions "haskell-language-server" ./. (pkgs.lib.concatStringsSep " " [ - "-f-brittany" "-f-stylishhaskell" ]) { }; From 6f654ab8f439821b3401169feb8fa8af9bd4df5a Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 21:31:41 +0100 Subject: [PATCH 33/53] Use newer prettyprinter --- stack-8.6.5.yaml | 1 + stack-8.8.4.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml index 088f1d4149..aee56d0677 100644 --- a/stack-8.6.5.yaml +++ b/stack-8.6.5.yaml @@ -78,6 +78,7 @@ extra-deps: - optparse-applicative-0.15.1.0 - ormolu-0.1.4.1 - parser-combinators-1.2.1 + - prettyprinter-1.7.0 - primitive-0.7.1.0 - refinery-0.4.0.0 - regex-base-0.94.0.0 diff --git a/stack-8.8.4.yaml b/stack-8.8.4.yaml index 5e63618afe..91e0976373 100644 --- a/stack-8.8.4.yaml +++ b/stack-8.8.4.yaml @@ -63,6 +63,7 @@ extra-deps: - monad-dijkstra-0.1.1.2 - opentelemetry-0.6.1 - opentelemetry-extra-0.6.1 + - prettyprinter-1.7.0 - refinery-0.4.0.0 - retrie-1.1.0.0 - semigroups-0.18.5 From 497ee13a1a20f8d3edf5d1c4b3de4faa7a4aa4b2 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 21:54:32 +0100 Subject: [PATCH 34/53] Return to master --- configuration-ghc-901.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configuration-ghc-901.nix b/configuration-ghc-901.nix index 5d63d795d6..62d83c9cc0 100644 --- a/configuration-ghc-901.nix +++ b/configuration-ghc-901.nix @@ -3,6 +3,7 @@ let disabledPlugins = [ + "hls-brittany-plugin" "hls-stylish-haskell-plugin" ]; @@ -16,6 +17,7 @@ let haskell-language-server = hself.callCabal2nixWithOptions "haskell-language-server" ./. (pkgs.lib.concatStringsSep " " [ + "-f-brittany" "-f-stylishhaskell" ]) { }; From 3038c6fa4d1ad779efa8ae757aa8c17cac3b3a85 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 22:01:04 +0100 Subject: [PATCH 35/53] Enable tactics in stack-9.2.1.yaml --- stack-9.2.1.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 4ffd6d7820..2d5fd301ee 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -20,7 +20,7 @@ packages: - ./plugins/hls-rename-plugin # - ./plugins/hls-retrie-plugin # - ./plugins/hls-splice-plugin -# - ./plugins/hls-tactics-plugin +- ./plugins/hls-tactics-plugin # - ./plugins/hls-brittany-plugin # - ./plugins/hls-stylish-haskell-plugin - ./plugins/hls-floskell-plugin @@ -119,7 +119,6 @@ flags: retrie: false splice: false stylishhaskell: false - tactic: false retrie: BuildExecutable: false From 97c710e07fa81f2eead90f281c61721e6d725b72 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 22:12:10 +0100 Subject: [PATCH 36/53] Enable pedantic in ci --- .github/workflows/flags.yml | 5 ++++- cabal.project | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index be0f5af92a..1d52a7eeb8 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -62,9 +62,12 @@ jobs: - name: Build `hie-compat` with flags run: cabal v2-build hie-compat --flags="ghc-lib" - - name: Build + - name: Build `ghcide` with flags run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe" + - name: Build with pedantic (-WError) + run: cabal v2-build --flags="pedantic" + flags_post_job: if: always() runs-on: ubuntu-latest diff --git a/cabal.project b/cabal.project index 1692848b60..66b4e41302 100644 --- a/cabal.project +++ b/cabal.project @@ -34,8 +34,6 @@ optional-packages: vendored/*/*.cabal tests: true -flags: +pedantic - package * ghc-options: -haddock test-show-details: direct From d7bbbd82b6da3f0d58fd730b768700e464bfbf85 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 22:27:03 +0100 Subject: [PATCH 37/53] =?UTF-8?q?Avoid=20deprecation=20warning=20with=20CP?= =?UTF-8?q?P=20=EF=BF=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/Wingman/Metaprogramming/Parser/Documentation.hs | 8 ++++++++ .../src/Wingman/Metaprogramming/ProofState.hs | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs index 018e59b2ff..435a2a1e67 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} module Wingman.Metaprogramming.Parser.Documentation where @@ -6,8 +7,15 @@ import Data.Functor ((<&>)) import Data.List (sortOn) import Data.String (IsString) import Data.Text (Text) + +#if MIN_VERSION_prettyprinter(1,7,0) import Prettyprinter hiding (parens) import Prettyprinter.Render.String (renderString) +#else +import Data.Text.Prettyprint.Doc hiding (parens) +import Data.Text.Prettyprint.Doc.Render.String (renderString) +#endif + import Development.IDE.GHC.Compat (OccName) import qualified Text.Megaparsec as P import Wingman.Metaprogramming.Lexer (Parser, identifier, variable, parens) diff --git a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs index a908e99031..bfbdbb724b 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} @@ -6,8 +7,13 @@ module Wingman.Metaprogramming.ProofState where import Data.Bool (bool) import Data.Functor ((<&>)) import qualified Data.Text as T +#if MIN_VERSION_prettyprinter(1,7,0) import Prettyprinter import Prettyprinter.Render.Util.Panic +#else +import Data.Text.Prettyprint.Doc +import Data.Text.Prettyprint.Doc.Render.Util.Panic +#endif import Language.LSP.Types (sectionSeparator) import Wingman.Judgements (jHypothesis) import Wingman.Types From a9cb9ed20aa95786bf37d0fe369847c6be2d2eb7 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 22:28:41 +0100 Subject: [PATCH 38/53] Use default prettyprinter --- stack-8.6.5.yaml | 1 - stack-8.8.4.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/stack-8.6.5.yaml b/stack-8.6.5.yaml index aee56d0677..088f1d4149 100644 --- a/stack-8.6.5.yaml +++ b/stack-8.6.5.yaml @@ -78,7 +78,6 @@ extra-deps: - optparse-applicative-0.15.1.0 - ormolu-0.1.4.1 - parser-combinators-1.2.1 - - prettyprinter-1.7.0 - primitive-0.7.1.0 - refinery-0.4.0.0 - regex-base-0.94.0.0 diff --git a/stack-8.8.4.yaml b/stack-8.8.4.yaml index 91e0976373..5e63618afe 100644 --- a/stack-8.8.4.yaml +++ b/stack-8.8.4.yaml @@ -63,7 +63,6 @@ extra-deps: - monad-dijkstra-0.1.1.2 - opentelemetry-0.6.1 - opentelemetry-extra-0.6.1 - - prettyprinter-1.7.0 - refinery-0.4.0.0 - retrie-1.1.0.0 - semigroups-0.18.5 From b050d8ba536f0acce21b2678a37bbe0a90a71095 Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 22:45:27 +0100 Subject: [PATCH 39/53] Update refinery for ghc-9.2.1 --- stack-9.2.1.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index 2d5fd301ee..b0f213e42d 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -57,6 +57,7 @@ extra-deps: - monad-dijkstra-0.1.1.3 - multistate-0.8.0.3 - ormolu-0.4.0.0 +- refinery-0.4.0.0 - retrie-1.2.0.1 - some-1.0.2 # for dependent-sum, https://github.com/obsidiansystems/dependent-sum/issues/66 - unix-compat-0.5.4 From 87b8408cb19f20124847f353ed764ba6b54be0ad Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 22:58:27 +0100 Subject: [PATCH 40/53] Ignore deprecations --- hls-graph/src/Development/IDE/Graph/Internal/Types.hs | 2 -- plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs | 2 +- .../src/Wingman/Metaprogramming/Parser/Documentation.hs | 9 +-------- .../src/Wingman/Metaprogramming/ProofState.hs | 6 +----- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/hls-graph/src/Development/IDE/Graph/Internal/Types.hs b/hls-graph/src/Development/IDE/Graph/Internal/Types.hs index 4e12bfc024..0a1278f5d3 100644 --- a/hls-graph/src/Development/IDE/Graph/Internal/Types.hs +++ b/hls-graph/src/Development/IDE/Graph/Internal/Types.hs @@ -1,5 +1,3 @@ - - {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveFunctor #-} diff --git a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs index 6b5cb84437..94539a395f 100644 --- a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs +++ b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs @@ -3,7 +3,7 @@ {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RecordWildCards #-} -- To avoid warning "Pattern match has inaccessible right hand side" -{-# OPTIONS_GHC -fno-warn-overlapping-patterns #-} +{-# OPTIONS_GHC -Wno-overlapping-patterns #-} module Ide.Plugin.Eval.Rules (GetEvalComments(..), rules,queueForEvaluation) where import Control.Monad.IO.Class (MonadIO (liftIO)) diff --git a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs index 435a2a1e67..9c2ff0f632 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser/Documentation.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} +{-# OPTIONS_GHC -Wno-deprecations #-} module Wingman.Metaprogramming.Parser.Documentation where @@ -7,15 +7,8 @@ import Data.Functor ((<&>)) import Data.List (sortOn) import Data.String (IsString) import Data.Text (Text) - -#if MIN_VERSION_prettyprinter(1,7,0) -import Prettyprinter hiding (parens) -import Prettyprinter.Render.String (renderString) -#else import Data.Text.Prettyprint.Doc hiding (parens) import Data.Text.Prettyprint.Doc.Render.String (renderString) -#endif - import Development.IDE.GHC.Compat (OccName) import qualified Text.Megaparsec as P import Wingman.Metaprogramming.Lexer (Parser, identifier, variable, parens) diff --git a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs index bfbdbb724b..02e203a1d3 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/ProofState.hs @@ -1,19 +1,15 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} +{-# OPTIONS_GHC -Wno-deprecations #-} module Wingman.Metaprogramming.ProofState where import Data.Bool (bool) import Data.Functor ((<&>)) import qualified Data.Text as T -#if MIN_VERSION_prettyprinter(1,7,0) -import Prettyprinter -import Prettyprinter.Render.Util.Panic -#else import Data.Text.Prettyprint.Doc import Data.Text.Prettyprint.Doc.Render.Util.Panic -#endif import Language.LSP.Types (sectionSeparator) import Wingman.Judgements (jHypothesis) import Wingman.Types From cdcea063def52eca9e2f476d443e0fe514cc2bbf Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 19 Jan 2022 23:50:03 +0100 Subject: [PATCH 41/53] Use dev version of ghc-source-gen --- stack-9.2.1.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index b0f213e42d..f14a7b5b80 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -47,6 +47,8 @@ extra-deps: - ghc-lib-9.2.1.20220109 - ghc-lib-parser-9.2.1.20220109 - ghc-lib-parser-ex-9.2.0.1 +- github: google/ghc-source-gen + commit: f6b9130d8f384be0ef7a02b371870d532090ccb6 - heapsize-0.3.0.1 - hiedb-0.4.1.0 - hspec-2.7.10 # for hls-test-utils From 4a47b688a88cc2756eaa5ef4dd0c8ecb30e71374 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 06:27:38 +0100 Subject: [PATCH 42/53] disable wingman for 9.2.1 --- stack-9.2.1.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index f14a7b5b80..f0bc8c586b 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -20,7 +20,7 @@ packages: - ./plugins/hls-rename-plugin # - ./plugins/hls-retrie-plugin # - ./plugins/hls-splice-plugin -- ./plugins/hls-tactics-plugin +# - ./plugins/hls-tactics-plugin # - ./plugins/hls-brittany-plugin # - ./plugins/hls-stylish-haskell-plugin - ./plugins/hls-floskell-plugin @@ -47,8 +47,6 @@ extra-deps: - ghc-lib-9.2.1.20220109 - ghc-lib-parser-9.2.1.20220109 - ghc-lib-parser-ex-9.2.0.1 -- github: google/ghc-source-gen - commit: f6b9130d8f384be0ef7a02b371870d532090ccb6 - heapsize-0.3.0.1 - hiedb-0.4.1.0 - hspec-2.7.10 # for hls-test-utils From 867175fba1de3d69ee515039316ba4f0ed412bd8 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 06:29:14 +0100 Subject: [PATCH 43/53] Enable wingman for 9.0.2 --- stack-9.0.2.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stack-9.0.2.yaml b/stack-9.0.2.yaml index d83a76ce85..841b11c2fe 100644 --- a/stack-9.0.2.yaml +++ b/stack-9.0.2.yaml @@ -19,7 +19,7 @@ packages: - ./plugins/hls-rename-plugin - ./plugins/hls-retrie-plugin - ./plugins/hls-splice-plugin -# - ./plugins/hls-tactics-plugin +- ./plugins/hls-tactics-plugin - ./plugins/hls-brittany-plugin # - ./plugins/hls-stylish-haskell-plugin - ./plugins/hls-floskell-plugin @@ -48,6 +48,7 @@ extra-deps: - implicit-hie-cradle-0.3.0.5 - monad-dijkstra-0.1.1.3 - multistate-0.8.0.3 +- refinery-0.4.0.0 - retrie-1.1.0.0 - unix-compat-0.5.4 @@ -99,7 +100,6 @@ flags: pedantic: true ignore-plugins-ghc-bounds: true - tactic: false # Dependencies fail stylishHaskell: false retrie: From dc6f67b7606502adfdd9b77faa36d78463d18133 Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Thu, 20 Jan 2022 06:41:58 +0100 Subject: [PATCH 44/53] disable tactic with flag --- stack-9.2.1.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index f0bc8c586b..e11a0efacb 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -120,6 +120,7 @@ flags: retrie: false splice: false stylishhaskell: false + tactic:false retrie: BuildExecutable: false From 064c696ac4835364d55c1ffedf7c4202360abebd Mon Sep 17 00:00:00 2001 From: Javier Neira Date: Thu, 20 Jan 2022 06:51:15 +0100 Subject: [PATCH 45/53] yaml grammar --- stack-9.2.1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack-9.2.1.yaml b/stack-9.2.1.yaml index e11a0efacb..3929e3d041 100644 --- a/stack-9.2.1.yaml +++ b/stack-9.2.1.yaml @@ -120,7 +120,7 @@ flags: retrie: false splice: false stylishhaskell: false - tactic:false + tactic: false retrie: BuildExecutable: false From 0818b87b7bc0034cf15e41ba12faf51d843ec911 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 08:11:50 +0100 Subject: [PATCH 46/53] Use setup-build action --- .github/workflows/build.yml | 36 ++++-------------------------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbbff326c0..e69a17fa80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,11 +41,10 @@ jobs: apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 - with: - ghc-version : ${{ matrix.ghc }} - cabal-version: ${{ matrix.cabal }} - enable-stack: false + - uses: ./.github/actions/setup-build + with: + ghc: ${{ matrix.ghc }} + os: ${{ runner.os }} # some alpines come with integer-simple instead of integer-gmp - name: Force integer-simple @@ -55,27 +54,6 @@ jobs: echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local fi - - name: Use modified cabal.project - env: - GHCVER: ${{ matrix.ghc }} - run: | - GHCVER2=${GHCVER//./} - ALT_PROJECT_FILE_MINOR=cabal-ghc${GHCVER2}.project - ALT_PROJECT_FILE_MAJOR=cabal-ghc${GHCVER2:0:2}.project - if [[ -f "$ALT_PROJECT_FILE_MINOR" ]]; then - rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MINOR" cabal.project - elif [[ -f "$ALT_PROJECT_FILE_MAJOR" ]]; then - rm -f -v cabal.project && cp -v "$ALT_PROJECT_FILE_MAJOR" cabal.project - fi - - - name: Shorten binary names - run: | - sed -i.bak -e 's/haskell-language-server/hls/g' \ - -e 's/haskell_language_server/hls/g' \ - haskell-language-server.cabal cabal.project - sed -i.bak -e 's/Paths_haskell_language_server/Paths_hls/g' \ - src/**/*.hs exe/*.hs - - name: (Windows) Platform specifics if: matrix.os == 'windows-latest' env: @@ -99,12 +77,6 @@ jobs: run: | echo "GHC_VERSION=$GHC_VER" >> $GITHUB_ENV - - name: (Windows, GHC 8.8.4) Workaround segfaults - if: matrix.ghc == '8.8.4' && matrix.os == 'windows-latest' - run: | - echo "package floskell" >> cabal.project - echo " ghc-options: -O0" >> cabal.project - - name: Build the server # Try building it twice in case of flakey builds on Windows run: | From 616f913c91996479cad030e1aea903551871ae3d Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 08:21:29 +0100 Subject: [PATCH 47/53] Correct workflow --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e69a17fa80..54e278cffc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,9 +42,9 @@ jobs: - uses: actions/checkout@v2 - uses: ./.github/actions/setup-build - with: - ghc: ${{ matrix.ghc }} - os: ${{ runner.os }} + with: + ghc: ${{ matrix.ghc }} + os: ${{ runner.os }} # some alpines come with integer-simple instead of integer-gmp - name: Force integer-simple From ab6bbcffc593081af9e8dc45ad3c8b98c6633b42 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 08:26:56 +0100 Subject: [PATCH 48/53] Build flags for al major os's --- .github/workflows/flags.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index 1d52a7eeb8..b133b2079e 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -43,7 +43,11 @@ jobs: strategy: fail-fast: true matrix: - ghc: [ "8.10.7" + ghc: [ "9.2.1" + , "9.0.2" + , "8.10.7" + , "8.8.4" + , "8.6.5" ] os: [ "ubuntu-latest" ] @@ -65,7 +69,9 @@ jobs: - name: Build `ghcide` with flags run: cabal v2-build ghcide --flags="ghc-patched-unboxed-bytecode test-exe executable bench-exe" - - name: Build with pedantic (-WError) + # we have to clean up warnings for 9.0 and 9.2 before enable -WAll + - if: matrix.ghc != '9.0.2' && matrix.ghc != '9.2.1' + name: Build with pedantic (-WError) run: cabal v2-build --flags="pedantic" flags_post_job: From bee6145292db0f0c69946f9b17ea6c7e491155d3 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 09:07:39 +0100 Subject: [PATCH 49/53] The integer twaek is needed for the solver --- .github/actions/setup-build/action.yml | 9 +++++++++ .github/workflows/build.yml | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index c0e01ebe5e..f381e88ff4 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -54,6 +54,15 @@ runs: fi shell: bash + # some alpines come with integer-simple instead of integer-gmp + - if: inputs.os == 'Linux' + name: Force integer-simple + run: | + if ghc --info | grep -q integer-simple ; then + echo -e 'flags: +integer-simple' >> cabal.project.local + fi + shell: bash + - if: inputs.os == 'Windows' && inputs.ghc == '8.8.4' name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults run: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54e278cffc..5b21a6c201 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,14 +46,6 @@ jobs: ghc: ${{ matrix.ghc }} os: ${{ runner.os }} - # some alpines come with integer-simple instead of integer-gmp - - name: Force integer-simple - if: matrix.os == 'ubuntu-18.04' - run: | - if ghc --info | grep -q integer-simple ; then - echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local - fi - - name: (Windows) Platform specifics if: matrix.os == 'windows-latest' env: From efa815358402e2ae3d033adf8cc9a60c64f14fb1 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 09:14:53 +0100 Subject: [PATCH 50/53] Disable tests beforehand --- .github/actions/setup-build/action.yml | 4 ++-- .github/workflows/build.yml | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index f381e88ff4..2e7c53f543 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -66,8 +66,8 @@ runs: - if: inputs.os == 'Windows' && inputs.ghc == '8.8.4' name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults run: | - echo "package floskell" >> cabal.project - echo " ghc-options: -O0" >> cabal.project + echo -e 'package floskell' >> cabal.project.local + echo -e ' ghc-options: -O0' >> cabal.project.local shell: bash # Shorten binary names as a workaround for filepath length limits in Windows, diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b21a6c201..32c086981c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,11 @@ jobs: apk add --no-cache zlib zlib-dev zlib-static gmp gmp-dev ncurses-static - uses: actions/checkout@v2 + - name: Disable tests and bechmarks + run: | + echo -e 'tests: false' >> cabal.project.local + echo -e 'benchmarks: false' >> cabal.project.local + - uses: ./.github/actions/setup-build with: ghc: ${{ matrix.ghc }} @@ -72,8 +77,7 @@ jobs: - name: Build the server # Try building it twice in case of flakey builds on Windows run: | - cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS || \ - cabal build --disable-tests exe:hls -O2 $LINUX_CABAL_ARGS -j1 + cabal build exe:hls -O2 $LINUX_CABAL_ARGS || cabal build exe:hls -O2 $LINUX_CABAL_ARGS -j1 - name: Compress server binary id: compress_server_binary @@ -112,7 +116,7 @@ jobs: - name: (GHC 8.10) Build the wrapper if: matrix.ghc == '8.10.7' - run: cabal build --disable-tests exe:hls-wrapper -O2 $LINUX_CABAL_ARGS + run: cabal build exe:hls-wrapper -O2 $LINUX_CABAL_ARGS - name: (GHC 8.10) Compress wrapper binary if: matrix.ghc == '8.10.7' From aabb123cf3fc658604d5e4ff9b1c3392b95d94fa Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 09:20:54 +0100 Subject: [PATCH 51/53] flags only affect local packages --- .github/actions/setup-build/action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml index 2e7c53f543..ff44232a1b 100644 --- a/.github/actions/setup-build/action.yml +++ b/.github/actions/setup-build/action.yml @@ -59,15 +59,14 @@ runs: name: Force integer-simple run: | if ghc --info | grep -q integer-simple ; then - echo -e 'flags: +integer-simple' >> cabal.project.local + echo -e 'package blaze-textual\n flags: +integer-simple' >> cabal.project.local fi shell: bash - if: inputs.os == 'Windows' && inputs.ghc == '8.8.4' name: (Windows,GHC 8.8) Modify `cabal.project` to workaround segfaults run: | - echo -e 'package floskell' >> cabal.project.local - echo -e ' ghc-options: -O0' >> cabal.project.local + echo -e 'package floskell\n ghc-options: -O0' >> cabal.project.local shell: bash # Shorten binary names as a workaround for filepath length limits in Windows, From 9d44a4005283424b2dd91b0cbff695d3e970b710 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 10:23:20 +0100 Subject: [PATCH 52/53] Exclude 8.6.5 --- .github/workflows/flags.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index b133b2079e..c1655dd627 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -63,7 +63,8 @@ jobs: - name: Build `hls-graph` with flags run: cabal v2-build hls-graph --flags="embed-files stm-stats" - - name: Build `hie-compat` with flags + - if: matrix.ghc != '8.6.5' + name: Build `hie-compat` with flags run: cabal v2-build hie-compat --flags="ghc-lib" - name: Build `ghcide` with flags From 20f1fbb9b4e8c3589e363b4caa7e8492702b22f5 Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 20 Jan 2022 11:36:25 +0100 Subject: [PATCH 53/53] Exclude 8.8.4 --- .github/workflows/flags.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flags.yml b/.github/workflows/flags.yml index c1655dd627..1f7e659a04 100644 --- a/.github/workflows/flags.yml +++ b/.github/workflows/flags.yml @@ -63,7 +63,7 @@ jobs: - name: Build `hls-graph` with flags run: cabal v2-build hls-graph --flags="embed-files stm-stats" - - if: matrix.ghc != '8.6.5' + - if: matrix.ghc != '8.6.5' && matrix.ghc != '8.8.4' name: Build `hie-compat` with flags run: cabal v2-build hie-compat --flags="ghc-lib"