diff --git a/.github/generate-ci/gen_ci.hs b/.github/generate-ci/gen_ci.hs index 20b316db2b..28a81d8576 100644 --- a/.github/generate-ci/gen_ci.hs +++ b/.github/generate-ci/gen_ci.hs @@ -1,21 +1,21 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE RecordWildCards #-} -import Control.Monad -import Data.Maybe +import Control.Monad +import Data.Maybe -import Data.Aeson hiding ( encode ) -import Data.Aeson.Types (Pair) -import qualified Data.Aeson.Key as K -import Data.Yaml +import Data.Aeson hiding (encode) +import qualified Data.Aeson.Key as K +import Data.Aeson.Types (Pair) +import Data.Yaml -import qualified Data.ByteString as BS +import qualified Data.ByteString as BS -import qualified Data.List as L +import qualified Data.List as L -import System.Directory -import System.FilePath -import System.Environment +import System.Directory +import System.Environment +import System.FilePath ------------------------------------------------------------------------------- -- Configuration parameters @@ -27,8 +27,8 @@ data Opsys | Windows deriving (Eq) osName :: Opsys -> String -osName Darwin = "mac" -osName Windows = "windows" +osName Darwin = "mac" +osName Windows = "windows" osName (Linux d) = "linux-" ++ distroName d data Distro @@ -52,27 +52,25 @@ allDistros = [minBound .. maxBound] data Arch = Amd64 | AArch64 archName :: Arch -> String -archName Amd64 = "x86_64" +archName Amd64 = "x86_64" archName AArch64 = "aarch64" artifactName :: Arch -> Opsys -> String artifactName arch opsys = archName arch ++ "-" ++ case opsys of Linux distro -> "linux-" ++ distroName distro - Darwin -> "apple-darwin" - Windows -> "mingw64" + Darwin -> "apple-darwin" + Windows -> "mingw64" data GHC - = GHC948 - | GHC967 + = GHC967 | GHC984 | GHC9102 | GHC9122 deriving (Eq, Enum, Bounded) ghcVersion :: GHC -> String -ghcVersion GHC948 = "9.4.8" -ghcVersion GHC967 = "9.6.7" -ghcVersion GHC984 = "9.8.4" +ghcVersion GHC967 = "9.6.7" +ghcVersion GHC984 = "9.8.4" ghcVersion GHC9102 = "9.10.2" ghcVersion GHC9122 = "9.12.2" @@ -89,34 +87,34 @@ data Stage = Build GHC | Bindist | Test ------------------------------------------------------------------------------- distroImage :: Distro -> String -distroImage Debian9 = "debian:9" -distroImage Debian10 = "debian:10" -distroImage Debian11 = "debian:11" -distroImage Debian12 = "debian:12" +distroImage Debian9 = "debian:9" +distroImage Debian10 = "debian:10" +distroImage Debian11 = "debian:11" +distroImage Debian12 = "debian:12" distroImage Ubuntu1804 = "ubuntu:18.04" distroImage Ubuntu2004 = "ubuntu:20.04" distroImage Ubuntu2204 = "ubuntu:22.04" -distroImage Mint193 = "linuxmintd/mint19.3-amd64" -distroImage Mint202 = "linuxmintd/mint20.2-amd64" -distroImage Mint213 = "linuxmintd/mint21.3-amd64" -distroImage Fedora33 = "fedora:33" -distroImage Fedora40 = "fedora:40" -distroImage Rocky8 = "rockylinux:8" +distroImage Mint193 = "linuxmintd/mint19.3-amd64" +distroImage Mint202 = "linuxmintd/mint20.2-amd64" +distroImage Mint213 = "linuxmintd/mint21.3-amd64" +distroImage Fedora33 = "fedora:33" +distroImage Fedora40 = "fedora:40" +distroImage Rocky8 = "rockylinux:8" distroName :: Distro -> String -distroName Debian9 = "deb9" -distroName Debian10 = "deb10" -distroName Debian11 = "deb11" -distroName Debian12 = "deb12" +distroName Debian9 = "deb9" +distroName Debian10 = "deb10" +distroName Debian11 = "deb11" +distroName Debian12 = "deb12" distroName Ubuntu1804 = "ubuntu1804" distroName Ubuntu2004 = "ubuntu2004" distroName Ubuntu2204 = "ubuntu2204" -distroName Mint193 = "mint193" -distroName Mint202 = "mint202" -distroName Mint213 = "mint213" -distroName Fedora33 = "fedora33" -distroName Fedora40 = "fedora40" -distroName Rocky8 = "unknown" +distroName Mint193 = "mint193" +distroName Mint202 = "mint202" +distroName Mint213 = "mint213" +distroName Fedora33 = "fedora33" +distroName Fedora40 = "fedora40" +distroName Rocky8 = "unknown" distroInstall :: Distro -> String distroInstall Debian9 = "sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list && sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list && sed -i /-updates/d /etc/apt/sources.list && apt-get update && apt-get install -y" @@ -165,13 +163,13 @@ envVars arch os = object $ baseEnv ++ [ "TARBALL_EXT" .= str (case os of Windows -> "zip" - _ -> "tar.xz") + _ -> "tar.xz") , "ARCH" .= str (case arch of - Amd64 -> "64" + Amd64 -> "64" AArch64 -> "ARM64") , "ADD_CABAL_ARGS" .= str (case (os,arch) of (Linux _, Amd64) -> "--enable-split-sections" - _ -> "") + _ -> "") , "ARTIFACT" .= artifactName arch os ] ++ [ "DEBIAN_FRONTEND" .= str "noninteractive" @@ -186,21 +184,21 @@ envVars arch os = object $ -- | Runner selection runner :: Arch -> Opsys -> [Value] -runner Amd64 (Linux _) = ["ubuntu-latest"] +runner Amd64 (Linux _) = ["ubuntu-latest"] runner AArch64 (Linux _) = ["self-hosted", "Linux", "ARM64", "maerwald"] -runner Amd64 Darwin = ["macOS-13"] -runner AArch64 Darwin = ["self-hosted", "macOS", "ARM64"] -runner Amd64 Windows = ["windows-latest"] -runner AArch64 Windows = error "aarch64 windows not supported" +runner Amd64 Darwin = ["macOS-13"] +runner AArch64 Darwin = ["self-hosted", "macOS", "ARM64"] +runner Amd64 Windows = ["windows-latest"] +runner AArch64 Windows = error "aarch64 windows not supported" -- | Runner selection for bindist jobs bindistRunner :: Arch -> Opsys -> [Value] -bindistRunner Amd64 (Linux _) = ["self-hosted", "linux-space", "maerwald"] +bindistRunner Amd64 (Linux _) = ["self-hosted", "linux-space", "maerwald"] bindistRunner AArch64 (Linux _) = ["self-hosted", "Linux", "ARM64", "maerwald"] -bindistRunner Amd64 Darwin = ["macOS-13"] -bindistRunner AArch64 Darwin = ["self-hosted", "macOS", "ARM64"] -bindistRunner Amd64 Windows = ["windows-latest"] -bindistRunner AArch64 Windows = error "aarch64 windows not supported" +bindistRunner Amd64 Darwin = ["macOS-13"] +bindistRunner AArch64 Darwin = ["self-hosted", "macOS", "ARM64"] +bindistRunner Amd64 Windows = ["windows-latest"] +bindistRunner AArch64 Windows = error "aarch64 windows not supported" ------------------------------------------------------------------------------- -- Action generatation @@ -220,7 +218,7 @@ bindistRunner AArch64 Windows = error "aarch64 windows not supported" -- called 'actionName', located at 'actionPath' data Action = Action - { actionName :: String + { actionName :: String , actionDistro :: Distro } @@ -259,7 +257,7 @@ instance ToJSON Action where configAction :: Config -> Maybe Action configAction (MkConfig Amd64 (Linux d) _) = Just $ Action (distroActionName d) d -configAction _ = Nothing +configAction _ = Nothing distroActionName :: Distro -> String distroActionName d = "action-" ++ distroName d @@ -279,7 +277,7 @@ customAction d st = flip (ghAction stepName (actionPath d)) [] $ case st of where stepName = case st of Build v -> "Build " ++ ghcVersion v - Test -> "Test" + Test -> "Test" Bindist -> "Bindist" ------------------------------------------------------------------------------- diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index f62a8d1cd1..bdd770acd0 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -44,7 +44,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest] + # TODO: Fix compilation problems on macOS. + # os: [ubuntu-latest, macOS-latest] + os: [ubuntu-latest] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 434b36e3fd..30c55d375a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,7 +18,6 @@ jobs: TZ: Asia/Singapore name: bindist-aarch64-linux-ubuntu2004 (Prepare bindist) needs: - - build-aarch64-linux-ubuntu2004-948 - build-aarch64-linux-ubuntu2004-967 - build-aarch64-linux-ubuntu2004-984 - build-aarch64-linux-ubuntu2004-9102 @@ -36,11 +35,6 @@ jobs: shell: bash - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-aarch64-linux-ubuntu2004-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -93,7 +87,6 @@ jobs: TZ: Asia/Singapore name: bindist-aarch64-mac (Prepare bindist) needs: - - build-aarch64-mac-948 - build-aarch64-mac-967 - build-aarch64-mac-984 - build-aarch64-mac-9102 @@ -105,11 +98,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-aarch64-mac-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -168,7 +156,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-deb10 (Prepare bindist) needs: - - build-x86_64-linux-deb10-948 - build-x86_64-linux-deb10-967 - build-x86_64-linux-deb10-984 - build-x86_64-linux-deb10-9102 @@ -180,11 +167,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-deb10-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -232,7 +214,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-deb11 (Prepare bindist) needs: - - build-x86_64-linux-deb11-948 - build-x86_64-linux-deb11-967 - build-x86_64-linux-deb11-984 - build-x86_64-linux-deb11-9102 @@ -244,11 +225,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-deb11-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -296,7 +272,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-deb12 (Prepare bindist) needs: - - build-x86_64-linux-deb12-948 - build-x86_64-linux-deb12-967 - build-x86_64-linux-deb12-984 - build-x86_64-linux-deb12-9102 @@ -308,11 +283,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-deb12-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -360,7 +330,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-deb9 (Prepare bindist) needs: - - build-x86_64-linux-deb9-948 - build-x86_64-linux-deb9-967 - build-x86_64-linux-deb9-984 - build-x86_64-linux-deb9-9102 @@ -372,11 +341,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-deb9-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -424,7 +388,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-fedora33 (Prepare bindist) needs: - - build-x86_64-linux-fedora33-948 - build-x86_64-linux-fedora33-967 - build-x86_64-linux-fedora33-984 - build-x86_64-linux-fedora33-9102 @@ -436,11 +399,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-fedora33-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -488,7 +446,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-fedora40 (Prepare bindist) needs: - - build-x86_64-linux-fedora40-948 - build-x86_64-linux-fedora40-967 - build-x86_64-linux-fedora40-984 - build-x86_64-linux-fedora40-9102 @@ -500,11 +457,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-fedora40-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -552,7 +504,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-mint193 (Prepare bindist) needs: - - build-x86_64-linux-mint193-948 - build-x86_64-linux-mint193-967 - build-x86_64-linux-mint193-984 - build-x86_64-linux-mint193-9102 @@ -564,11 +515,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-mint193-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -616,7 +562,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-mint202 (Prepare bindist) needs: - - build-x86_64-linux-mint202-948 - build-x86_64-linux-mint202-967 - build-x86_64-linux-mint202-984 - build-x86_64-linux-mint202-9102 @@ -628,11 +573,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-mint202-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -680,7 +620,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-mint213 (Prepare bindist) needs: - - build-x86_64-linux-mint213-948 - build-x86_64-linux-mint213-967 - build-x86_64-linux-mint213-984 - build-x86_64-linux-mint213-9102 @@ -692,11 +631,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-mint213-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -744,7 +678,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-ubuntu1804 (Prepare bindist) needs: - - build-x86_64-linux-ubuntu1804-948 - build-x86_64-linux-ubuntu1804-967 - build-x86_64-linux-ubuntu1804-984 - build-x86_64-linux-ubuntu1804-9102 @@ -756,11 +689,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-ubuntu1804-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -808,7 +736,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-ubuntu2004 (Prepare bindist) needs: - - build-x86_64-linux-ubuntu2004-948 - build-x86_64-linux-ubuntu2004-967 - build-x86_64-linux-ubuntu2004-984 - build-x86_64-linux-ubuntu2004-9102 @@ -820,11 +747,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-ubuntu2004-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -872,7 +794,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-ubuntu2204 (Prepare bindist) needs: - - build-x86_64-linux-ubuntu2204-948 - build-x86_64-linux-ubuntu2204-967 - build-x86_64-linux-ubuntu2204-984 - build-x86_64-linux-ubuntu2204-9102 @@ -884,11 +805,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-ubuntu2204-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -936,7 +852,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-linux-unknown (Prepare bindist) needs: - - build-x86_64-linux-unknown-948 - build-x86_64-linux-unknown-967 - build-x86_64-linux-unknown-984 - build-x86_64-linux-unknown-9102 @@ -948,11 +863,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-linux-unknown-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -1000,7 +910,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-mac (Prepare bindist) needs: - - build-x86_64-mac-948 - build-x86_64-mac-967 - build-x86_64-mac-984 - build-x86_64-mac-9102 @@ -1010,11 +919,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-mac-948 - path: ./ - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -1066,7 +970,6 @@ jobs: TZ: Asia/Singapore name: bindist-x86_64-windows (Prepare bindist) needs: - - build-x86_64-windows-948 - build-x86_64-windows-967 - build-x86_64-windows-984 - build-x86_64-windows-9102 @@ -1076,11 +979,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: artifacts-build-x86_64-windows-948 - path: ./out - name: Download artifacts uses: actions/download-artifact@v4 with: @@ -1211,51 +1109,6 @@ jobs: name: artifacts-build-aarch64-linux-ubuntu2004-9122 path: out-aarch64-linux-ubuntu2004-9.12.2.tar retention-days: 2 - build-aarch64-linux-ubuntu2004-948: - env: - ADD_CABAL_ARGS: '' - ARCH: ARM64 - ARTIFACT: aarch64-linux-ubuntu2004 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-aarch64-linux-ubuntu2004-948 (Build binaries) - runs-on: - - self-hosted - - Linux - - ARM64 - - maerwald - steps: - - name: clean and git config for aarch64-linux - run: | - find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} + - git config --global --get-all safe.directory | grep '^\*$' || git config --global --add safe.directory "*" - shell: bash - - name: Checkout - uses: actions/checkout@v4 - - env: - GHC_VERSION: 9.4.8 - name: Build aarch64-linux binaries - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal - with: - args: bash .github/scripts/build.sh - - env: - GHC_VERSION: 9.4.8 - name: Tar aarch64-linux binaries - uses: docker://hasufell/arm64v8-ubuntu-haskell:focal - with: - args: bash .github/scripts/tar.sh - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-aarch64-linux-ubuntu2004-948 - path: out-aarch64-linux-ubuntu2004-9.4.8.tar - retention-days: 2 build-aarch64-linux-ubuntu2004-967: env: ADD_CABAL_ARGS: '' @@ -1422,44 +1275,6 @@ jobs: name: artifacts-build-aarch64-mac-9122 path: out-aarch64-apple-darwin-9.12.2.tar retention-days: 2 - build-aarch64-mac-948: - env: - ADD_CABAL_ARGS: '' - ARCH: ARM64 - ARTIFACT: aarch64-apple-darwin - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - HOMEBREW_CHANGE_ARCH_TO_ARM: '1' - MACOSX_DEPLOYMENT_TARGET: '10.13' - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-aarch64-mac-948 (Build binaries) - runs-on: - - self-hosted - - macOS - - ARM64 - steps: - - name: Checkout - uses: actions/checkout@v4 - - env: - GHC_VERSION: 9.4.8 - name: Run build - run: | - bash .github/scripts/brew.sh git coreutils autoconf automake tree - export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH" - export LD=ld - bash .github/scripts/build.sh - tar cf out-${ARTIFACT}-${GHC_VERSION}.tar out/ store/ - shell: sh - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-aarch64-mac-948 - path: out-aarch64-apple-darwin-9.4.8.tar - retention-days: 2 build-aarch64-mac-967: env: ADD_CABAL_ARGS: '' @@ -1596,36 +1411,6 @@ jobs: name: artifacts-build-x86_64-linux-deb10-9122 path: out-x86_64-linux-deb10-9.12.2.tar retention-days: 2 - build-x86_64-linux-deb10-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-deb10 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-deb10-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-deb10 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-deb10-948 - path: out-x86_64-linux-deb10-9.4.8.tar - retention-days: 2 build-x86_64-linux-deb10-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -1746,36 +1531,6 @@ jobs: name: artifacts-build-x86_64-linux-deb11-9122 path: out-x86_64-linux-deb11-9.12.2.tar retention-days: 2 - build-x86_64-linux-deb11-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-deb11 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-deb11-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-deb11 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-deb11-948 - path: out-x86_64-linux-deb11-9.4.8.tar - retention-days: 2 build-x86_64-linux-deb11-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -1896,36 +1651,6 @@ jobs: name: artifacts-build-x86_64-linux-deb12-9122 path: out-x86_64-linux-deb12-9.12.2.tar retention-days: 2 - build-x86_64-linux-deb12-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-deb12 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-deb12-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-deb12 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-deb12-948 - path: out-x86_64-linux-deb12-9.4.8.tar - retention-days: 2 build-x86_64-linux-deb12-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -2046,36 +1771,6 @@ jobs: name: artifacts-build-x86_64-linux-deb9-9122 path: out-x86_64-linux-deb9-9.12.2.tar retention-days: 2 - build-x86_64-linux-deb9-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-deb9 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-deb9-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-deb9 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-deb9-948 - path: out-x86_64-linux-deb9-9.4.8.tar - retention-days: 2 build-x86_64-linux-deb9-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -2196,36 +1891,6 @@ jobs: name: artifacts-build-x86_64-linux-fedora33-9122 path: out-x86_64-linux-fedora33-9.12.2.tar retention-days: 2 - build-x86_64-linux-fedora33-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-fedora33 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-fedora33-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-fedora33 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-fedora33-948 - path: out-x86_64-linux-fedora33-9.4.8.tar - retention-days: 2 build-x86_64-linux-fedora33-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -2346,36 +2011,6 @@ jobs: name: artifacts-build-x86_64-linux-fedora40-9122 path: out-x86_64-linux-fedora40-9.12.2.tar retention-days: 2 - build-x86_64-linux-fedora40-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-fedora40 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-fedora40-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-fedora40 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-fedora40-948 - path: out-x86_64-linux-fedora40-9.4.8.tar - retention-days: 2 build-x86_64-linux-fedora40-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -2496,36 +2131,6 @@ jobs: name: artifacts-build-x86_64-linux-mint193-9122 path: out-x86_64-linux-mint193-9.12.2.tar retention-days: 2 - build-x86_64-linux-mint193-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-mint193 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-mint193-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-mint193 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-mint193-948 - path: out-x86_64-linux-mint193-9.4.8.tar - retention-days: 2 build-x86_64-linux-mint193-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -2646,36 +2251,6 @@ jobs: name: artifacts-build-x86_64-linux-mint202-9122 path: out-x86_64-linux-mint202-9.12.2.tar retention-days: 2 - build-x86_64-linux-mint202-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-mint202 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-mint202-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-mint202 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-mint202-948 - path: out-x86_64-linux-mint202-9.4.8.tar - retention-days: 2 build-x86_64-linux-mint202-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -2796,36 +2371,6 @@ jobs: name: artifacts-build-x86_64-linux-mint213-9122 path: out-x86_64-linux-mint213-9.12.2.tar retention-days: 2 - build-x86_64-linux-mint213-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-mint213 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-mint213-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-mint213 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-mint213-948 - path: out-x86_64-linux-mint213-9.4.8.tar - retention-days: 2 build-x86_64-linux-mint213-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -2946,36 +2491,6 @@ jobs: name: artifacts-build-x86_64-linux-ubuntu1804-9122 path: out-x86_64-linux-ubuntu1804-9.12.2.tar retention-days: 2 - build-x86_64-linux-ubuntu1804-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-ubuntu1804 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-ubuntu1804-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-ubuntu1804 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-ubuntu1804-948 - path: out-x86_64-linux-ubuntu1804-9.4.8.tar - retention-days: 2 build-x86_64-linux-ubuntu1804-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -3096,36 +2611,6 @@ jobs: name: artifacts-build-x86_64-linux-ubuntu2004-9122 path: out-x86_64-linux-ubuntu2004-9.12.2.tar retention-days: 2 - build-x86_64-linux-ubuntu2004-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-ubuntu2004 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-ubuntu2004-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-ubuntu2004 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-ubuntu2004-948 - path: out-x86_64-linux-ubuntu2004-9.4.8.tar - retention-days: 2 build-x86_64-linux-ubuntu2004-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -3246,36 +2731,6 @@ jobs: name: artifacts-build-x86_64-linux-ubuntu2204-9122 path: out-x86_64-linux-ubuntu2204-9.12.2.tar retention-days: 2 - build-x86_64-linux-ubuntu2204-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-ubuntu2204 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-ubuntu2204-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-ubuntu2204 - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-ubuntu2204-948 - path: out-x86_64-linux-ubuntu2204-9.4.8.tar - retention-days: 2 build-x86_64-linux-ubuntu2204-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -3396,36 +2851,6 @@ jobs: name: artifacts-build-x86_64-linux-unknown-9122 path: out-x86_64-linux-unknown-9.12.2.tar retention-days: 2 - build-x86_64-linux-unknown-948: - env: - ADD_CABAL_ARGS: --enable-split-sections - ARCH: '64' - ARTIFACT: x86_64-linux-unknown - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DEBIAN_FRONTEND: noninteractive - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-linux-unknown-948 (Build binaries) - runs-on: - - ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Build 9.4.8 - uses: ./.github/actions/bindist-actions/action-unknown - with: - stage: BUILD - version: 9.4.8 - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-linux-unknown-948 - path: out-x86_64-linux-unknown-9.4.8.tar - retention-days: 2 build-x86_64-linux-unknown-967: env: ADD_CABAL_ARGS: --enable-split-sections @@ -3552,39 +2977,6 @@ jobs: name: artifacts-build-x86_64-mac-9122 path: out-x86_64-apple-darwin-9.12.2.tar retention-days: 2 - build-x86_64-mac-948: - env: - ADD_CABAL_ARGS: '' - ARCH: '64' - ARTIFACT: x86_64-apple-darwin - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - MACOSX_DEPLOYMENT_TARGET: '10.13' - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: tar.xz - TZ: Asia/Singapore - environment: CI - name: build-x86_64-mac-948 (Build binaries) - runs-on: - - macOS-13 - steps: - - name: Checkout - uses: actions/checkout@v4 - - env: - GHC_VERSION: 9.4.8 - name: Run build - run: | - brew install coreutils tree - bash .github/scripts/build.sh - tar cf out-${ARTIFACT}-${GHC_VERSION}.tar out/ store/ - shell: sh - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-mac-948 - path: out-x86_64-apple-darwin-9.4.8.tar - retention-days: 2 build-x86_64-mac-967: env: ADD_CABAL_ARGS: '' @@ -3717,39 +3109,6 @@ jobs: name: artifacts-build-x86_64-windows-9122 path: ./out/* retention-days: 2 - build-x86_64-windows-948: - env: - ADD_CABAL_ARGS: '' - ARCH: '64' - ARTIFACT: x86_64-mingw64 - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - S3_HOST: ${{ secrets.S3_HOST }} - TARBALL_EXT: zip - TZ: Asia/Singapore - environment: CI - name: build-x86_64-windows-948 (Build binaries) - runs-on: - - windows-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - env: - GHC_VERSION: 9.4.8 - name: Run build - run: | - $env:CHERE_INVOKING = 1 - $env:MSYS2_PATH_TYPE = "inherit" - $ErrorActionPreference = "Stop" - C:\msys64\usr\bin\bash -lc "bash .github/scripts/build.sh" - shell: pwsh - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - if-no-files-found: error - name: artifacts-build-x86_64-windows-948 - path: ./out/* - retention-days: 2 build-x86_64-windows-967: env: ADD_CABAL_ARGS: '' diff --git a/.github/workflows/supported-ghc-versions.json b/.github/workflows/supported-ghc-versions.json index e46e627b7c..35a3bd4ac4 100644 --- a/.github/workflows/supported-ghc-versions.json +++ b/.github/workflows/supported-ghc-versions.json @@ -1 +1 @@ -["9.12", "9.10", "9.8", "9.6", "9.4"] +["9.12", "9.10", "9.8", "9.6"] diff --git a/docutils.nix b/docutils.nix deleted file mode 100644 index 1c47e1455d..0000000000 --- a/docutils.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ stdenv, lib, fetchPypi, buildPythonPackage, isPy3k, python }: - -buildPythonPackage rec { - pname = "docutils"; - version = "0.17.1"; - - src = fetchPypi { - inherit pname version; - sha256 = "686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125"; - }; - - # Only Darwin needs LANG, but we could set it in general. - # It's done here conditionally to prevent mass-rebuilds. - checkPhase = lib.optionalString (isPy3k && stdenv.isDarwin) - ''LANG="en_US.UTF-8" LC_ALL="en_US.UTF-8" '' + '' - ${python.interpreter} test/alltests.py - ''; - - # Create symlinks lacking a ".py" suffix, many programs depend on these names - postFixup = '' - for f in $out/bin/*.py; do - ln -s $(basename $f) $out/bin/$(basename $f .py) - done - ''; - - meta = with lib; { - description = "Python Documentation Utilities"; - homepage = "http://docutils.sourceforge.net/"; - license = with licenses; [ publicDomain bsd2 psfl gpl3Plus ]; - maintainers = with maintainers; [ AndersonTorres ]; - }; -} diff --git a/flake.lock b/flake.lock index 4efe1416b6..6093aecea0 100644 --- a/flake.lock +++ b/flake.lock @@ -36,11 +36,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1747467164, - "narHash": "sha256-JBXbjJ0t6T6BbVc9iPVquQI9XSXCGQJD8c8SgnUquus=", + "lastModified": 1748792178, + "narHash": "sha256-BHmgfHlCJVNisJShVaEmfDIr/Ip58i/4oFGlD1iK6lk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3fcbdcfc707e0aa42c541b7743e05820472bdaec", + "rev": "5929de975bcf4c7c8d8b5ca65c8cd9ef9e44523e", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7eaa320bdf..5ed4233fd1 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,8 @@ outputs = { nixpkgs, flake-utils, ... }: - flake-utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] + flake-utils.lib.eachSystem + [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] (system: let pkgs = import nixpkgs { @@ -21,11 +22,18 @@ config = { allowBroken = true; }; }; - pythonWithPackages = pkgs.python3.withPackages (ps: [ps.sphinx ps.myst-parser ps.sphinx_rtd_theme ps.pip]); + pythonWithPackages = pkgs.python3.withPackages (ps: + [ ps.docutils + ps.myst-parser + ps.pip + ps.sphinx + ps.sphinx_rtd_theme + ]); docs = pkgs.stdenv.mkDerivation { name = "hls-docs"; - src = pkgs.lib.sourceFilesBySuffices ./. [ ".py" ".rst" ".md" ".png" ".gif" ".svg" ".cabal" ]; + src = pkgs.lib.sourceFilesBySuffices ./. + [ ".py" ".rst" ".md" ".png" ".gif" ".svg" ".cabal" ]; buildInputs = [ pythonWithPackages ]; buildPhase = '' cd docs @@ -64,7 +72,7 @@ # for compatibility of curl with provided gcc curl # Changelog tooling - (gen-hls-changelogs pkgs.haskellPackages) + (gen-hls-changelogs hpkgs) # For the documentation pythonWithPackages (pkgs.haskell.lib.justStaticExecutables (pkgs.haskell.lib.dontCheck pkgs.haskellPackages.opentelemetry-extra)) @@ -92,21 +100,17 @@ ''; }; - in rec { + in { # Developement shell with only dev tools devShells = { default = mkDevShell pkgs.haskellPackages; - shell-ghc94 = mkDevShell pkgs.haskell.packages.ghc94; shell-ghc96 = mkDevShell pkgs.haskell.packages.ghc96; shell-ghc98 = mkDevShell pkgs.haskell.packages.ghc98; shell-ghc910 = mkDevShell pkgs.haskell.packages.ghc910; + shell-ghc912 = mkDevShell pkgs.haskell.packages.ghc912; }; packages = { inherit docs; }; - - # The attributes for the default shell and package changed in recent versions of Nix, - # these are here for backwards compatibility with the old versions. - devShell = devShells.default; }); nixConfig = { diff --git a/ghcide-test/exe/CompletionTests.hs b/ghcide-test/exe/CompletionTests.hs index a980d47233..8e80a37a8f 100644 --- a/ghcide-test/exe/CompletionTests.hs +++ b/ghcide-test/exe/CompletionTests.hs @@ -276,8 +276,7 @@ nonLocalCompletionTests = where brokenForWinGhc = knownBrokenOnWindows "Windows has strange things in scope for some reason" brokenForWinOldGhc = - knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC94] "Windows (GHC == 9.4) has strange things in scope for some reason" - . knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC96] "Windows (GHC == 9.6) has strange things in scope for some reason" + knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC96] "Windows (GHC == 9.6) has strange things in scope for some reason" . knownBrokenInSpecificEnv [HostOS Windows, GhcVer GHC98] "Windows (GHC == 9.8) has strange things in scope for some reason" otherCompletionTests :: [TestTree] @@ -350,10 +349,11 @@ packageCompletionTests = , _label == "fromList" ] liftIO $ take 3 (sort compls') @?= - map ("Defined in "<>) ( - [ "'Data.List.NonEmpty" + map ("Defined in "<>) [ + "'Data.List.NonEmpty" , "'GHC.Exts" - ] ++ (["'GHC.IsList" | ghcVersion >= GHC94])) + , "'GHC.IsList" + ] , testSessionEmptyWithCradle "Map" "cradle: {direct: {arguments: [-hide-all-packages, -package, base, -package, containers, A]}}" $ do doc <- createDoc "A.hs" "haskell" $ T.unlines diff --git a/ghcide-test/exe/DiagnosticTests.hs b/ghcide-test/exe/DiagnosticTests.hs index 615e6ad69e..52aba0b9b7 100644 --- a/ghcide-test/exe/DiagnosticTests.hs +++ b/ghcide-test/exe/DiagnosticTests.hs @@ -343,19 +343,9 @@ tests = testGroup "diagnostics" expectDiagnostics [ ( "Main.hs" , [(DiagnosticSeverity_Error, (6, 9), - if ghcVersion >= GHC96 then - "Variable not in scope: ThisList.map" - else if ghcVersion >= GHC94 then - "Variable not in scope: map" -- See https://gitlab.haskell.org/ghc/ghc/-/issues/22130 - else - "Not in scope: \8216ThisList.map\8217", Just "GHC-88464") + "Variable not in scope: ThisList.map", Just "GHC-88464") ,(DiagnosticSeverity_Error, (7, 9), - if ghcVersion >= GHC96 then - "Variable not in scope: BaseList.x" - else if ghcVersion >= GHC94 then - "Variable not in scope: x" -- See https://gitlab.haskell.org/ghc/ghc/-/issues/22130 - else - "Not in scope: \8216BaseList.x\8217", Just "GHC-88464") + "Variable not in scope: BaseList.x", Just "GHC-88464") ] ) ] @@ -373,7 +363,7 @@ tests = testGroup "diagnostics" -- where appropriate. The warning should use an unqualified name 'Ord', not -- something like 'GHC.Classes.Ord'. The choice of redundant-constraints to -- test this is fairly arbitrary. - , [(DiagnosticSeverity_Warning, (2, if ghcVersion >= GHC94 then 7 else 0), "Redundant constraint: Ord a", Just "GHC-30606") + , [(DiagnosticSeverity_Warning, (2, 7), "Redundant constraint: Ord a", Just "GHC-30606") ] ) ] diff --git a/ghcide-test/exe/FindDefinitionAndHoverTests.hs b/ghcide-test/exe/FindDefinitionAndHoverTests.hs index e46141df4e..7920ff4949 100644 --- a/ghcide-test/exe/FindDefinitionAndHoverTests.hs +++ b/ghcide-test/exe/FindDefinitionAndHoverTests.hs @@ -187,7 +187,7 @@ tests = let holeL65 = Position 65 8 ; hleInfo2 = [ExpectHoverText ["_ :: a -> Maybe a"]] cccL17 = Position 17 16 ; docLink = [ExpectHoverTextRegex "\\*Defined in 'GHC.Types'\\* \\*\\(ghc-prim-[0-9.]+\\)\\*\n\n"] imported = Position 56 13 ; importedSig = getDocUri "Foo.hs" >>= \foo -> return [ExpectHoverText ["foo", "Foo", "Haddock"], mkL foo 5 0 5 3] - reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], if ghcVersion >= GHC94 && ghcVersion < GHC910 then mkL bar 3 5 3 8 else mkL bar 3 0 3 14] + reexported = Position 55 14 ; reexportedSig = getDocUri "Bar.hs" >>= \bar -> return [ExpectHoverText ["Bar", "Bar", "Haddock"], if ghcVersion < GHC910 then mkL bar 3 5 3 8 else mkL bar 3 0 3 14] thLocL57 = Position 59 10 ; thLoc = [ExpectHoverText ["Identity"]] cmtL68 = Position 67 0 ; lackOfdEq = [ExpectHoverExcludeText ["$dEq"]] import310 = Position 3 10; pkgTxt = [ExpectHoverText ["Data.Text\n\ntext-"]] diff --git a/ghcide/ghcide.cabal b/ghcide/ghcide.cabal index dcf171c8a1..6ab42d8f3a 100644 --- a/ghcide/ghcide.cabal +++ b/ghcide/ghcide.cabal @@ -14,7 +14,7 @@ homepage: https://github.com/haskell/haskell-language-server/tree/master/ghcide#readme bug-reports: https://github.com/haskell/haskell-language-server/issues -tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8 +tested-with: GHC == {9.12.2, 9.10.1, 9.8.4, 9.6.7} extra-source-files: CHANGELOG.md README.md diff --git a/ghcide/session-loader/Development/IDE/Session.hs b/ghcide/session-loader/Development/IDE/Session.hs index a2dbbb1e15..78bfb798af 100644 --- a/ghcide/session-loader/Development/IDE/Session.hs +++ b/ghcide/session-loader/Development/IDE/Session.hs @@ -798,7 +798,7 @@ setNameCache nc hsc = hsc { hsc_NC = nc } -- Moved back to implementation in GHC. checkHomeUnitsClosed' :: UnitEnv -> OS.Set UnitId -> [DriverMessages] checkHomeUnitsClosed' ue _ = checkHomeUnitsClosed ue -#elif MIN_VERSION_ghc(9,3,0) +#else -- This function checks the important property that if both p and q are home units -- then any dependency of p, which transitively depends on q is also a home unit. -- GHC had an implementation of this function, but it was horribly inefficient @@ -888,11 +888,7 @@ newComponentCache recorder exts _cfp hsc_env old_cis new_cis = do ideErrorWithSource (Just "cradle") (Just DiagnosticSeverity_Warning) _cfp (T.pack (Compat.printWithoutUniques (singleMessage err))) -#if MIN_VERSION_ghc(9,5,0) (Just (fmap GhcDriverMessage err)) -#else - Nothing -#endif multi_errs = map closure_err_to_multi_err closure_errs bad_units = OS.fromList $ concat $ do x <- map errMsgDiagnostic closure_errs diff --git a/ghcide/src/Development/IDE/Core/Compile.hs b/ghcide/src/Development/IDE/Core/Compile.hs index ed5e14a70a..552409fbba 100644 --- a/ghcide/src/Development/IDE/Core/Compile.hs +++ b/ghcide/src/Development/IDE/Core/Compile.hs @@ -39,79 +39,77 @@ module Development.IDE.Core.Compile , setNonHomeFCHook ) where -import Control.Concurrent.STM.Stats hiding (orElse) -import Control.DeepSeq (NFData (..), force, - rnf) -import Control.Exception (evaluate) +import Control.Concurrent.STM.Stats hiding (orElse) +import Control.DeepSeq (NFData (..), + force, rnf) +import Control.Exception (evaluate) import Control.Exception.Safe -import Control.Lens hiding (List, pre, - (<.>)) +import Control.Lens hiding (List, pre, + (<.>)) import Control.Monad.Extra import Control.Monad.IO.Class import Control.Monad.Trans.Except -import qualified Control.Monad.Trans.State.Strict as S -import Data.Aeson (toJSON) -import Data.Bifunctor (first, second) +import qualified Control.Monad.Trans.State.Strict as S +import Data.Aeson (toJSON) +import Data.Bifunctor (first, second) import Data.Binary -import qualified Data.ByteString as BS +import qualified Data.ByteString as BS import Data.Coerce -import qualified Data.DList as DL +import qualified Data.DList as DL import Data.Functor import Data.Generics.Aliases import Data.Generics.Schemes -import qualified Data.HashMap.Strict as HashMap -import Data.IntMap (IntMap) +import qualified Data.HashMap.Strict as HashMap +import Data.IntMap (IntMap) import Data.IORef import Data.List.Extra -import qualified Data.List.NonEmpty as NE -import qualified Data.Map.Strict as Map +import qualified Data.Map.Strict as Map import Data.Maybe -import Data.Proxy (Proxy (Proxy)) -import qualified Data.Text as T -import Data.Time (UTCTime (..), getCurrentTime) -import Data.Tuple.Extra (dupe) +import Data.Proxy (Proxy (Proxy)) +import qualified Data.Text as T +import Data.Time (UTCTime (..)) +import Data.Tuple.Extra (dupe) import Debug.Trace -import Development.IDE.Core.FileStore (resetInterfaceStore) +import Development.IDE.Core.FileStore (resetInterfaceStore) import Development.IDE.Core.Preprocessor -import Development.IDE.Core.ProgressReporting (progressUpdate) +import Development.IDE.Core.ProgressReporting (progressUpdate) import Development.IDE.Core.RuleTypes import Development.IDE.Core.Shake -import Development.IDE.Core.Tracing (withTrace) -import Development.IDE.GHC.Compat hiding (assert, - loadInterface, - parseHeader, - parseModule, - tcRnModule, - writeHieFile) -import qualified Development.IDE.GHC.Compat as Compat -import qualified Development.IDE.GHC.Compat as GHC -import qualified Development.IDE.GHC.Compat.Util as Util +import Development.IDE.Core.Tracing (withTrace) +import qualified Development.IDE.GHC.Compat as Compat +import qualified Development.IDE.GHC.Compat as GHC +import Development.IDE.GHC.Compat.Driver (hscTypecheckRenameWithDiagnostics) +import qualified Development.IDE.GHC.Compat.Util as Util import Development.IDE.GHC.CoreFile import Development.IDE.GHC.Error -import Development.IDE.GHC.Orphans () +import Development.IDE.GHC.Orphans () import Development.IDE.GHC.Util import Development.IDE.GHC.Warnings +import Development.IDE.Import.DependencyInformation import Development.IDE.Types.Diagnostics import Development.IDE.Types.Location import Development.IDE.Types.Options -import GHC (ForeignHValue, - GetDocsFailure (..), - parsedSource, ModLocation (..)) -import qualified GHC.LanguageExtensions as LangExt +import GHC (ForeignHValue, + GetDocsFailure (..), + ModLocation (..), + parsedSource) +import qualified GHC.LanguageExtensions as LangExt import GHC.Serialized -import HieDb hiding (withHieDb) -import qualified Language.LSP.Protocol.Message as LSP -import Language.LSP.Protocol.Types (DiagnosticTag (..)) -import qualified Language.LSP.Server as LSP -import Prelude hiding (mod) +import HieDb hiding (withHieDb) +import qualified Language.LSP.Protocol.Message as LSP +import Language.LSP.Protocol.Types (DiagnosticTag (..)) +import qualified Language.LSP.Server as LSP +import Prelude hiding (mod) import System.Directory import System.FilePath -import System.IO.Extra (fixIO, - newTempFileWithin) +import System.IO.Extra (fixIO, + newTempFileWithin) -import qualified Data.Set as Set -import qualified GHC as G -import qualified GHC.Runtime.Loader as Loader +import qualified Data.Set as Set +import qualified GHC as G +import GHC.Core.Lint.Interactive +import GHC.Driver.Config.CoreToStg.Prep +import qualified GHC.Runtime.Loader as Loader import GHC.Tc.Gen.Splice import GHC.Types.Error import GHC.Types.ForeignStubs @@ -120,24 +118,38 @@ import GHC.Types.TypeEnv -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] - -#if MIN_VERSION_ghc(9,5,0) -import GHC.Core.Lint.Interactive -import GHC.Driver.Config.CoreToStg.Prep -#endif - #if MIN_VERSION_ghc(9,7,0) -import Data.Foldable (toList) +import Data.Foldable (toList) import GHC.Unit.Module.Warnings #else -import Development.IDE.Core.FileStore (shareFilePath) +import Development.IDE.Core.FileStore (shareFilePath) #endif -import Development.IDE.GHC.Compat.Driver (hscTypecheckRenameWithDiagnostics) +#if MIN_VERSION_ghc(9,10,0) +import Development.IDE.GHC.Compat hiding (assert, + loadInterface, + parseHeader, + parseModule, + tcRnModule, + writeHieFile) +#else +import Development.IDE.GHC.Compat hiding + (loadInterface, + parseHeader, + parseModule, + tcRnModule, + writeHieFile) +#endif + +#if MIN_VERSION_ghc(9,11,0) +import qualified Data.List.NonEmpty as NE +import Data.Time (getCurrentTime) +import GHC.Driver.Env (hsc_all_home_unit_ids) +#endif -import Development.IDE.Import.DependencyInformation -import GHC.Driver.Env ( hsc_all_home_unit_ids ) -import Development.IDE.Import.FindImports +#if MIN_VERSION_ghc(9,12,0) +import Development.IDE.Import.FindImports +#endif --Simple constants to make sure the source is consistently named sourceTypecheck :: T.Text @@ -176,7 +188,7 @@ computePackageDeps env pkg = do data TypecheckHelpers = TypecheckHelpers - { getLinkables :: [NormalizedFilePath] -> IO [LinkableResult] -- ^ hls-graph action to get linkables for files + { getLinkables :: [NormalizedFilePath] -> IO [LinkableResult] -- ^ hls-graph action to get linkables for files , getModuleGraph :: IO DependencyInformation } @@ -470,9 +482,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do pure (details, guts) let !partial_iface = force $ mkPartialIface session -#if MIN_VERSION_ghc(9,5,0) (cg_binds guts) -#endif details ms #if MIN_VERSION_ghc(9,11,0) @@ -481,9 +491,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do simplified_guts final_iface' <- mkFullIface session partial_iface Nothing -#if MIN_VERSION_ghc(9,4,2) Nothing -#endif #if MIN_VERSION_ghc(9,11,0) NoStubs [] #endif @@ -524,17 +532,9 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do mod = ms_mod ms data_tycons = filter isDataTyCon tycons CgGuts{cg_binds = unprep_binds'} <- coreFileToCgGuts session final_iface details core - -#if MIN_VERSION_ghc(9,5,0) cp_cfg <- initCorePrepConfig session -#endif - let corePrep = corePrepPgm -#if MIN_VERSION_ghc(9,5,0) (hsc_logger session) cp_cfg (initCorePrepPgmConfig (hsc_dflags session) (interactiveInScope $ hsc_IC session)) -#else - session -#endif mod (ms_location ms) -- Run corePrep first as we want to test the final version of the program that will @@ -647,11 +647,7 @@ generateObjectCode session summary guts = do (Just dot_o) $ hsc_dflags env' session' = hscSetFlags newFlags session -#if MIN_VERSION_ghc(9,4,2) (outputFilename, _mStub, _foreign_files, _cinfos, _stgcinfos) <- hscGenHardCode session' guts -#else - (outputFilename, _mStub, _foreign_files, _cinfos) <- hscGenHardCode session' guts -#endif (ms_location summary) fp obj <- compileFile session' driverNoStop (outputFilename, Just (As False)) @@ -673,22 +669,31 @@ generateByteCode :: CoreFileTime -> HscEnv -> ModSummary -> CgGuts -> IO (IdeRes generateByteCode (CoreFileTime time) hscEnv summary guts = do fmap (either (, Nothing) (second Just)) $ catchSrcErrors (hsc_dflags hscEnv) "bytecode" $ do + #if MIN_VERSION_ghc(9,11,0) (warnings, (_, bytecode)) <- + withWarnings "bytecode" $ \_tweak -> do + let session = _tweak (hscSetFlags (ms_hspp_opts summary) hscEnv) + -- TODO: maybe settings ms_hspp_opts is unnecessary? + summary' = summary { ms_hspp_opts = hsc_dflags session } + hscInteractive session (mkCgInteractiveGuts guts) + (ms_location summary') #else (warnings, (_, bytecode, sptEntries)) <- -#endif withWarnings "bytecode" $ \_tweak -> do let session = _tweak (hscSetFlags (ms_hspp_opts summary) hscEnv) -- TODO: maybe settings ms_hspp_opts is unnecessary? summary' = summary { ms_hspp_opts = hsc_dflags session } hscInteractive session (mkCgInteractiveGuts guts) (ms_location summary') +#endif + #if MIN_VERSION_ghc(9,11,0) let linkable = Linkable time (ms_mod summary) (pure $ BCOs bytecode) #else let linkable = LM time (ms_mod summary) [BCOs bytecode sptEntries] #endif + pure (map snd warnings, linkable) demoteTypeErrorsToWarnings :: ParsedModule -> ParsedModule @@ -821,7 +826,7 @@ generateHieAsts hscEnv tcm = pure $ Just $ #if MIN_VERSION_ghc(9,11,0) hie_asts (tcg_type_env ts) -#elif MIN_VERSION_ghc(9,3,0) +#else hie_asts #endif where @@ -966,12 +971,12 @@ handleGenerationErrors' dflags source action = ) ] - -- Merge the HPTs, module graphs and FinderCaches -- See Note [GhcSessionDeps] in Development.IDE.Core.Rules -- Add the current ModSummary to the graph, along with the -- HomeModInfo's of all direct dependencies (by induction hypothesis all -- transitive dependencies will be contained in envs) +#if MIN_VERSION_ghc(9,11,0) mergeEnvs :: HscEnv -> ModuleGraph -> DependencyInformation @@ -980,7 +985,6 @@ mergeEnvs :: HscEnv -> [HscEnv] -> IO HscEnv mergeEnvs env mg dep_info ms extraMods envs = do -#if MIN_VERSION_ghc(9,11,0) return $! loadModulesHome extraMods $ let newHug = foldl' mergeHUG (hsc_HUG env) (map hsc_HUG envs) in (hscUpdateHUG (const newHug) env){ @@ -1011,7 +1015,15 @@ mergeEnvs env mg dep_info ms extraMods envs = do | HsSrcFile <- mi_hsc_src (hm_iface a) = a | otherwise = b -#elif MIN_VERSION_ghc(9,3,0) +#else +mergeEnvs :: HscEnv + -> ModuleGraph + -> DependencyInformation + -> ModSummary + -> [HomeModInfo] + -> [HscEnv] + -> IO HscEnv +mergeEnvs env mg _dep_info ms extraMods envs = do let im = Compat.installedModule (toUnitId $ moduleUnit $ ms_mod ms) (moduleName (ms_mod ms)) ifr = InstalledFound (ms_location ms) im curFinderCache = Compat.extendInstalledModuleEnv Compat.emptyInstalledModuleEnv im ifr @@ -1173,11 +1185,7 @@ parseHeader => DynFlags -- ^ flags to use -> FilePath -- ^ the filename (for source locations) -> Util.StringBuffer -- ^ Haskell module source text (full Unicode is supported) -#if MIN_VERSION_ghc(9,5,0) -> ExceptT [FileDiagnostic] m ([FileDiagnostic], Located (HsModule GhcPs)) -#else - -> ExceptT [FileDiagnostic] m ([FileDiagnostic], Located HsModule) -#endif parseHeader dflags filename contents = do let loc = mkRealSrcLoc (Util.mkFastString filename) 1 1 case unP Compat.parseHeader (initParserState (initParserOpts dflags) contents loc) of @@ -1439,7 +1447,7 @@ loadInterface session ms linkableNeeded RecompilationInfo{..} = do | not (mi_used_th iface) = emptyModuleEnv | otherwise = parseRuntimeDeps (md_anns details) -- Peform the fine grained recompilation check for TH - maybe_recomp <- checkLinkableDependencies session get_linkable_hashes get_module_graph runtime_deps + maybe_recomp <- checkLinkableDependencies get_linkable_hashes get_module_graph runtime_deps case maybe_recomp of Just msg -> do_regenerate msg Nothing @@ -1476,8 +1484,8 @@ parseRuntimeDeps anns = mkModuleEnv $ mapMaybe go anns -- the runtime dependencies of the module, to check if any of them are out of date -- Hopefully 'runtime_deps' will be empty if the module didn't actually use TH -- See Note [Recompilation avoidance in the presence of TH] -checkLinkableDependencies :: MonadIO m => HscEnv -> ([NormalizedFilePath] -> m [BS.ByteString]) -> m DependencyInformation -> ModuleEnv BS.ByteString -> m (Maybe RecompileRequired) -checkLinkableDependencies hsc_env get_linkable_hashes get_module_graph runtime_deps = do +checkLinkableDependencies :: MonadIO m => ([NormalizedFilePath] -> m [BS.ByteString]) -> m DependencyInformation -> ModuleEnv BS.ByteString -> m (Maybe RecompileRequired) +checkLinkableDependencies get_linkable_hashes get_module_graph runtime_deps = do graph <- get_module_graph let go (mod, hash) = (,hash) <$> lookupModuleFile mod graph hs_files = mapM go (moduleEnvToList runtime_deps) @@ -1523,16 +1531,12 @@ coreFileToCgGuts session iface details core_file = do -- Implicit binds aren't saved, so we need to regenerate them ourselves. let _implicit_binds = concatMap getImplicitBinds tyCons -- only used if GHC < 9.6 tyCons = typeEnvTyCons (md_types details) -#if MIN_VERSION_ghc(9,5,0) -- In GHC 9.6, the implicit binds are tidied and part of core_binds pure $ CgGuts this_mod tyCons core_binds [] NoStubs [] mempty #if !MIN_VERSION_ghc(9,11,0) (emptyHpcInfo False) #endif Nothing [] -#else - pure $ CgGuts this_mod tyCons (_implicit_binds ++ core_binds) [] NoStubs [] mempty (emptyHpcInfo False) Nothing [] -#endif coreFileToLinkable :: LinkableType -> HscEnv -> ModSummary -> ModIface -> ModDetails -> CoreFile -> UTCTime -> IO ([FileDiagnostic], Maybe HomeModInfo) coreFileToLinkable linkableType session ms iface details core_file t = do @@ -1637,7 +1641,7 @@ setNonHomeFCHook hsc_env = with negative if clauses coming before positive if clauses of the same version. (If you think about which GHC version a clause activates for this should make sense `!MIN_VERSION_GHC(9,0,0)` refers to 8.10 and lower which is - a earlier version than `MIN_VERSION_GHC(9,0,0)` which refers to versions 9.0 + an earlier version than `MIN_VERSION_GHC(9,0,0)` which refers to versions 9.0 and later). In addition there should be a space before and after each CPP clause. diff --git a/ghcide/src/Development/IDE/Core/OfInterest.hs b/ghcide/src/Development/IDE/Core/OfInterest.hs index 2a594c1021..19e0f40e24 100644 --- a/ghcide/src/Development/IDE/Core/OfInterest.hs +++ b/ghcide/src/Development/IDE/Core/OfInterest.hs @@ -29,7 +29,6 @@ import Development.IDE.Graph import Control.Concurrent.STM.Stats (atomically, modifyTVar') import Data.Aeson (toJSON) -import qualified Data.Aeson as Aeson import qualified Data.ByteString as BS import Data.Maybe (catMaybes) import Development.IDE.Core.ProgressReporting diff --git a/ghcide/src/Development/IDE/Core/Rules.hs b/ghcide/src/Development/IDE/Core/Rules.hs index 83acfc7ed6..f1b11d971b 100644 --- a/ghcide/src/Development/IDE/Core/Rules.hs +++ b/ghcide/src/Development/IDE/Core/Rules.hs @@ -159,10 +159,10 @@ import Ide.Plugin.Properties (HasProperty, usePropertyByPath) import Ide.Types (DynFlagsModifications (dynFlagsModifyGlobal, dynFlagsModifyParser), PluginId) +import qualified Language.LSP.Protocol.Lens as JL import Language.LSP.Protocol.Message (SMethod (SMethod_CustomMethod, SMethod_WindowShowMessage)) import Language.LSP.Protocol.Types (MessageType (MessageType_Info), ShowMessageParams (ShowMessageParams)) -import qualified Language.LSP.Protocol.Lens as JL import Language.LSP.Server (LspT) import qualified Language.LSP.Server as LSP import Language.LSP.VFS @@ -174,8 +174,6 @@ import System.Info.Extra (isWindows) import qualified Data.IntMap as IM import GHC.Fingerprint -import GHC.Driver.Env (hsc_all_home_unit_ids) - data Log = LogShake Shake.Log | LogReindexingHieFile !NormalizedFilePath diff --git a/ghcide/src/Development/IDE/GHC/CPP.hs b/ghcide/src/Development/IDE/GHC/CPP.hs index bb4c4e4e81..c97afd90e7 100644 --- a/ghcide/src/Development/IDE/GHC/CPP.hs +++ b/ghcide/src/Development/IDE/GHC/CPP.hs @@ -19,16 +19,10 @@ import Development.IDE.GHC.Compat as Compat import Development.IDE.GHC.Compat.Util import GHC import GHC.Settings +import qualified GHC.SysTools.Cpp as Pipeline -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,5,0) -import qualified GHC.Driver.Pipeline.Execute as Pipeline -#endif - -#if MIN_VERSION_ghc(9,5,0) -import qualified GHC.SysTools.Cpp as Pipeline -#endif #if MIN_VERSION_ghc(9,10,2) import qualified GHC.SysTools.Tasks as Pipeline @@ -49,13 +43,12 @@ addOptP f = alterToolSettings $ \s -> s doCpp :: HscEnv -> FilePath -> FilePath -> IO () doCpp env input_fn output_fn = - -- See GHC commit a2f53ac8d968723417baadfab5be36a020ea6850 - -- this function/Pipeline.doCpp previously had a raw parameter - -- always set to True that corresponded to these settings - -#if MIN_VERSION_ghc(9,5,0) + -- See GHC commit a2f53ac8d968723417baadfab5be36a020ea6850 + -- this function/Pipeline.doCpp previously had a raw parameter + -- always set to True that corresponded to these settings let cpp_opts = Pipeline.CppOpts { cppLinePragmas = True + #if MIN_VERSION_ghc(9,10,2) , sourceCodePreprocessor = Pipeline.SCPHsCpp #elif MIN_VERSION_ghc(9,10,0) @@ -63,10 +56,8 @@ doCpp env input_fn output_fn = #else , cppUseCc = False #endif + } in -#else - let cpp_opts = True in -#endif Pipeline.doCpp (hsc_logger env) (hsc_tmpfs env) (hsc_dflags env) (hsc_unit_env env) cpp_opts input_fn output_fn diff --git a/ghcide/src/Development/IDE/GHC/Compat.hs b/ghcide/src/Development/IDE/GHC/Compat.hs index 6a2ae5b77a..ddf01c61c5 100644 --- a/ghcide/src/Development/IDE/GHC/Compat.hs +++ b/ghcide/src/Development/IDE/GHC/Compat.hs @@ -102,9 +102,7 @@ module Development.IDE.GHC.Compat( Dependencies(dep_direct_mods), NameCacheUpdater, -#if MIN_VERSION_ghc(9,5,0) XModulePs(..), -#endif #if !MIN_VERSION_ghc(9,7,0) liftZonkM, @@ -167,8 +165,13 @@ import GHC.Types.Var.Env import GHC.Builtin.Uniques import GHC.ByteCode.Types +import GHC.Core.Lint.Interactive (interactiveInScope) import GHC.CoreToStg import GHC.Data.Maybe +import GHC.Driver.Config.Core.Lint.Interactive (lintInteractiveExpr) +import GHC.Driver.Config.Core.Opt.Simplify (initSimplifyExprOpts) +import GHC.Driver.Config.CoreToStg (initCoreToStgOpts) +import GHC.Driver.Config.CoreToStg.Prep (initCorePrepConfig) import GHC.Driver.Config.Stg.Pipeline import GHC.Driver.Env as Env import GHC.Iface.Env @@ -188,18 +191,6 @@ import GHC.Unit.Module.ModIface -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,5,0) -import GHC.Core.Lint (lintInteractiveExpr) -#endif - -#if MIN_VERSION_ghc(9,5,0) -import GHC.Core.Lint.Interactive (interactiveInScope) -import GHC.Driver.Config.Core.Lint.Interactive (lintInteractiveExpr) -import GHC.Driver.Config.Core.Opt.Simplify (initSimplifyExprOpts) -import GHC.Driver.Config.CoreToStg (initCoreToStgOpts) -import GHC.Driver.Config.CoreToStg.Prep (initCorePrepConfig) -#endif - #if MIN_VERSION_ghc(9,7,0) import GHC.Tc.Zonk.TcType (tcInitTidyEnv) #endif @@ -230,11 +221,7 @@ myCoreToStgExpr logger dflags ictxt binding for the stg2stg step) -} let bco_tmp_id = mkSysLocal (fsLit "BCO_toplevel") (mkPseudoUniqueE 0) -#if MIN_VERSION_ghc(9,5,0) ManyTy -#else - Many -#endif (exprType prepd_expr) (stg_binds, prov_map, collected_ccs) <- myCoreToStg logger @@ -258,27 +245,17 @@ myCoreToStg logger dflags ictxt let (stg_binds, denv, cost_centre_info) = {-# SCC "Core2Stg" #-} coreToStg -#if MIN_VERSION_ghc(9,5,0) (initCoreToStgOpts dflags) -#else - dflags -#endif this_mod ml prepd_binds #if MIN_VERSION_ghc(9,8,0) (unzip -> (stg_binds2,_),_) -#elif MIN_VERSION_ghc(9,4,2) - (stg_binds2,_) #else - stg_binds2 + (stg_binds2,_) #endif <- {-# SCC "Stg2Stg" #-} stg2stg logger -#if MIN_VERSION_ghc(9,5,0) (interactiveInScope ictxt) -#else - ictxt -#endif (initStgPipelineOpts dflags for_bytecode) this_mod stg_binds return (stg_binds2, denv, cost_centre_info) @@ -293,42 +270,21 @@ getDependentMods :: ModIface -> [ModuleName] getDependentMods = map (gwib_mod . snd) . S.toList . dep_direct_mods . mi_deps simplifyExpr :: DynFlags -> HscEnv -> CoreExpr -> IO CoreExpr -#if MIN_VERSION_ghc(9,5,0) simplifyExpr _ env = GHC.simplifyExpr (Development.IDE.GHC.Compat.Env.hsc_logger env) (ue_eps (Development.IDE.GHC.Compat.Env.hsc_unit_env env)) (initSimplifyExprOpts (hsc_dflags env) (hsc_IC env)) -#else -simplifyExpr _ = GHC.simplifyExpr -#endif corePrepExpr :: DynFlags -> HscEnv -> CoreExpr -> IO CoreExpr -#if MIN_VERSION_ghc(9,5,0) corePrepExpr _ env expr = do cfg <- initCorePrepConfig env GHC.corePrepExpr (Development.IDE.GHC.Compat.Env.hsc_logger env) cfg expr -#else -corePrepExpr _ = GHC.corePrepExpr -#endif renderMessages :: PsMessages -> (Bag WarnMsg, Bag ErrMsg) renderMessages msgs = -#if MIN_VERSION_ghc(9,5,0) let renderMsgs extractor = (fmap . fmap) GhcPsMessage . getMessages $ extractor msgs in (renderMsgs psWarnings, renderMsgs psErrors) -#else - let renderMsgs extractor = (fmap . fmap) renderDiagnosticMessageWithHints . getMessages $ extractor msgs - in (renderMsgs psWarnings, renderMsgs psErrors) -#endif -#if MIN_VERSION_ghc(9,5,0) pattern PFailedWithErrorMessages :: forall a b. (b -> Bag (MsgEnvelope GhcMessage)) -> ParseResult a -#else -pattern PFailedWithErrorMessages :: forall a b. (b -> Bag (MsgEnvelope DecoratedSDoc)) -> ParseResult a -#endif pattern PFailedWithErrorMessages msgs -#if MIN_VERSION_ghc(9,5,0) <- PFailed (const . fmap (fmap GhcPsMessage) . getMessages . getPsErrorMessages -> msgs) -#else - <- PFailed (const . fmap (fmap renderDiagnosticMessageWithHints) . getMessages . getPsErrorMessages -> msgs) -#endif {-# COMPLETE POk, PFailedWithErrorMessages #-} hieExportNames :: HieFile -> [(SrcSpan, Name)] @@ -453,8 +409,7 @@ generatedNodeInfo :: HieAST a -> Maybe (NodeInfo a) generatedNodeInfo = Map.lookup GeneratedInfo . getSourcedNodeInfo . sourcedNodeInfo data GhcVersion - = GHC94 - | GHC96 + = GHC96 | GHC98 | GHC910 | GHC912 @@ -470,10 +425,8 @@ ghcVersion = GHC912 ghcVersion = GHC910 #elif MIN_VERSION_GLASGOW_HASKELL(9,8,0,0) ghcVersion = GHC98 -#elif MIN_VERSION_GLASGOW_HASKELL(9,6,0,0) +#else ghcVersion = GHC96 -#elif MIN_VERSION_GLASGOW_HASKELL(9,4,0,0) -ghcVersion = GHC94 #endif simpleNodeInfoCompat :: FastStringCompat -> FastStringCompat -> NodeInfo a @@ -510,14 +463,8 @@ loadModulesHome mod_infos e = recDotDot :: HsRecFields (GhcPass p) arg -> Maybe Int recDotDot x = -#if MIN_VERSION_ghc(9,5,0) unRecFieldsDotDot <$> -#endif unLoc <$> rec_dotdot x -#if MIN_VERSION_ghc(9,5,0) -extract_cons (NewTypeCon x) = [x] +extract_cons (NewTypeCon x) = [x] extract_cons (DataTypeCons _ xs) = xs -#else -extract_cons = id -#endif diff --git a/ghcide/src/Development/IDE/GHC/Compat/Core.hs b/ghcide/src/Development/IDE/GHC/Compat/Core.hs index ebd1fe0b9e..42f654b609 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Core.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Core.hs @@ -375,27 +375,13 @@ module Development.IDE.GHC.Compat.Core ( module GHC.Unit.Finder.Types, module GHC.Unit.Env, module GHC.Driver.Phases, -#if !MIN_VERSION_ghc(9,4,0) - pattern HsFieldBind, - hfbAnn, - hfbLHS, - hfbRHS, - hfbPun, -#endif -#if !MIN_VERSION_ghc_boot_th(9,4,1) - Extension(.., NamedFieldPuns), -#else Extension(..), -#endif mkCgInteractiveGuts, justBytecode, justObjects, emptyHomeModInfoLinkable, homeModInfoByteCode, homeModInfoObject, -#if !MIN_VERSION_ghc(9,5,0) - field_label, -#endif groupOrigin, isVisibleFunArg, #if MIN_VERSION_ghc(9,8,0) @@ -630,21 +616,11 @@ pattern ExposePackage s a mr = DynFlags.ExposePackage s a mr #endif isVisibleFunArg :: Development.IDE.GHC.Compat.Core.FunTyFlag -> Bool -#if __GLASGOW_HASKELL__ >= 906 isVisibleFunArg = TypesVar.isVisibleFunArg type FunTyFlag = TypesVar.FunTyFlag -#else -isVisibleFunArg VisArg = True -isVisibleFunArg _ = False -type FunTyFlag = TypesVar.AnonArgFlag -#endif pattern FunTy :: Development.IDE.GHC.Compat.Core.FunTyFlag -> Type -> Type -> Type pattern FunTy af arg res <- TyCoRep.FunTy {ft_af = af, ft_arg = arg, ft_res = res} - --- type HasSrcSpan x a = (GenLocated SrcSpan a ~ x) --- type HasSrcSpan x = () :: Constraint - class HasSrcSpan a where getLoc :: a -> SrcSpan @@ -750,11 +726,7 @@ makeSimpleDetails hsc_env = mkIfaceTc :: HscEnv -> GHC.SafeHaskellMode -> ModDetails -> ModSummary -> Maybe CoreProgram -> TcGblEnv -> IO ModIface mkIfaceTc hscEnv shm md _ms _mcp = -#if MIN_VERSION_ghc(9,5,0) GHC.mkIfaceTc hscEnv shm md _ms _mcp -- mcp::Maybe CoreProgram is only used in GHC >= 9.6 -#else - GHC.mkIfaceTc hscEnv shm md _ms -- ms::ModSummary is only used in GHC >= 9.4 -#endif mkBootModDetailsTc :: HscEnv -> TcGblEnv -> IO ModDetails mkBootModDetailsTc session = GHC.mkBootModDetailsTc @@ -768,50 +740,10 @@ initTidyOpts = driverNoStop :: StopPhase driverNoStop = NoStop - -#if !MIN_VERSION_ghc(9,4,0) -pattern HsFieldBind :: XHsRecField id -> id -> arg -> Bool -> HsRecField' id arg -pattern HsFieldBind {hfbAnn, hfbLHS, hfbRHS, hfbPun} <- HsRecField hfbAnn (SrcLoc.unLoc -> hfbLHS) hfbRHS hfbPun where - HsFieldBind ann lhs rhs pun = HsRecField ann (SrcLoc.noLoc lhs) rhs pun -#endif - -#if !MIN_VERSION_ghc_boot_th(9,4,1) -pattern NamedFieldPuns :: Extension -pattern NamedFieldPuns = RecordPuns -#endif - groupOrigin :: MatchGroup GhcRn body -> Origin -#if MIN_VERSION_ghc(9,5,0) mapLoc :: (a -> b) -> SrcLoc.GenLocated l a -> SrcLoc.GenLocated l b mapLoc = fmap groupOrigin = mg_ext -#else -mapLoc :: (a -> b) -> SrcLoc.GenLocated l a -> SrcLoc.GenLocated l b -mapLoc = SrcLoc.mapLoc -groupOrigin = mg_origin -#endif - - -#if !MIN_VERSION_ghc(9,5,0) -mkCgInteractiveGuts :: CgGuts -> CgGuts -mkCgInteractiveGuts = id - -emptyHomeModInfoLinkable :: Maybe Linkable -emptyHomeModInfoLinkable = Nothing - -justBytecode :: Linkable -> Maybe Linkable -justBytecode = Just - -justObjects :: Linkable -> Maybe Linkable -justObjects = Just - -homeModInfoByteCode, homeModInfoObject :: HomeModInfo -> Maybe Linkable -homeModInfoByteCode = hm_linkable -homeModInfoObject = hm_linkable - -field_label :: a -> a -field_label = id -#endif mkSimpleTarget :: DynFlags -> FilePath -> Target mkSimpleTarget df fp = Target (TargetFile fp Nothing) True (homeUnitId_ df) Nothing diff --git a/ghcide/src/Development/IDE/GHC/Compat/Driver.hs b/ghcide/src/Development/IDE/GHC/Compat/Driver.hs index 3ad063936e..6ab1d26df2 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Driver.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Driver.hs @@ -79,11 +79,7 @@ hsc_typecheck keep_rn mod_summary mb_rdr_module = do tc_result0 <- tcRnModule' mod_summary keep_rn' hpm if hsc_src == HsigFile then -#if MIN_VERSION_ghc(9,5,0) do (iface, _) <- liftIO $ hscSimpleIface hsc_env Nothing tc_result0 mod_summary -#else - do (iface, _) <- liftIO $ hscSimpleIface hsc_env tc_result0 mod_summary -#endif ioMsgMaybe $ hoistTcRnMessage $ tcRnMergeSignatures hsc_env hpm tc_result0 iface else return tc_result0 @@ -135,7 +131,6 @@ extract_renamed_stuff mod_summary tc_result = do -- ============================================================================ -- DO NOT EDIT - Refer to top of file -- ============================================================================ -#if MIN_VERSION_ghc(9,5,0) hscSimpleIface :: HscEnv -> Maybe CoreProgram -> TcGblEnv @@ -143,13 +138,5 @@ hscSimpleIface :: HscEnv -> IO (ModIface, ModDetails) hscSimpleIface hsc_env mb_core_program tc_result summary = runHsc hsc_env $ hscSimpleIface' mb_core_program tc_result summary -#else -hscSimpleIface :: HscEnv - -> TcGblEnv - -> ModSummary - -> IO (ModIface, ModDetails) -hscSimpleIface hsc_env tc_result summary - = runHsc hsc_env $ hscSimpleIface' tc_result summary -#endif #endif diff --git a/ghcide/src/Development/IDE/GHC/Compat/Env.hs b/ghcide/src/Development/IDE/GHC/Compat/Env.hs index 988739e3b8..cbccc1a3de 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Env.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Env.hs @@ -105,22 +105,14 @@ hscHomeUnit = setBytecodeLinkerOptions :: DynFlags -> DynFlags setBytecodeLinkerOptions df = df { ghcLink = LinkInMemory -#if MIN_VERSION_ghc(9,5,0) , backend = noBackend -#else - , backend = NoBackend -#endif , ghcMode = CompManager } setInterpreterLinkerOptions :: DynFlags -> DynFlags setInterpreterLinkerOptions df = df { ghcLink = LinkInMemory -#if MIN_VERSION_ghc(9,5,0) , backend = interpreterBackend -#else - , backend = Interpreter -#endif , ghcMode = CompManager } diff --git a/ghcide/src/Development/IDE/GHC/Compat/Iface.hs b/ghcide/src/Development/IDE/GHC/Compat/Iface.hs index 0a16f676e7..39cf9e0d45 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Iface.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Iface.hs @@ -23,7 +23,7 @@ import GHC.Iface.Errors.Types (IfaceMessage) writeIfaceFile :: HscEnv -> FilePath -> ModIface -> IO () #if MIN_VERSION_ghc(9,11,0) writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (targetProfile $ hsc_dflags env) (Iface.flagsToIfCompression $ hsc_dflags env) fp iface -#elif MIN_VERSION_ghc(9,3,0) +#else writeIfaceFile env fp iface = Iface.writeIface (hsc_logger env) (targetProfile $ hsc_dflags env) fp iface #endif diff --git a/ghcide/src/Development/IDE/GHC/Compat/Logger.hs b/ghcide/src/Development/IDE/GHC/Compat/Logger.hs index 32ec11da4c..c3cc5247d0 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Logger.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Logger.hs @@ -28,10 +28,8 @@ type LogActionCompat = LogFlags -> Maybe DiagnosticReason -> Maybe Severity -> S logActionCompat :: LogActionCompat -> LogAction #if MIN_VERSION_ghc(9,7,0) logActionCompat logAction logFlags (MCDiagnostic severity (ResolvedDiagnosticReason wr) _) loc = logAction logFlags (Just wr) (Just severity) loc alwaysQualify -#elif MIN_VERSION_ghc(9,5,0) -logActionCompat logAction logFlags (MCDiagnostic severity wr _) loc = logAction logFlags (Just wr) (Just severity) loc alwaysQualify #else -logActionCompat logAction logFlags (MCDiagnostic severity wr) loc = logAction logFlags (Just wr) (Just severity) loc alwaysQualify +logActionCompat logAction logFlags (MCDiagnostic severity wr _) loc = logAction logFlags (Just wr) (Just severity) loc alwaysQualify #endif logActionCompat logAction logFlags _cls loc = logAction logFlags Nothing Nothing loc alwaysQualify diff --git a/ghcide/src/Development/IDE/GHC/Compat/Outputable.hs b/ghcide/src/Development/IDE/GHC/Compat/Outputable.hs index d1053ebffc..ccec23c9c3 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Outputable.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Outputable.hs @@ -16,14 +16,12 @@ module Development.IDE.GHC.Compat.Outputable ( -- * Parser errors PsWarning, PsError, -#if MIN_VERSION_ghc(9,5,0) defaultDiagnosticOpts, GhcMessage, DriverMessage, Messages, initDiagOpts, pprMessages, -#endif DiagnosticReason(..), renderDiagnosticMessageWithHints, pprMsgEnvelopeBagWithLoc, @@ -51,6 +49,7 @@ module Development.IDE.GHC.Compat.Outputable ( import Data.Maybe import GHC.Driver.Config.Diagnostic import GHC.Driver.Env +import GHC.Driver.Errors.Types (DriverMessage, GhcMessage) import GHC.Driver.Ppr import GHC.Driver.Session import GHC.Parser.Errors.Types @@ -66,17 +65,11 @@ import GHC.Utils.Panic -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if MIN_VERSION_ghc(9,5,0) -import GHC.Driver.Errors.Types (DriverMessage, GhcMessage) -#endif - #if MIN_VERSION_ghc(9,7,0) import GHC.Types.Error (defaultDiagnosticOpts) #endif -#if MIN_VERSION_ghc(9,5,0) type PrintUnqualified = NamePprCtx -#endif -- | A compatible function to print `Outputable` instances -- without unique symbols. @@ -118,33 +111,19 @@ pprNoLocMsgEnvelope (MsgEnvelope { errMsgDiagnostic = e -#if MIN_VERSION_ghc(9,5,0) type ErrMsg = MsgEnvelope GhcMessage type WarnMsg = MsgEnvelope GhcMessage -#else -type ErrMsg = MsgEnvelope DecoratedSDoc -type WarnMsg = MsgEnvelope DecoratedSDoc -#endif mkPrintUnqualifiedDefault :: HscEnv -> GlobalRdrEnv -> PrintUnqualified -#if MIN_VERSION_ghc(9,5,0) mkPrintUnqualifiedDefault env = mkNamePprCtx ptc (hsc_unit_env env) where ptc = initPromotionTickContext (hsc_dflags env) -#else -mkPrintUnqualifiedDefault env = - -- GHC 9.2 version - -- mkPrintUnqualified :: UnitEnv -> GlobalRdrEnv -> PrintUnqualified - mkPrintUnqualified (hsc_unit_env env) -#endif renderDiagnosticMessageWithHints :: forall a. Diagnostic a => a -> DecoratedSDoc renderDiagnosticMessageWithHints a = Error.unionDecoratedSDoc (diagnosticMessage -#if MIN_VERSION_ghc(9,5,0) (defaultDiagnosticOpts @a) -#endif a) (mkDecorated $ map ppr $ diagnosticHints a) mkWarnMsg :: DynFlags -> Maybe DiagnosticReason -> b -> SrcSpan -> PrintUnqualified -> SDoc -> MsgEnvelope DecoratedSDoc diff --git a/ghcide/src/Development/IDE/GHC/Compat/Parser.hs b/ghcide/src/Development/IDE/GHC/Compat/Parser.hs index 7ae9c2bab9..8e2967ed30 100644 --- a/ghcide/src/Development/IDE/GHC/Compat/Parser.hs +++ b/ghcide/src/Development/IDE/GHC/Compat/Parser.hs @@ -49,11 +49,7 @@ initParserState :: ParserOpts -> StringBuffer -> RealSrcLoc -> PState initParserState = Lexer.initParserState -#if MIN_VERSION_ghc(9,5,0) pattern HsParsedModule :: Located (HsModule GhcPs) -> [FilePath] -> GHC.HsParsedModule -#else -pattern HsParsedModule :: Located HsModule -> [FilePath] -> GHC.HsParsedModule -#endif pattern HsParsedModule { hpm_module , hpm_src_files diff --git a/ghcide/src/Development/IDE/GHC/CoreFile.hs b/ghcide/src/Development/IDE/GHC/CoreFile.hs index 53d3840325..9977ad573b 100644 --- a/ghcide/src/Development/IDE/GHC/CoreFile.hs +++ b/ghcide/src/Development/IDE/GHC/CoreFile.hs @@ -118,21 +118,8 @@ codeGutsToCoreFile :: Fingerprint -- ^ Hash of the interface this was generated from -> CgGuts -> CoreFile -#if MIN_VERSION_ghc(9,5,0) -- In GHC 9.6, implicit binds are tidied and part of core binds codeGutsToCoreFile hash CgGuts{..} = CoreFile (map (toIfaceTopBind1 cg_module) cg_binds) hash -#else -codeGutsToCoreFile hash CgGuts{..} = CoreFile (map (toIfaceTopBind1 cg_module) $ filter isNotImplictBind cg_binds) hash - --- | Implicit binds can be generated from the interface and are not tidied, --- so we must filter them out -isNotImplictBind :: CoreBind -> Bool -isNotImplictBind bind = not . all isImplicitId $ bindBindings bind - -bindBindings :: CoreBind -> [Var] -bindBindings (NonRec b _) = [b] -bindBindings (Rec bnds) = map fst bnds -#endif getImplicitBinds :: TyCon -> [CoreBind] getImplicitBinds tc = cls_binds ++ getTyConImplicitBinds tc diff --git a/ghcide/src/Development/IDE/GHC/Error.hs b/ghcide/src/Development/IDE/GHC/Error.hs index 8f919a3bf2..048987f8ae 100644 --- a/ghcide/src/Development/IDE/GHC/Error.hs +++ b/ghcide/src/Development/IDE/GHC/Error.hs @@ -78,15 +78,9 @@ diagFromErrMsg diagSource dflags origErr = -- The function signature changes based on the GHC version. -- While this is not desirable, it avoids more CPP statements in code -- that implements actual logic. -#if MIN_VERSION_ghc(9,5,0) diagFromGhcErrorMessages :: T.Text -> DynFlags -> Compat.Bag (MsgEnvelope GhcMessage) -> [FileDiagnostic] diagFromGhcErrorMessages sourceParser dflags errs = diagFromErrMsgs sourceParser dflags errs -#else -diagFromGhcErrorMessages :: T.Text -> DynFlags -> Compat.Bag (MsgEnvelope Compat.DecoratedSDoc) -> [FileDiagnostic] -diagFromGhcErrorMessages sourceParser dflags errs = - diagFromSDocErrMsgs sourceParser dflags errs -#endif diagFromErrMsgs :: T.Text -> DynFlags -> Compat.Bag (MsgEnvelope GhcMessage) -> [FileDiagnostic] diagFromErrMsgs diagSource dflags = concatMap (diagFromErrMsg diagSource dflags) . Compat.bagToList diff --git a/ghcide/src/Development/IDE/GHC/Orphans.hs b/ghcide/src/Development/IDE/GHC/Orphans.hs index 4e832f9ee2..543c6f4387 100644 --- a/ghcide/src/Development/IDE/GHC/Orphans.hs +++ b/ghcide/src/Development/IDE/GHC/Orphans.hs @@ -32,11 +32,9 @@ import GHC.Types.SrcLoc -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if MIN_VERSION_ghc(9,5,0) import GHC.Unit.Home.ModInfo import GHC.Unit.Module.Location (ModLocation (..)) import GHC.Unit.Module.WholeCoreBindings -#endif -- Orphan instance for Shake.hs -- https://hub.darcs.net/ross/transformers/issue/86 @@ -68,13 +66,10 @@ instance NFData Unlinked where rnf (DotA f) = rnf f rnf (DotDLL f) = rnf f rnf (BCOs a b) = seqCompiledByteCode a `seq` liftRnf rwhnf b -#if MIN_VERSION_ghc(9,5,0) rnf (CoreBindings wcb) = rnf wcb rnf (LoadedBCOs us) = rnf us #endif -#endif -#if MIN_VERSION_ghc(9,5,0) instance NFData WholeCoreBindings where #if MIN_VERSION_ghc(9,11,0) rnf (WholeCoreBindings bs m ml f) = rnf bs `seq` rnf m `seq` rnf ml `seq` rnf f @@ -88,7 +83,6 @@ instance NFData ModLocation where #else rnf (ModLocation mf f1 f2 f3 f4 f5) = rnf mf `seq` rnf f1 `seq` rnf f2 `seq` rnf f3 `seq` rnf f4 `seq` rnf f5 #endif -#endif instance Show PackageFlag where show = unpack . printOutputable instance Show InteractiveImport where show = unpack . printOutputable @@ -103,12 +97,6 @@ instance NFData SB.StringBuffer where rnf = rwhnf instance Show Module where show = moduleNameString . moduleName - -#if !MIN_VERSION_ghc(9,5,0) -instance (NFData l, NFData e) => NFData (GenLocated l e) where - rnf (L l e) = rnf l `seq` rnf e -#endif - instance Show ModSummary where show = show . ms_mod @@ -191,11 +179,6 @@ instance NFData Type where instance Show a => Show (Bag a) where show = show . bagToList -#if !MIN_VERSION_ghc(9,5,0) -instance NFData HsDocString where - rnf = rwhnf -#endif - instance Show ModGuts where show _ = "modguts" instance NFData ModGuts where @@ -204,11 +187,7 @@ instance NFData ModGuts where instance NFData (ImportDecl GhcPs) where rnf = rwhnf -#if MIN_VERSION_ghc(9,5,0) instance (NFData (HsModule a)) where -#else -instance (NFData HsModule) where -#endif rnf = rwhnf instance Show OccName where show = unpack . printOutputable @@ -239,10 +218,8 @@ instance NFData UnitId where instance NFData NodeKey where rnf = rwhnf -#if MIN_VERSION_ghc(9,5,0) instance NFData HomeModLinkable where rnf = rwhnf -#endif instance NFData (HsExpr (GhcPass Renamed)) where rnf = rwhnf @@ -261,16 +238,3 @@ instance NFData Extension where instance NFData (UniqFM Name [Name]) where rnf (ufmToIntMap -> m) = rnf m - -#if !MIN_VERSION_ghc(9,5,0) -instance NFData DuplicateRecordFields where - rnf DuplicateRecordFields = () - rnf NoDuplicateRecordFields = () - -instance NFData FieldSelectors where - rnf FieldSelectors = () - rnf NoFieldSelectors = () - -instance NFData FieldLabel where - rnf (FieldLabel a b c d) = rnf a `seq` rnf b `seq` rnf c `seq` rnf d -#endif diff --git a/ghcide/src/Development/IDE/Import/FindImports.hs b/ghcide/src/Development/IDE/Import/FindImports.hs index 79614f1809..7c4046a63a 100644 --- a/ghcide/src/Development/IDE/Import/FindImports.hs +++ b/ghcide/src/Development/IDE/Import/FindImports.hs @@ -145,9 +145,8 @@ locateModule env comp_info exts targetFor modName mbPkgName isSource = do dflags = hsc_dflags env import_paths = mapMaybe (mkImportDirs env) comp_info other_imports = -#if MIN_VERSION_ghc(9,4,0) - -- On 9.4+ instead of bringing all the units into scope, only bring into scope the units - -- this one depends on + -- Instead of bringing all the units into scope, only bring into scope the units + -- this one depends on. -- This way if you have multiple units with the same module names, we won't get confused -- For example if unit a imports module M from unit B, when there is also a module M in unit C, -- and unit a only depends on unit b, without this logic there is the potential to get confused @@ -163,17 +162,6 @@ locateModule env comp_info exts targetFor modName mbPkgName isSource = do units = homeUnitEnv_units $ ue_findHomeUnitEnv (homeUnitId_ dflags) ue hpt_deps :: [UnitId] hpt_deps = homeUnitDepends units -#else - _import_paths' -#endif - - -- first try to find the module as a file. If we can't find it try to find it in the package - -- database. - -- Here the importPaths for the current modules are added to the front of the import paths from the other components. - -- This is particularly important for Paths_* modules which get generated for every component but unless you use it in - -- each component will end up being found in the wrong place and cause a multi-cradle match failure. - _import_paths' = -- import_paths' is only used in GHC < 9.4 - import_paths toModLocation uid file = liftIO $ do loc <- mkHomeModLocation dflags (unLoc modName) (fromNormalizedFilePath file) diff --git a/ghcide/src/Development/IDE/Main.hs b/ghcide/src/Development/IDE/Main.hs index 62b71c3ab6..872e957364 100644 --- a/ghcide/src/Development/IDE/Main.hs +++ b/ghcide/src/Development/IDE/Main.hs @@ -15,8 +15,6 @@ import Control.Concurrent.Extra (withNumCapabilities) import Control.Concurrent.MVar (newEmptyMVar, putMVar, tryReadMVar) import Control.Concurrent.STM.Stats (dumpSTMStats) -import Control.Exception.Safe (SomeException, - displayException) import Control.Monad.Extra (concatMapM, unless, when) import Control.Monad.IO.Class (liftIO) diff --git a/ghcide/src/Development/IDE/Plugin/Completions.hs b/ghcide/src/Development/IDE/Plugin/Completions.hs index 0564855177..d92bf1da85 100644 --- a/ghcide/src/Development/IDE/Plugin/Completions.hs +++ b/ghcide/src/Development/IDE/Plugin/Completions.hs @@ -114,15 +114,10 @@ produceCompletions recorder = do -- Drop any explicit imports in ImportDecl if not hidden dropListFromImportDecl :: LImportDecl GhcPs -> LImportDecl GhcPs dropListFromImportDecl iDecl = let -#if MIN_VERSION_ghc(9,5,0) f d@ImportDecl {ideclImportList} = case ideclImportList of Just (Exactly, _) -> d {ideclImportList=Nothing} -#else - f d@ImportDecl {ideclHiding} = case ideclHiding of - Just (False, _) -> d {ideclHiding=Nothing} -#endif -- if hiding or Nothing just return d - _ -> d + _ -> d f x = x in f <$> iDecl diff --git a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs index 7709d9b48f..c6c24311e6 100644 --- a/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs +++ b/ghcide/src/Development/IDE/Plugin/Completions/Logic.hs @@ -53,6 +53,7 @@ import Ide.PluginUtils (mkLspCommand) import Ide.Types (CommandId (..), IdePlugins (..), PluginId) +import Language.Haskell.Syntax.Basic import qualified Language.LSP.Protocol.Lens as L import Language.LSP.Protocol.Types import qualified Language.LSP.VFS as VFS @@ -72,9 +73,6 @@ import GHC.Plugins (Depth (AllTheWay), -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if MIN_VERSION_ghc(9,5,0) -import Language.Haskell.Syntax.Basic -#endif -- Chunk size used for parallelizing fuzzy matching chunkSize :: Int @@ -136,42 +134,23 @@ getCContext pos pm | pos `isInsideSrcSpan` r = Just TypeContext goInline _ = Nothing -#if MIN_VERSION_ghc(9,5,0) importGo :: GHC.LImportDecl GhcPs -> Maybe Context importGo (L (locA -> r) impDecl) | pos `isInsideSrcSpan` r = importInline importModuleName (fmap (fmap reLoc) $ ideclImportList impDecl) -#else - importGo :: GHC.LImportDecl GhcPs -> Maybe Context - importGo (L (locA -> r) impDecl) - | pos `isInsideSrcSpan` r - = importInline importModuleName (fmap (fmap reLoc) $ ideclHiding impDecl) -#endif <|> Just (ImportContext importModuleName) | otherwise = Nothing where importModuleName = moduleNameString $ unLoc $ ideclName impDecl -- importInline :: String -> Maybe (Bool, GHC.Located [LIE GhcPs]) -> Maybe Context -#if MIN_VERSION_ghc(9,5,0) importInline modName (Just (EverythingBut, L r _)) | pos `isInsideSrcSpan` r = Just $ ImportHidingContext modName | otherwise = Nothing -#else - importInline modName (Just (True, L r _)) - | pos `isInsideSrcSpan` r = Just $ ImportHidingContext modName - | otherwise = Nothing -#endif -#if MIN_VERSION_ghc(9,5,0) importInline modName (Just (Exactly, L r _)) | pos `isInsideSrcSpan` r = Just $ ImportListContext modName | otherwise = Nothing -#else - importInline modName (Just (False, L r _)) - | pos `isInsideSrcSpan` r = Just $ ImportListContext modName - | otherwise = Nothing -#endif importInline _ _ = Nothing diff --git a/ghcide/src/Development/IDE/Spans/Common.hs b/ghcide/src/Development/IDE/Spans/Common.hs index ee8a8c18bc..f3e86d792d 100644 --- a/ghcide/src/Development/IDE/Spans/Common.hs +++ b/ghcide/src/Development/IDE/Spans/Common.hs @@ -38,11 +38,7 @@ type DocMap = NameEnv SpanDoc type TyThingMap = NameEnv TyThing -- | Shows IEWrappedName, without any modifier, qualifier or unique identifier. -#if MIN_VERSION_ghc(9,5,0) unqualIEWrapName :: IEWrappedName GhcPs -> T.Text -#else -unqualIEWrapName :: IEWrappedName RdrName -> T.Text -#endif unqualIEWrapName = printOutputable . rdrNameOcc . ieWrappedName -- From haskell-ide-engine/src/Haskell/Ide/Engine/Support/HieExtras.hs diff --git a/ghcide/src/Development/IDE/Types/Diagnostics.hs b/ghcide/src/Development/IDE/Types/Diagnostics.hs index 89e1f2d12f..851625a8fc 100644 --- a/ghcide/src/Development/IDE/Types/Diagnostics.hs +++ b/ghcide/src/Development/IDE/Types/Diagnostics.hs @@ -24,9 +24,7 @@ module Development.IDE.Types.Diagnostics ( ideErrorFromLspDiag, showDiagnostics, showDiagnosticsColored, -#if MIN_VERSION_ghc(9,5,0) showGhcCode, -#endif IdeResultNoDiagnosticsEarlyCutoff, attachReason, attachedReason) where @@ -45,17 +43,11 @@ import Development.IDE.GHC.Compat (GhcMessage, MsgEnvelope, flagSpecName, wWarningFlags) import Development.IDE.Types.Location import GHC.Generics -#if MIN_VERSION_ghc(9,5,0) import GHC.Types.Error (DiagnosticCode (..), DiagnosticReason (..), diagnosticCode, diagnosticReason, errMsgDiagnostic) -#else -import GHC.Types.Error (DiagnosticReason (..), - diagnosticReason, - errMsgDiagnostic) -#endif import Language.LSP.Diagnostics import Language.LSP.Protocol.Lens (data_) import Language.LSP.Protocol.Types as LSP @@ -117,7 +109,6 @@ ideErrorFromLspDiag lspDiag fdFilePath mbOrigMsg = -- | Set the code of the 'LSP.Diagnostic' to the GHC diagnostic code which is linked -- to https://errors.haskell.org/. setGhcCode :: Maybe (MsgEnvelope GhcMessage) -> LSP.Diagnostic -> LSP.Diagnostic -#if MIN_VERSION_ghc(9,5,0) setGhcCode mbOrigMsg diag = let mbGhcCode = do origMsg <- mbOrigMsg @@ -125,15 +116,12 @@ setGhcCode mbOrigMsg diag = pure (InR (showGhcCode code)) in diag { _code = mbGhcCode <|> _code diag } -#else -setGhcCode _ diag = diag -#endif #if MIN_VERSION_ghc(9,9,0) -- DiagnosticCode only got a show instance in 9.10.1 showGhcCode :: DiagnosticCode -> T.Text showGhcCode = T.pack . show -#elif MIN_VERSION_ghc(9,5,0) +#else showGhcCode :: DiagnosticCode -> T.Text showGhcCode (DiagnosticCode prefix c) = T.pack $ prefix ++ "-" ++ printf "%05d" c #endif diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal index e7583c9829..157f5703f2 100644 --- a/haskell-language-server.cabal +++ b/haskell-language-server.cabal @@ -14,7 +14,7 @@ copyright: The Haskell IDE Team license: Apache-2.0 license-file: LICENSE build-type: Simple -tested-with: GHC ==9.10.1 || ==9.8.2 || ==9.6.5 || ==9.4.8 +tested-with: GHC == {9.12.2, 9.10.1, 9.8.4, 9.6.7} extra-source-files: README.md ChangeLog.md diff --git a/hie-compat/src-ghc92/Compat/HieAst.hs b/hie-compat/src-ghc92/Compat/HieAst.hs index dffa7bc78f..3445ff6213 100644 --- a/hie-compat/src-ghc92/Compat/HieAst.hs +++ b/hie-compat/src-ghc92/Compat/HieAst.hs @@ -1040,10 +1040,6 @@ instance HiePass p => ToHie (PScoped (LocatedA (Pat (GhcPass p)))) where in [ toHie $ L ospan wrap , toHie $ PS rsp scope pscope $ (L ospan pat) ] --- CHANGED: removed preprocessor stuff --- #if __GLASGOW_HASKELL__ < 811 --- HieRn -> [] --- #endif where contextify :: a ~ LPat (GhcPass p) => HsConDetails (HsPatSigType (NoGhcTc (GhcPass p))) a (HsRecFields (GhcPass p) a) -> HsConDetails (TScoped (HsPatSigType (NoGhcTc (GhcPass p)))) (PScoped a) (RContext (HsRecFields (GhcPass p) (PScoped a))) @@ -1928,11 +1924,6 @@ instance HiePass p => ToHie (LocatedA (HsSplice (GhcPass p))) where HsSpliced _ _ _ -> [] XSplice x -> case ghcPass @p of --- CHANGED: removed preprocessor stuff --- #if __GLASGOW_HASKELL__ < 811 --- GhcPs -> noExtCon x --- GhcRn -> noExtCon x --- #endif GhcTc -> case x of HsSplicedT _ -> [] diff --git a/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs b/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs index 8ee6110d29..42624212ec 100644 --- a/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs +++ b/hls-plugin-api/src/Ide/Plugin/ConfigUtils.hs @@ -3,7 +3,10 @@ {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ViewPatterns #-} -module Ide.Plugin.ConfigUtils where +module Ide.Plugin.ConfigUtils ( + pluginsToDefaultConfig, + pluginsToVSCodeExtensionSchema + ) where import Control.Lens (at, (&), (?~)) import qualified Data.Aeson as A @@ -31,10 +34,10 @@ pluginsToDefaultConfig :: IdePlugins a -> A.Value pluginsToDefaultConfig IdePlugins {..} = -- Use '_Object' and 'at' to get at the "plugin" key -- and actually set it. - A.toJSON defaultConfig & _Object . at "plugin" ?~ elems + A.toJSON defaultConfig & _Object . at "plugin" ?~ pluginSpecificDefaultConfigs where - defaultConfig@Config {} = def - elems = A.object $ mconcat $ singlePlugin <$> ipMap + defaultConfig = def :: Config + pluginSpecificDefaultConfigs = A.object $ mconcat $ singlePlugin <$> ipMap -- Splice genericDefaultConfig and dedicatedDefaultConfig -- Example: -- @@ -48,6 +51,7 @@ pluginsToDefaultConfig IdePlugins {..} = -- } -- } -- } + singlePlugin :: PluginDescriptor ideState -> [A.Pair] singlePlugin PluginDescriptor {pluginConfigDescriptor = ConfigDescriptor {..}, ..} = let x = genericDefaultConfig <> dedicatedDefaultConfig in [fromString (T.unpack pId) A..= A.object x | not $ null x] @@ -66,8 +70,8 @@ pluginsToDefaultConfig IdePlugins {..} = <> nubOrd (mconcat (handlersToGenericDefaultConfig configInitialGenericConfig <$> handlers)) in case x of - -- if the plugin has only one capability, we produce globalOn instead of the specific one; - -- otherwise we don't produce globalOn at all + -- If the plugin has only one capability, we produce globalOn instead of the specific one; + -- otherwise we omit globalOn [_] -> ["globalOn" A..= plcGlobalOn configInitialGenericConfig] _ -> x -- Example: diff --git a/plugins/hls-change-type-signature-plugin/test/Main.hs b/plugins/hls-change-type-signature-plugin/test/Main.hs index 57541b4736..cd1b152c0b 100644 --- a/plugins/hls-change-type-signature-plugin/test/Main.hs +++ b/plugins/hls-change-type-signature-plugin/test/Main.hs @@ -39,7 +39,7 @@ test :: TestTree test = testGroup "changeTypeSignature" [ testRegexes , codeActionTest "TExpectedActual" 4 11 - , knownBrokenForGhcVersions [GHC94 .. GHC912] "Error Message in 9.2+ does not provide enough info" $ + , knownBrokenForGhcVersions [GHC96 .. GHC912] "Error Message in 9.2+ does not provide enough info" $ codeActionTest "TRigidType" 4 14 , codeActionTest "TRigidType2" 4 6 , codeActionTest "TLocalBinding" 7 22 diff --git a/plugins/hls-class-plugin/src/Ide/Plugin/Class/ExactPrint.hs b/plugins/hls-class-plugin/src/Ide/Plugin/Class/ExactPrint.hs index 71deb9c1d8..bb0994442a 100644 --- a/plugins/hls-class-plugin/src/Ide/Plugin/Class/ExactPrint.hs +++ b/plugins/hls-class-plugin/src/Ide/Plugin/Class/ExactPrint.hs @@ -46,10 +46,8 @@ makeMethodDecl df (mName, sig) = do #if MIN_VERSION_ghc_exactprint(1,10,0) addMethodDecls :: ParsedSource -> [(LHsDecl GhcPs, LHsDecl GhcPs)] -> Range -> Bool -> Located (HsModule GhcPs) -#elif MIN_VERSION_ghc(9,5,0) -addMethodDecls :: ParsedSource -> [(LHsDecl GhcPs, LHsDecl GhcPs)] -> Range -> Bool -> TransformT Identity (Located (HsModule GhcPs)) #else -addMethodDecls :: ParsedSource -> [(LHsDecl GhcPs, LHsDecl GhcPs)] -> Range -> Bool -> TransformT Identity (Located HsModule) +addMethodDecls :: ParsedSource -> [(LHsDecl GhcPs, LHsDecl GhcPs)] -> Range -> Bool -> TransformT Identity (Located (HsModule GhcPs)) #endif addMethodDecls ps mDecls range withSig | withSig = go (concatMap (\(decl, sig) -> [sig, decl]) mDecls) 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 3d896f1da1..d01ddbc55c 100644 --- a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs +++ b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Rules.hs @@ -73,11 +73,7 @@ apiAnnComments' pm = do #endif span) c) where -#if MIN_VERSION_ghc(9,5,0) getEpaComments :: Development.IDE.GHC.Compat.Located (HsModule GhcPs) -> [LEpaComment] -#else - getEpaComments :: Development.IDE.GHC.Compat.Located HsModule -> [LEpaComment] -#endif getEpaComments = toListOf biplate pattern RealSrcSpanAlready :: SrcLoc.RealSrcSpan -> SrcLoc.RealSrcSpan diff --git a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs index 77b133ef92..9498076511 100644 --- a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs +++ b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/Util.hs @@ -77,9 +77,7 @@ showErr e = $ bagToList $ fmap (vcat . unDecorated . diagnosticMessage -#if MIN_VERSION_ghc(9,5,0) (defaultDiagnosticOpts @GhcMessage) -#endif . errMsgDiagnostic) $ getMessages msgs _ -> diff --git a/plugins/hls-eval-plugin/test/Main.hs b/plugins/hls-eval-plugin/test/Main.hs index 7338b4384f..03416c6902 100644 --- a/plugins/hls-eval-plugin/test/Main.hs +++ b/plugins/hls-eval-plugin/test/Main.hs @@ -84,8 +84,7 @@ tests = evalInFile "T8.hs" "-- >>> 3 `div` 0" "-- divide by zero" -- The default for marking exceptions is False , goldenWithEval "Applies file LANGUAGE extensions" "T9" "hs" , goldenWithEval "Evaluate a type with :kind!" "T10" "hs" - , goldenWithEval' "Reports an error for an incorrect type with :kind!" "T11" "hs" - (if ghcVersion >= GHC94 then "ghc94.expected" else "expected") + , goldenWithEval "Reports an error for an incorrect type with :kind!" "T11" "hs" , goldenWithEval "Shows a kind with :kind" "T12" "hs" , goldenWithEval "Reports an error for an incorrect type with :kind" "T13" "hs" , goldenWithEval' "Returns a fully-instantiated type for :type" "T14" "hs" (if ghcVersion >= GHC98 then "ghc98.expected" else "expected") -- See https://gitlab.haskell.org/ghc/ghc/-/issues/24069 @@ -138,7 +137,6 @@ tests = GHC910 -> "ghc910.expected" GHC98 -> "ghc98.expected" GHC96 -> "ghc96.expected" - GHC94 -> "ghc94.expected" , goldenWithEval "Prelude has no special treatment, it is imported as stated in the module" "TPrelude" "hs" , goldenWithEval "Don't panic on {-# UNPACK #-} pragma" "TUNPACK" "hs" , goldenWithEval "Can handle eval inside nested comment properly" "TNested" "hs" @@ -219,7 +217,7 @@ tests = knownBrokenInWindowsBeforeGHC912 msg = foldl (.) id [ knownBrokenInSpecificEnv [GhcVer ghcVer, HostOS Windows] msg - | ghcVer <- [GHC94 .. GHC910] + | ghcVer <- [GHC96 .. GHC910] ] goldenWithEval :: TestName -> FilePath -> FilePath -> TestTree diff --git a/plugins/hls-eval-plugin/test/testdata/T11.ghc94.expected.hs b/plugins/hls-eval-plugin/test/testdata/T11.ghc94.expected.hs deleted file mode 100644 index 63d0ed8a07..0000000000 --- a/plugins/hls-eval-plugin/test/testdata/T11.ghc94.expected.hs +++ /dev/null @@ -1,4 +0,0 @@ -module T11 where - --- >>> :kind! A --- Not in scope: type constructor or class `A' diff --git a/plugins/hls-explicit-imports-plugin/src/Ide/Plugin/ExplicitImports.hs b/plugins/hls-explicit-imports-plugin/src/Ide/Plugin/ExplicitImports.hs index f24f849476..17634491fe 100644 --- a/plugins/hls-explicit-imports-plugin/src/Ide/Plugin/ExplicitImports.hs +++ b/plugins/hls-explicit-imports-plugin/src/Ide/Plugin/ExplicitImports.hs @@ -472,11 +472,7 @@ extractMinimalImports hsc TcModuleResult {..} = runMaybeT $ do not $ any (\e -> ("module " ++ moduleNameString name) == e) exports isExplicitImport :: ImportDecl GhcRn -> Bool -#if MIN_VERSION_ghc(9,5,0) isExplicitImport ImportDecl {ideclImportList = Just (Exactly, _)} = True -#else -isExplicitImport ImportDecl {ideclHiding = Just (False, _)} = True -#endif isExplicitImport _ = False -- This number is somewhat arbitrarily chosen. Ideally the protocol would tell us these things, @@ -528,11 +524,7 @@ abbreviateImportTitleWithoutModule = abbreviateImportTitle . T.dropWhile (/= '(' filterByImport :: ImportDecl GhcRn -> Map.Map ModuleName [AvailInfo] -> Maybe (Map.Map ModuleName [AvailInfo]) -#if MIN_VERSION_ghc(9,5,0) filterByImport (ImportDecl{ideclImportList = Just (_, L _ names)}) -#else -filterByImport (ImportDecl{ideclHiding = Just (_, L _ names)}) -#endif avails = -- if there is a function defined in the current module and is used -- i.e. if a function is not reexported but defined in current @@ -549,22 +541,12 @@ filterByImport (ImportDecl{ideclHiding = Just (_, L _ names)}) filterByImport _ _ = Nothing constructImport :: ImportDecl GhcRn -> ImportDecl GhcRn -> (ModuleName, [AvailInfo]) -> ImportDecl GhcRn -#if MIN_VERSION_ghc(9,5,0) constructImport ImportDecl{ideclQualified = qualified, ideclImportList = origHiding} imd@ImportDecl{ideclImportList = Just (hiding, L _ names)} -#else -constructImport ImportDecl{ideclQualified = qualified, ideclHiding = origHiding} imd@ImportDecl{ideclHiding = Just (hiding, L _ names)} -#endif (newModuleName, avails) = imd { ideclName = noLocA newModuleName -#if MIN_VERSION_ghc(9,5,0) , ideclImportList = if isNothing origHiding && qualified /= NotQualified then Nothing else Just (hiding, noLocA newNames) -#else - , ideclHiding = if isNothing origHiding && qualified /= NotQualified - then Nothing - else Just (hiding, noLocA newNames) -#endif } where newNames = filter (\n -> any (n `containsAvail`) avails) names -- Check if a name is exposed by AvailInfo (the available information of a module) diff --git a/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs b/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs index 7d77d7ae87..f5687a9db3 100644 --- a/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs +++ b/plugins/hls-gadt-plugin/src/Ide/Plugin/GHC.hs @@ -26,18 +26,13 @@ import Language.Haskell.GHC.ExactPrint.Parsers (parseDecl) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if MIN_VERSION_ghc(9,5,0) import qualified Data.List.NonEmpty as NE -#endif - -#if MIN_VERSION_ghc(9,5,0) && !MIN_VERSION_ghc(9,9,0) -import GHC.Parser.Annotation (TokenLocation (..)) -#endif #if !MIN_VERSION_ghc(9,9,0) import GHC.Parser.Annotation (Anchor (Anchor), AnchorOperation (MovedAnchor), SrcSpanAnn' (SrcSpanAnn), + TokenLocation (..), spanAsAnchor) #endif @@ -106,6 +101,7 @@ h98ToGADTConDecl :: h98ToGADTConDecl dataName tyVars ctxt = \case ConDeclH98{..} -> ConDeclGADT + #if MIN_VERSION_ghc(9,11,0) (AnnConDeclGADT [] [] NoEpUniTok) #elif MIN_VERSION_ghc(9,9,0) @@ -113,13 +109,10 @@ h98ToGADTConDecl dataName tyVars ctxt = \case #else con_ext #endif -#if MIN_VERSION_ghc(9,5,0) + (NE.singleton con_name) -#else - [con_name] -#endif -#if MIN_VERSION_ghc(9,5,0) && !MIN_VERSION_ghc(9,9,0) +#if !MIN_VERSION_ghc(9,9,0) (L NoTokenLoc HsNormalTok) #endif -- Ignore all existential type variable since GADT not needed diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/GHC/Dump.hs b/plugins/hls-refactor-plugin/src/Development/IDE/GHC/Dump.hs index c610225ef5..638d14c51d 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/GHC/Dump.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/GHC/Dump.hs @@ -127,6 +127,7 @@ showAstDataHtml a0 = html $ sourceText :: SourceText -> SDoc sourceText NoSourceText = text "NoSourceText" + #if MIN_VERSION_ghc(9,7,0) sourceText (SourceText src) = text "SourceText" <+> ftext src #else @@ -134,13 +135,13 @@ showAstDataHtml a0 = html $ #endif epaAnchor :: EpaLocation -> SDoc + #if MIN_VERSION_ghc(9,9,0) epaAnchor (EpaSpan s) = parens $ text "EpaSpan" <+> srcSpan s -#elif MIN_VERSION_ghc(9,5,0) - epaAnchor (EpaSpan r _) = text "EpaSpan" <+> realSrcSpan r #else - epaAnchor (EpaSpan r) = text "EpaSpan" <+> realSrcSpan r + epaAnchor (EpaSpan r _) = text "EpaSpan" <+> realSrcSpan r #endif + #if MIN_VERSION_ghc(9,11,0) epaAnchor (EpaDelta s d cs) = text "EpaDelta" <+> srcSpan s <+> deltaPos d <+> showAstDataHtml' cs #else @@ -239,13 +240,8 @@ showAstDataHtml a0 = html $ annotationEpAnnHsCase :: EpAnn EpAnnHsCase -> SDoc annotationEpAnnHsCase = annotation' (text "EpAnn EpAnnHsCase") -#if MIN_VERSION_ghc(9,4,0) annotationEpAnnHsLet :: EpAnn NoEpAnns -> SDoc annotationEpAnnHsLet = annotation' (text "EpAnn NoEpAnns") -#else - annotationEpAnnHsLet :: EpAnn AnnsLet -> SDoc - annotationEpAnnHsLet = annotation' (text "EpAnn AnnsLet") -#endif #if MIN_VERSION_ghc(9,11,0) annotationAnnList :: EpAnn (AnnList ()) -> SDoc diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs b/plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs index 0f740688be..666de9a6f2 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/GHC/ExactPrint.hs @@ -151,13 +151,8 @@ instance Hashable GetAnnotatedParsedSource instance NFData GetAnnotatedParsedSource type instance RuleResult GetAnnotatedParsedSource = ParsedSource -#if MIN_VERSION_ghc(9,5,0) instance Show (HsModule GhcPs) where show _ = "" -#else -instance Show HsModule where - show _ = "" -#endif -- | Get the latest version of the annotated parse source with comments. getAnnotatedParsedSourceRule :: Recorder (WithPriority Log) -> Rules () @@ -622,17 +617,10 @@ modifyMgMatchesT' :: r -> (r -> r -> m r) -> TransformT m (MatchGroup GhcPs (LHsExpr GhcPs), r) -#if MIN_VERSION_ghc(9,5,0) modifyMgMatchesT' (MG xMg (L locMatches matches)) f def combineResults = do (unzip -> (matches', rs)) <- mapM f matches r' <- TransformT $ lift $ foldM combineResults def rs pure (MG xMg (L locMatches matches'), r') -#else -modifyMgMatchesT' (MG xMg (L locMatches matches) originMg) f def combineResults = do - (unzip -> (matches', rs)) <- mapM f matches - r' <- lift $ foldM combineResults def rs - pure (MG xMg (L locMatches matches') originMg, r') -#endif graftSmallestDeclsWithM :: forall a. @@ -735,26 +723,16 @@ annotate :: ASTElement l ast annotate dflags needs_space ast = do uniq <- show <$> uniqueSrcSpanT let rendered = render dflags ast -#if MIN_VERSION_ghc(9,4,0) expr' <- TransformT $ lift $ mapLeft (showSDoc dflags . ppr) $ parseAST dflags uniq rendered pure $ setPrecedingLines expr' 0 (bool 0 1 needs_space) -#else - expr' <- lift $ mapLeft show $ parseAST dflags uniq rendered - pure $ setPrecedingLines expr' 0 (bool 0 1 needs_space) -#endif -- | Given an 'LHsDecl', compute its exactprint annotations. annotateDecl :: DynFlags -> LHsDecl GhcPs -> TransformT (Either String) (LHsDecl GhcPs) annotateDecl dflags ast = do uniq <- show <$> uniqueSrcSpanT let rendered = render dflags ast -#if MIN_VERSION_ghc(9,4,0) expr' <- TransformT $ lift $ mapLeft (showSDoc dflags . ppr) $ parseDecl dflags uniq rendered pure $ setPrecedingLines expr' 1 0 -#else - expr' <- lift $ mapLeft show $ parseDecl dflags uniq rendered - pure $ setPrecedingLines expr' 1 0 -#endif ------------------------------------------------------------------------------ diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs index 2303ce97d7..e471d1781a 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs @@ -18,7 +18,6 @@ module Development.IDE.Plugin.CodeAction ) where import Control.Applicative ((<|>)) -import Control.Applicative.Combinators.NonEmpty (sepBy1) import Control.Arrow (second, (&&&), (>>>)) @@ -73,15 +72,13 @@ import Development.IDE.Types.Diagnostics import Development.IDE.Types.Exports import Development.IDE.Types.Location import Development.IDE.Types.Options -import GHC ( - DeltaPos (..), +import GHC (DeltaPos (..), EpAnn (..), LEpaComment) import qualified GHC.LanguageExtensions as Lang import Ide.Logger hiding (group) import Ide.PluginUtils (extendToFullLines, - extractTextInRange, subRange) import Ide.Types import Language.LSP.Protocol.Message (Method (..), @@ -101,7 +98,6 @@ import Language.LSP.Protocol.Types (ApplyWorkspa type (|?) (InL, InR), uriToFilePath) import qualified Text.Fuzzy.Parallel as TFP -import qualified Text.Regex.Applicative as RE import Text.Regex.TDFA ((=~), (=~~)) -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] @@ -109,9 +105,9 @@ import Text.Regex.TDFA ((=~), (=~~)) #if !MIN_VERSION_ghc(9,9,0) import Development.IDE.GHC.Compat.ExactPrint (makeDeltaAst) import GHC (AddEpAnn (AddEpAnn), - AnnsModule (am_main), Anchor (anchor_op), AnchorOperation (..), + AnnsModule (am_main), EpaLocation (..)) #endif @@ -122,12 +118,13 @@ import GHC (AddEpAnn (Ad EpaLocation' (..), HasLoc (..)) #endif + #if MIN_VERSION_ghc(9,11,0) -import GHC (EpaLocation, - AnnsModule (am_where), +import GHC (AnnsModule (am_where), + EpToken (..), + EpaLocation, EpaLocation' (..), - HasLoc (..), - EpToken (..)) + HasLoc (..)) #endif @@ -270,19 +267,11 @@ extendImportHandler' ideState ExtendImport {..} isWantedModule :: ModuleName -> Maybe ModuleName -> GenLocated l (ImportDecl GhcPs) -> Bool isWantedModule wantedModule Nothing (L _ it@ImportDecl{ ideclName -#if MIN_VERSION_ghc(9,5,0) , ideclImportList = Just (Exactly, _) -#else - , ideclHiding = Just (False, _) -#endif }) = not (isQualifiedImport it) && unLoc ideclName == wantedModule isWantedModule wantedModule (Just qual) (L _ ImportDecl{ ideclAs, ideclName -#if MIN_VERSION_ghc(9,5,0) , ideclImportList = Just (Exactly, _) -#else - , ideclHiding = Just (False, _) -#endif }) = unLoc ideclName == wantedModule && (wantedModule == qual || (unLoc <$> ideclAs) == Just qual) isWantedModule _ _ _ = False @@ -680,14 +669,16 @@ suggestDeleteUnusedBinding indexedContent name (L _ Match{m_grhss=GRHSs{grhssLocalBinds}}) = do - let go bag lsigs = + let emptyBag bag = #if MIN_VERSION_ghc(9,11,0) - if null bag + null bag #else - if isEmptyBag bag + isEmptyBag bag #endif - then [] - else concatMap (findRelatedSpanForHsBind indexedContent name lsigs) bag + go bag lsigs = + if emptyBag bag + then [] + else concatMap (findRelatedSpanForHsBind indexedContent name lsigs) bag case grhssLocalBinds of (HsValBinds _ (ValBinds _ bag lsigs)) -> go bag lsigs _ -> [] @@ -858,7 +849,6 @@ suggestAddTypeAnnotationToSatisfyConstraints sourceOpt Diagnostic{_range=_range, | otherwise = [] where makeAnnotatedLit ty lit = "(" <> lit <> " :: " <> ty <> ")" -#if MIN_VERSION_ghc(9,4,0) pat multiple at inArg inExpr = T.concat [ ".*Defaulting the type variable " , ".*to type ‘([^ ]+)’ " , "in the following constraint" @@ -869,17 +859,6 @@ suggestAddTypeAnnotationToSatisfyConstraints sourceOpt Diagnostic{_range=_range, , if inExpr then ".+In the expression" else "" , ".+In the expression" ] -#else - pat multiple at inArg inExpr = T.concat [ ".*Defaulting the following constraint" - , if multiple then "s" else "" - , " to type ‘([^ ]+)’ " - , ".*arising from the literal ‘(.+)’" - , if inArg then ".+In the.+argument" else "" - , if at then ".+at ([^ ]*)" else "" - , if inExpr then ".+In the expression" else "" - , ".+In the expression" - ] -#endif codeEdit range ty lit replacement = let title = "Add type annotation ‘" <> ty <> "’ to ‘" <> lit <> "’" edits = [TextEdit range replacement] @@ -1159,17 +1138,10 @@ occursUnqualified symbol ImportDecl{..} | isNothing ideclAs = Just False /= -- I don't find this particularly comprehensible, -- but HLint suggested me to do so... -#if MIN_VERSION_ghc(9,5,0) (ideclImportList <&> \(isHiding, L _ ents) -> let occurs = any ((symbol `symbolOccursIn`) . unLoc) ents in (isHiding == EverythingBut) && not occurs || (isHiding == Exactly) && occurs ) -#else - (ideclHiding <&> \(isHiding, L _ ents) -> - let occurs = any ((symbol `symbolOccursIn`) . unLoc) ents - in isHiding && not occurs || not isHiding && occurs - ) -#endif occursUnqualified _ _ = False symbolOccursIn :: T.Text -> IE GhcPs -> Bool @@ -1507,11 +1479,6 @@ suggestNewImport df packageExportsMap ps fileContents Diagnostic{..} >>= (findImportDeclByModuleName hsmodImports . T.unpack) >>= ideclAs . unLoc <&> T.pack . moduleNameString . unLoc - , -- tentative workaround for detecting qualification in GHC 9.4 - -- FIXME: We can delete this after dropping the support for GHC 9.4 - qualGHC94 <- - guard (ghcVersion == GHC94) - *> extractQualifiedModuleNameFromMissingName (extractTextInRange _range fileContents) , Just (range, indent) <- newImportInsertRange ps fileContents , extendImportSuggestions <- matchRegexUnifySpaces msg #if MIN_VERSION_ghc(9,7,0) @@ -1520,84 +1487,13 @@ suggestNewImport df packageExportsMap ps fileContents Diagnostic{..} "Perhaps you want to add ‘[^’]*’ to the import list in the import of ‘([^’]*)’" #endif = let qis = qualifiedImportStyle df - -- FIXME: we can use thingMissing once the support for GHC 9.4 is dropped. - -- In what fllows, @missing@ is assumed to be qualified name. - -- @thingMissing@ is already as desired with GHC != 9.4. - -- In GHC 9.4, however, GHC drops a module qualifier from a qualified symbol. - -- Thus we need to explicitly concatenate qualifier explicity in GHC 9.4. - missing - | GHC94 <- ghcVersion - , isNothing (qual <|> qual') - , Just q <- qualGHC94 = - qualify q thingMissing - | otherwise = thingMissing suggestions = nubSortBy simpleCompareImportSuggestion - (constructNewImportSuggestions packageExportsMap (qual <|> qual' <|> qualGHC94, missing) extendImportSuggestions qis) in + (constructNewImportSuggestions packageExportsMap (qual <|> qual', thingMissing) extendImportSuggestions qis) in map (\(ImportSuggestion _ kind (unNewImport -> imp)) -> (imp, kind, TextEdit range (imp <> "\n" <> T.replicate indent " "))) suggestions where - qualify q (NotInScopeDataConstructor d) = NotInScopeDataConstructor (q <> "." <> d) - qualify q (NotInScopeTypeConstructorOrClass d) = NotInScopeTypeConstructorOrClass (q <> "." <> d) - qualify q (NotInScopeThing d) = NotInScopeThing (q <> "." <> d) - L _ HsModule {..} = ps suggestNewImport _ _ _ _ _ = [] -{- | -Extracts qualifier of the symbol from the missing symbol. -Input must be either a plain qualified variable or possibly-parenthesized qualified binary operator (though no strict checking is done for symbol part). -This is only needed to alleviate the issue #3473. - -FIXME: We can delete this after dropping the support for GHC 9.4 - ->>> extractQualifiedModuleNameFromMissingName "P.lookup" -Just "P" - ->>> extractQualifiedModuleNameFromMissingName "ΣP3_'.σlookup" -Just "\931P3_'" - ->>> extractQualifiedModuleNameFromMissingName "ModuleA.Gre_ekσ.goodδ" -Just "ModuleA.Gre_ek\963" - ->>> extractQualifiedModuleNameFromMissingName "(ModuleA.Gre_ekσ.+)" -Just "ModuleA.Gre_ek\963" - ->>> extractQualifiedModuleNameFromMissingName "(ModuleA.Gre_ekσ..|.)" -Just "ModuleA.Gre_ek\963" - ->>> extractQualifiedModuleNameFromMissingName "A.B.|." -Just "A.B" --} -extractQualifiedModuleNameFromMissingName :: T.Text -> Maybe T.Text -extractQualifiedModuleNameFromMissingName (T.strip -> missing) - = T.pack <$> (T.unpack missing RE.=~ qualIdentP) - where - {- - NOTE: Haskell 2010 allows /unicode/ upper & lower letters - as a module name component; otoh, regex-tdfa only allows - /ASCII/ letters to be matched with @[[:upper:]]@ and/or @[[:lower:]]@. - Hence we use regex-applicative(-text) for finer-grained predicates. - - RULES (from [Section 10 of Haskell 2010 Report](https://www.haskell.org/onlinereport/haskell2010/haskellch10.html)): - modid → {conid .} conid - conid → large {small | large | digit | ' } - small → ascSmall | uniSmall | _ - ascSmall → a | b | … | z - uniSmall → any Unicode lowercase letter - large → ascLarge | uniLarge - ascLarge → A | B | … | Z - uniLarge → any uppercase or titlecase Unicode letter - -} - - qualIdentP = parensQualOpP <|> qualVarP - parensQualOpP = RE.sym '(' *> modNameP <* RE.sym '.' <* RE.anySym <* RE.few RE.anySym <* RE.sym ')' - qualVarP = modNameP <* RE.sym '.' <* RE.some RE.anySym - conIDP = RE.withMatched $ - RE.psym isUpper - *> RE.many - (RE.psym $ \c -> c == '\'' || c == '_' || isUpper c || isLower c || isDigit c) - modNameP = fmap snd $ RE.withMatched $ conIDP `sepBy1` RE.sym '.' - - -- | A Backward compatible implementation of `lookupOccEnv_AllNameSpaces` for -- GHC <=9.6 -- @@ -1740,11 +1636,7 @@ findPositionAfterModuleName ps _hsmodName' = do -- The relative position of 'where' keyword (in lines, relative to the previous AST node). -- The exact-print API changed a lot in ghc-9.2, so we need to handle it separately for different compiler versions. whereKeywordLineOffset :: Maybe Int -#if MIN_VERSION_ghc(9,5,0) whereKeywordLineOffset = case hsmodAnn hsmodExt of -#else - whereKeywordLineOffset = case hsmodAnn of -#endif EpAnn _ annsModule _ -> do -- Find the first 'where' #if MIN_VERSION_ghc(9,11,0) @@ -1757,8 +1649,8 @@ findPositionAfterModuleName ps _hsmodName' = do EpAnnNotUsed -> Nothing #endif #if MIN_VERSION_ghc(9,11,0) - filterWhere (EpTok loc) = Just loc - filterWhere _ = Nothing + filterWhere (EpTok loc) = Just loc + filterWhere _ = Nothing #else filterWhere (AddEpAnn AnnWhere loc) = Just loc filterWhere _ = Nothing @@ -1768,11 +1660,8 @@ findPositionAfterModuleName ps _hsmodName' = do #if MIN_VERSION_ghc(9,9,0) epaLocationToLine (EpaSpan sp) = fmap (srcLocLine . realSrcSpanEnd) $ srcSpanToRealSrcSpan sp -#elif MIN_VERSION_ghc(9,5,0) - epaLocationToLine (EpaSpan sp _) - = Just . srcLocLine . realSrcSpanEnd $ sp #else - epaLocationToLine (EpaSpan sp) + epaLocationToLine (EpaSpan sp _) = Just . srcLocLine . realSrcSpanEnd $ sp #endif #if MIN_VERSION_ghc(9,11,0) @@ -1797,7 +1686,7 @@ findPositionAfterModuleName ps _hsmodName' = do #if MIN_VERSION_ghc(9,11,0) anchorOpLine :: EpaLocation' a -> Int - anchorOpLine EpaSpan{} = 0 + anchorOpLine EpaSpan{} = 0 anchorOpLine (EpaDelta _ (SameLine _) _) = 0 anchorOpLine (EpaDelta _ (DifferentLine line _) _) = line #elif MIN_VERSION_ghc(9,9,0) @@ -2056,21 +1945,12 @@ textInRange (Range (Position (fromIntegral -> startRow) (fromIntegral -> startCo -- | Returns the ranges for a binding in an import declaration rangesForBindingImport :: ImportDecl GhcPs -> String -> [Range] -#if MIN_VERSION_ghc(9,5,0) rangesForBindingImport ImportDecl{ ideclImportList = Just (Exactly, L _ lies) } b = concatMap (mapMaybe srcSpanToRange . rangesForBinding' b') lies where b' = wrapOperatorInParens b -#else -rangesForBindingImport ImportDecl{ - ideclHiding = Just (False, L _ lies) - } b = - concatMap (mapMaybe srcSpanToRange . rangesForBinding' b') lies - where - b' = wrapOperatorInParens b -#endif rangesForBindingImport _ _ = [] wrapOperatorInParens :: String -> String diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs index 2994fe726d..0f48a3a649 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction/ExactPrint.hs @@ -139,10 +139,8 @@ removeConstraint toRemove = go . traceAst "REMOVE_CONSTRAINT_input" go :: LHsType GhcPs -> Rewrite #if MIN_VERSION_ghc(9,9,0) go lHsType@(makeDeltaAst -> L l it@HsQualTy{hst_ctxt = L l' ctxt, hst_body}) = Rewrite (locA lHsType) $ \_ -> do -#elif MIN_VERSION_ghc(9,4,0) - go (L l it@HsQualTy{hst_ctxt = L l' ctxt, hst_body}) = Rewrite (locA l) $ \_ -> do #else - go (L l it@HsQualTy{hst_ctxt = Just (L l' ctxt), hst_body}) = Rewrite (locA l) $ \_ -> do + go (L l it@HsQualTy{hst_ctxt = L l' ctxt, hst_body}) = Rewrite (locA l) $ \_ -> do #endif let ctxt' = filter (not . toRemove) ctxt removeStuff = (toRemove <$> headMaybe ctxt) == Just True @@ -151,11 +149,7 @@ removeConstraint toRemove = go . traceAst "REMOVE_CONSTRAINT_input" [] -> hst_body' _ -> do let ctxt'' = over _last (first removeComma) ctxt' -#if MIN_VERSION_ghc(9,4,0) L l $ it{ hst_ctxt = L l' ctxt'' -#else - L l $ it{ hst_ctxt = Just $ L l' ctxt'' -#endif , hst_body = hst_body' } go (L _ (HsParTy _ ty)) = go ty @@ -172,11 +166,7 @@ appendConstraint :: Rewrite appendConstraint constraintT = go . traceAst "appendConstraint" where -#if MIN_VERSION_ghc(9,4,0) go (L l it@HsQualTy{hst_ctxt = L l' ctxt}) = Rewrite (locA l) $ \df -> do -#else - go (L l it@HsQualTy{hst_ctxt = Just (L l' ctxt)}) = Rewrite (locA l) $ \df -> do -#endif constraint <- liftParseAST df constraintT constraint <- pure $ setEntryDP constraint (SameLine 1) #if MIN_VERSION_ghc(9,9,0) @@ -196,11 +186,7 @@ appendConstraint constraintT = go . traceAst "appendConstraint" #endif _ -> Nothing ctxt' = over _last (first addComma) $ map dropHsParTy ctxt -#if MIN_VERSION_ghc(9,4,0) return $ L l $ it{hst_ctxt = L l'' $ ctxt' ++ [constraint]} -#else - return $ L l $ it{hst_ctxt = Just $ L l'' $ ctxt' ++ [constraint]} -#endif go (L _ HsForAllTy{hst_body}) = go hst_body go (L _ (HsParTy _ ty)) = go ty go ast@(L l _) = Rewrite (locA l) $ \df -> do @@ -208,11 +194,7 @@ appendConstraint constraintT = go . traceAst "appendConstraint" constraint <- liftParseAST df constraintT lContext <- uniqueSrcSpanT lTop <- uniqueSrcSpanT -#if MIN_VERSION_ghc(9,4,0) let context = reAnnL annCtxt emptyComments $ L lContext [resetEntryDP constraint] -#else - let context = Just $ reAnnL annCtxt emptyComments $ L lContext [resetEntryDP constraint] -#endif #if MIN_VERSION_ghc(9,11,0) annCtxt = AnnContext (Just (EpUniTok (epl 1) NormalSyntax)) [EpTok (epl 0) | needsParens] [EpTok (epl 0) | needsParens] #else @@ -264,11 +246,7 @@ extendImportTopLevel :: LImportDecl GhcPs -> TransformT (Either String) (LImportDecl GhcPs) extendImportTopLevel thing (L l it@ImportDecl{..}) -#if MIN_VERSION_ghc(9,5,0) | Just (hide, L l' lies) <- ideclImportList -#else - | Just (hide, L l' lies) <- ideclHiding -#endif = do src <- uniqueSrcSpanT top <- uniqueSrcSpanT @@ -280,9 +258,7 @@ extendImportTopLevel thing (L l it@ImportDecl{..}) TransformT $ lift (Left $ thing <> " already imported") let lie = reLocA $ L src $ IEName -#if MIN_VERSION_ghc(9,5,0) noExtField -#endif rdr x = reLocA $ L top $ IEVar #if MIN_VERSION_ghc(9,8,0) @@ -299,11 +275,7 @@ extendImportTopLevel thing (L l it@ImportDecl{..}) then TransformT $ lift (Left $ thing <> " already imported") else do let lies' = addCommaInImportList lies x -#if MIN_VERSION_ghc(9,5,0) return $ L l it{ideclImportList = Just (hide, L l' lies')} -#else - return $ L l it{ideclHiding = Just (hide, L l' lies')} -#endif extendImportTopLevel _ _ = TransformT $ lift $ Left "Unable to extend the import list" wildCardSymbol :: String @@ -333,11 +305,7 @@ extendImportViaParent :: LImportDecl GhcPs -> TransformT (Either String) (LImportDecl GhcPs) extendImportViaParent df parent child (L l it@ImportDecl{..}) -#if MIN_VERSION_ghc(9,5,0) | Just (hide, L l' lies) <- ideclImportList = go hide l' [] lies -#else - | Just (hide, L l' lies) <- ideclHiding = go hide l' [] lies -#endif where #if MIN_VERSION_ghc(9,9,0) go _hide _l' _pre ((L _ll' (IEThingAll _ (L _ ie) _)) : _xs) @@ -355,9 +323,7 @@ extendImportViaParent df parent child (L l it@ImportDecl{..}) srcChild <- uniqueSrcSpanT let childRdr = reLocA $ L srcChild $ mkRdrUnqual $ mkVarOcc child childLIE = reLocA $ L srcChild $ IEName -#if MIN_VERSION_ghc(9,5,0) noExtField -#endif childRdr x :: LIE GhcPs = L ll' $ IEThingWith #if MIN_VERSION_ghc(9,11,0) @@ -374,12 +340,7 @@ extendImportViaParent df parent child (L l it@ImportDecl{..}) docs #endif - -#if MIN_VERSION_ghc(9,5,0) return $ L l it{ideclImportList = Just (hide, L l' $ reverse pre ++ [x] ++ xs)} -#else - return $ L l it{ideclHiding = Just (hide, L l' $ reverse pre ++ [x] ++ xs)} -#endif #if MIN_VERSION_ghc(9,9,0) go hide l' pre ((L l'' (IEThingWith l''' twIE@(L _ ie) _ lies' docs)) : xs) @@ -389,11 +350,7 @@ extendImportViaParent df parent child (L l it@ImportDecl{..}) -- ThingWith ie lies' => ThingWith ie (lies' ++ [child]) | parent == unIEWrappedName ie , child == wildCardSymbol = do -#if MIN_VERSION_ghc(9,5,0) let it' = it{ideclImportList = Just (hide, lies)} -#else - let it' = it{ideclHiding = Just (hide, lies)} -#endif thing = IEThingWith newl twIE (IEWildcard 2) [] #if MIN_VERSION_ghc(9,9,0) docs @@ -419,15 +376,9 @@ extendImportViaParent df parent child (L l it@ImportDecl{..}) TransformT $ lift (Left $ child <> " already included in " <> parent <> " imports") let childLIE = reLocA $ L srcChild $ IEName -#if MIN_VERSION_ghc(9,5,0) noExtField -#endif childRdr -#if MIN_VERSION_ghc(9,5,0) let it' = it{ideclImportList = Just (hide, lies)} -#else - let it' = it{ideclHiding = Just (hide, lies)} -#endif lies = L l' $ reverse pre ++ [L l'' (IEThingWith l''' twIE NoIEWildcard (over _last fixLast lies' ++ [childLIE]) #if MIN_VERSION_ghc(9,9,0) @@ -451,9 +402,7 @@ extendImportViaParent df parent child (L l it@ImportDecl{..}) let parentLIE = reLocA $ L srcParent $ if isParentOperator then IEType (epl 0) parentRdr' #endif else IEName -#if MIN_VERSION_ghc(9,5,0) noExtField -#endif parentRdr' parentRdr' = modifyAnns parentRdr $ \case #if MIN_VERSION_ghc(9,11,0) @@ -463,9 +412,7 @@ extendImportViaParent df parent child (L l it@ImportDecl{..}) #endif other -> other childLIE = reLocA $ L srcChild $ IEName -#if MIN_VERSION_ghc(9,5,0) noExtField -#endif childRdr #if MIN_VERSION_ghc(9,11,0) listAnn = (Nothing, (EpTok (epl 1), NoEpTok, NoEpTok, EpTok (epl 0))) @@ -482,11 +429,7 @@ extendImportViaParent df parent child (L l it@ImportDecl{..}) #endif lies' = addCommaInImportList (reverse pre) x -#if MIN_VERSION_ghc(9,5,0) return $ L l it{ideclImportList = Just (hide, L l' lies')} -#else - return $ L l it{ideclHiding = Just (hide, L l' lies')} -#endif extendImportViaParent _ _ _ _ = TransformT $ lift $ Left "Unable to extend the import list via parent" -- Add an item in an import list, taking care of adding comma if needed. @@ -527,11 +470,7 @@ addCommaInImportList lies x = fixLast :: [LocatedAn AnnListItem a] -> [LocatedAn AnnListItem a] fixLast = over _last (first (if existingTrailingComma then id else addComma)) -#if MIN_VERSION_ghc(9,5,0) unIEWrappedName :: IEWrappedName GhcPs -> String -#else -unIEWrappedName :: IEWrappedName (IdP GhcPs) -> String -#endif unIEWrappedName (occName -> occ) = T.unpack $ printOutputable $ parenSymOcc occ (ppr occ) hasParen :: String -> Bool @@ -545,17 +484,10 @@ hasParen _ = False hideSymbol :: String -> LImportDecl GhcPs -> Rewrite hideSymbol symbol lidecl@(L loc ImportDecl{..}) = -#if MIN_VERSION_ghc(9,5,0) case ideclImportList of Nothing -> Rewrite (locA loc) $ extendHiding symbol lidecl Nothing Just (EverythingBut, hides) -> Rewrite (locA loc) $ extendHiding symbol lidecl (Just hides) Just (Exactly, imports) -> Rewrite (locA loc) $ deleteFromImport symbol lidecl $ setEntryDP (makeDeltaAst imports) (SameLine 1) -#else - case ideclHiding of - Nothing -> Rewrite (locA loc) $ extendHiding symbol lidecl Nothing - Just (True, hides) -> Rewrite (locA loc) $ extendHiding symbol lidecl (Just hides) - Just (False, imports) -> Rewrite (locA loc) $ deleteFromImport symbol lidecl imports -#endif extendHiding :: String -> @@ -597,9 +529,7 @@ extendHiding symbol (L l idecls) mlies df = do rdr <- liftParseAST df symbol rdr <- pure $ modifyAnns rdr $ addParens (isOperator $ unLoc rdr) let lie = reLocA $ L src $ IEName -#if MIN_VERSION_ghc(9,5,0) noExtField -#endif rdr x = reLocA $ L top $ IEVar #if MIN_VERSION_ghc(9,7,0) @@ -613,11 +543,7 @@ extendHiding symbol (L l idecls) mlies df = do #endif x <- pure $ if hasSibling then first addComma x else x lies <- pure $ over _head (`setEntryDP` SameLine 1) lies -#if MIN_VERSION_ghc(9,5,0) return $ L l idecls{ideclImportList = Just (EverythingBut, L l' $ x : lies)} -#else - return $ L l idecls{ideclHiding = Just (True, L l' $ x : lies)} -#endif where isOperator = not . all isAlphaNum . occNameString . rdrNameOcc @@ -632,11 +558,7 @@ deleteFromImport (T.pack -> symbol) (L l idecl) (L lieLoc lies) _ = do lidecl' = L l $ idecl -#if MIN_VERSION_ghc(9,5,0) { ideclImportList = Just (Exactly, edited) } -#else - { ideclHiding = Just (False, edited) } -#endif pure lidecl' where deletedLies = diff --git a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs index f48d8355d7..aec82cb17f 100644 --- a/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs +++ b/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/Plugins/AddArgument.hs @@ -24,13 +24,7 @@ import Language.LSP.Protocol.Types -- See Note [Guidelines For Using CPP In GHCIDE Import Statements] -#if !MIN_VERSION_ghc(9,4,0) -import GHC.Parser.Annotation (IsUnicodeSyntax (..), - TrailingAnn (..)) -import Language.Haskell.GHC.ExactPrint (d1) -#endif - -#if MIN_VERSION_ghc(9,4,0) && !MIN_VERSION_ghc(9,9,0) +#if MIN_VERSION_ghc(9,6,0) && !MIN_VERSION_ghc(9,9,0) import Development.IDE.GHC.ExactPrint (epl) import GHC.Parser.Annotation (TokenLocation (..)) #endif @@ -50,8 +44,9 @@ import GHC (DeltaPos (..), IsUnicodeSyntax (NormalSyntax)) import Language.Haskell.GHC.ExactPrint (d1, setEntryDP) #endif + #if MIN_VERSION_ghc(9,11,0) -import GHC.Parser.Annotation (EpToken(..)) +import GHC.Parser.Annotation (EpToken (..)) #endif -- When GHC tells us that a variable is not bound, it will tell us either: @@ -79,27 +74,33 @@ plugin parsedModule Diagnostic {_message, _range} -- addArgToMatch "foo" `bar arg1 arg2 = ...` -- => (`bar arg1 arg2 foo = ...`, 2) addArgToMatch :: T.Text -> GenLocated l (Match GhcPs (LocatedA (HsExpr GhcPs))) -> (GenLocated l (Match GhcPs (LocatedA (HsExpr GhcPs))), Int) + +-- NOTE: The code duplication within CPP clauses avoids a parse error with +-- `stylish-haskell`. #if MIN_VERSION_ghc(9,11,0) addArgToMatch name (L locMatch (Match xMatch ctxMatch (L l pats) rhs)) = -#else + let unqualName = mkRdrUnqual $ mkVarOcc $ T.unpack name + newPat = L noAnnSrcSpanDP1 $ VarPat NoExtField $ L noAnn unqualName + -- The intention is to move `= ...` (right-hand side with equals) to the right so there's 1 space between + -- the newly added pattern and the rest + indentRhs :: GRHSs GhcPs (LocatedA (HsExpr GhcPs)) -> GRHSs GhcPs (LocatedA (HsExpr GhcPs)) + indentRhs rhs@GRHSs{grhssGRHSs} = rhs {grhssGRHSs = fmap (`setEntryDP` (SameLine 1)) grhssGRHSs } + in (L locMatch (Match xMatch ctxMatch (L l (pats <> [newPat])) (indentRhs rhs)), Prelude.length pats) +#elif MIN_VERSION_ghc(9,9,0) addArgToMatch name (L locMatch (Match xMatch ctxMatch pats rhs)) = -#endif -#if MIN_VERSION_ghc(9,9,0) let unqualName = mkRdrUnqual $ mkVarOcc $ T.unpack name newPat = L noAnnSrcSpanDP1 $ VarPat NoExtField $ L noAnn unqualName -- The intention is to move `= ...` (right-hand side with equals) to the right so there's 1 space between -- the newly added pattern and the rest indentRhs :: GRHSs GhcPs (LocatedA (HsExpr GhcPs)) -> GRHSs GhcPs (LocatedA (HsExpr GhcPs)) indentRhs rhs@GRHSs{grhssGRHSs} = rhs {grhssGRHSs = fmap (`setEntryDP` (SameLine 1)) grhssGRHSs } + in (L locMatch (Match xMatch ctxMatch (pats <> [newPat]) (indentRhs rhs)), Prelude.length pats) #else +addArgToMatch name (L locMatch (Match xMatch ctxMatch pats rhs)) = let unqualName = mkRdrUnqual $ mkVarOcc $ T.unpack name newPat = L (noAnnSrcSpanDP1 generatedSrcSpan) $ VarPat NoExtField (noLocA unqualName) indentRhs = id -#endif -#if MIN_VERSION_ghc(9,11,0) - in (L locMatch (Match xMatch ctxMatch (L l (pats <> [newPat])) (indentRhs rhs)), Prelude.length pats) -#else - in (L locMatch (Match xMatch ctxMatch (pats <> [newPat]) (indentRhs rhs)), Prelude.length pats) + in (L locMatch (Match xMatch ctxMatch (pats <> [newPat]) (indentRhs rhs)), Prelude.length pats) #endif -- Attempt to insert a binding pattern into each match for the given LHsDecl; succeeds only if the function is a FunBind. @@ -186,9 +187,9 @@ addTyHoleToTySigArg loc (L annHsSig (HsSig xHsSig tyVarBndrs lsigTy)) = , L wildCardAnn $ HsWildCardTy NoEpTok #else , L wildCardAnn $ HsWildCardTy noExtField -#endif +#endif ) -#elif MIN_VERSION_ghc(9,4,0) +#else wildCardAnn = SrcSpanAnn (EpAnn genAnchor1 (AnnListItem []) emptyComments) generatedSrcSpan arrowAnn = TokenLoc (epl 1) newArg = @@ -197,14 +198,6 @@ addTyHoleToTySigArg loc (L annHsSig (HsSig xHsSig tyVarBndrs lsigTy)) = , HsUnrestrictedArrow (L arrowAnn HsNormalTok) , L wildCardAnn $ HsWildCardTy noExtField ) -#else - wildCardAnn = SrcSpanAnn (EpAnn genAnchor1 (AnnListItem [AddRarrowAnn d1]) emptyComments) generatedSrcSpan - newArg = - ( SrcSpanAnn mempty generatedSrcSpan - , noAnn - , HsUnrestrictedArrow NormalSyntax - , L wildCardAnn $ HsWildCardTy noExtField - ) #endif -- NOTE if the location that the argument wants to be placed at is not one more than the number of arguments -- in the signature, then we return the original type signature. diff --git a/plugins/hls-refactor-plugin/test/Main.hs b/plugins/hls-refactor-plugin/test/Main.hs index f3756506e9..2057e76e57 100644 --- a/plugins/hls-refactor-plugin/test/Main.hs +++ b/plugins/hls-refactor-plugin/test/Main.hs @@ -1,5 +1,5 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE GADTs #-} @@ -1359,8 +1359,7 @@ extendImportTests = testGroup "extend import actions" [ "import Data.Monoid (First (..))" , "f = (First Nothing) <> mempty" ]) - , brokenForGHC94 "On GHC 9.4, the error messages with -fdefer-type-errors don't have necessary imported target srcspan info." $ - testSession "extend single line qualified import with value" $ template + , testSession "extend single line qualified import with value" $ template [("ModuleA.hs", T.unlines [ "module ModuleA where" , "stuffA :: Double" @@ -1552,8 +1551,7 @@ extendImportTests = testGroup "extend import actions" ) (Range (Position 2 3) (Position 2 7)) ) - , ignoreForGhcVersions [GHC94] "Diagnostic message has no suggestions" $ - testSession "type constructor name same as data constructor name" $ template + , testSession "type constructor name same as data constructor name" $ template [("ModuleA.hs", T.unlines [ "module ModuleA where" , "newtype Foo = Foo Int" @@ -1855,7 +1853,7 @@ suggestImportTests = testGroup "suggest import actions" suggestAddRecordFieldImportTests :: TestTree suggestAddRecordFieldImportTests = testGroup "suggest imports of record fields when using OverloadedRecordDot" [ testGroup "The field is suggested when an instance resolution failure occurs" - ([ ignoreForGhcVersions [GHC94, GHC96] "Extension not present <9.2, and the assist is derived from the help message in >=9.4" theTest + ([ ignoreForGhcVersions [GHC96] "Extension not present <9.2, and the assist is derived from the help message in >=9.4" theTest ] ++ [ theTestIndirect qualifiedGhcRecords polymorphicType @@ -2619,9 +2617,7 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t , "" , "f = 1" ] - (if ghcVersion >= GHC94 - then [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the type variable", Nothing) ] - else [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the following constraint", Nothing) ]) + [ (DiagnosticSeverity_Warning, (3, 4), "Defaulting the type variable", Nothing) ] "Add type annotation ‘Integer’ to ‘1’" [ "{-# OPTIONS_GHC -Wtype-defaults #-}" , "module A (f) where" @@ -2638,9 +2634,7 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t , " let x = 3" , " in x" ] - (if ghcVersion >= GHC94 - then [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the type variable", Nothing) ] - else [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the following constraint", Nothing) ]) + [ (DiagnosticSeverity_Warning, (4, 12), "Defaulting the type variable", Nothing) ] "Add type annotation ‘Integer’ to ‘3’" [ "{-# OPTIONS_GHC -Wtype-defaults #-}" , "module A where" @@ -2658,9 +2652,7 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t , " let x = let y = 5 in y" , " in x" ] - (if ghcVersion >= GHC94 - then [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the type variable", Nothing) ] - else [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the following constraint", Nothing) ]) + [ (DiagnosticSeverity_Warning, (4, 20), "Defaulting the type variable", Nothing) ] "Add type annotation ‘Integer’ to ‘5’" [ "{-# OPTIONS_GHC -Wtype-defaults #-}" , "module A where" @@ -2679,15 +2671,9 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t , "" , "f = seq \"debug\" traceShow \"debug\"" ] - (if ghcVersion >= GHC94 - then - [ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the type variable", Nothing) - , (DiagnosticSeverity_Warning, (6, 16), "Defaulting the type variable", Nothing) - ] - else - [ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the following constraint", Nothing) - , (DiagnosticSeverity_Warning, (6, 16), "Defaulting the following constraint", Nothing) - ]) + [ (DiagnosticSeverity_Warning, (6, 8), "Defaulting the type variable", Nothing) + , (DiagnosticSeverity_Warning, (6, 16), "Defaulting the type variable", Nothing) + ] ("Add type annotation ‘" <> stringLit <> "’ to ‘\"debug\"’") [ "{-# OPTIONS_GHC -Wtype-defaults #-}" , "{-# LANGUAGE OverloadedStrings #-}" @@ -2707,9 +2693,7 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t , "" , "f a = traceShow \"debug\" a" ] - (if ghcVersion >= GHC94 - then [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the type variable", Nothing) ] - else [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the following constraint", Nothing) ]) + [ (DiagnosticSeverity_Warning, (6, 6), "Defaulting the type variable", Nothing) ] ("Add type annotation ‘" <> stringLit <> "’ to ‘\"debug\"’") [ "{-# OPTIONS_GHC -Wtype-defaults #-}" , "{-# LANGUAGE OverloadedStrings #-}" @@ -2729,9 +2713,7 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t , "" , "f = seq (\"debug\" :: [Char]) (seq (\"debug\" :: [Char]) (traceShow \"debug\"))" ] - (if ghcVersion >= GHC94 - then [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the type variable", Nothing) ] - else [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the following constraint", Nothing) ]) + [ (DiagnosticSeverity_Warning, (6, 54), "Defaulting the type variable", Nothing) ] ("Add type annotation ‘"<> stringLit <>"’ to ‘\"debug\"’") [ "{-# OPTIONS_GHC -Wtype-defaults #-}" , "{-# LANGUAGE OverloadedStrings #-}" @@ -3405,8 +3387,7 @@ exportUnusedTests = testGroup "export unused actions" ] (R 2 0 2 11) "Export ‘bar’" - , ignoreForGhcVersions [GHC94] "Diagnostic message has no suggestions" $ - testSession "type is exported but not the constructor of same name" $ templateNoAction + , testSession "type is exported but not the constructor of same name" $ templateNoAction [ "{-# OPTIONS_GHC -Wunused-top-binds #-}" , "module A (Foo) where" , "data Foo = Foo" @@ -4049,6 +4030,3 @@ pattern R x y x' y' = Range (Position x y) (Position x' y') -- @/var@ withTempDir :: (FilePath -> IO a) -> IO a withTempDir f = System.IO.Extra.withTempDir $ (canonicalizePath >=> f) - -brokenForGHC94 :: String -> TestTree -> TestTree -brokenForGHC94 = knownBrokenForGhcVersions [GHC94] diff --git a/plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs b/plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs index fe72d945f4..2e39ffcd98 100644 --- a/plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs +++ b/plugins/hls-retrie-plugin/src/Ide/Plugin/Retrie.hs @@ -465,11 +465,7 @@ suggestRuleRewrites originatingFile pos ms_mod (L _ HsRules {rds_rules}) = ] | L (locA -> l) r <- rds_rules, pos `isInsideSrcSpan` l, -#if MIN_VERSION_ghc(9,5,0) let HsRule {rd_name = L _ rn} = r, -#else - let HsRule {rd_name = L _ (_, rn)} = r, -#endif let ruleName = unpackFS rn ] where @@ -736,7 +732,6 @@ toImportDecl AddImport {..} = GHC.ImportDecl {ideclSource = ideclSource', ..} ideclPkgQual = NoRawPkgQual -#if MIN_VERSION_ghc(9,5,0) ideclImportList = Nothing ideclExt = GHCGHC.XImportDeclPass { ideclAnn = @@ -748,11 +743,6 @@ toImportDecl AddImport {..} = GHC.ImportDecl {ideclSource = ideclSource', ..} , ideclSourceText = ideclSourceSrc , ideclImplicit = ideclImplicit } -#else - ideclExt = GHCGHC.EpAnnNotUsed - ideclHiding = Nothing -#endif - reuseParsedModule :: IdeState -> NormalizedFilePath -> IO (FixityEnv, Annotated GHCGHC.ParsedSource) reuseParsedModule state f = do diff --git a/plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs b/plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs index 8955b76e3c..de468e2a87 100644 --- a/plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs +++ b/plugins/hls-splice-plugin/src/Ide/Plugin/Splice.hs @@ -38,14 +38,14 @@ import Data.Maybe (fromMaybe, listToMaybe, mapMaybe) import qualified Data.Text as T import Development.IDE -import Development.IDE.Core.FileStore (getVersionedTextDoc) +import Development.IDE.Core.FileStore (getVersionedTextDoc) import Development.IDE.Core.PluginUtils import Development.IDE.GHC.Compat as Compat import Development.IDE.GHC.Compat.ExactPrint import qualified Development.IDE.GHC.Compat.Util as Util import Development.IDE.GHC.ExactPrint import GHC.Exts -import qualified GHC.Runtime.Loader as Loader +import qualified GHC.Runtime.Loader as Loader import qualified GHC.Types.Error as Error import Ide.Plugin.Error (PluginError (PluginInternalError)) import Ide.Plugin.Splice.Types @@ -58,9 +58,7 @@ import Language.LSP.Protocol.Types import Data.Foldable (Foldable (foldl')) #endif -#if MIN_VERSION_ghc(9,4,1) import GHC.Data.Bag (Bag) -#endif #if MIN_VERSION_ghc(9,9,0) import GHC.Parser.Annotation (EpAnn (..)) @@ -294,11 +292,9 @@ data SpliceClass where OneToOneAST :: HasSplice AnnListItem ast => Proxy# ast -> SpliceClass IsHsDecl :: SpliceClass -#if MIN_VERSION_ghc(9,5,0) data HsSpliceCompat pass = UntypedSplice (HsUntypedSplice pass) | TypedSplice (LHsExpr pass) -#endif class (Outputable (ast GhcRn), ASTElement l (ast GhcPs)) => HasSplice l ast where @@ -307,43 +303,24 @@ class (Outputable (ast GhcRn), ASTElement l (ast GhcPs)) => HasSplice l ast wher expandSplice :: Proxy# ast -> SpliceOf ast GhcPs -> RnM (Either (ast GhcPs) (ast GhcRn), FreeVars) instance HasSplice AnnListItem HsExpr where -#if MIN_VERSION_ghc(9,5,0) type SpliceOf HsExpr = HsSpliceCompat matchSplice _ (HsUntypedSplice _ spl) = Just (UntypedSplice spl) matchSplice _ (HsTypedSplice _ spl) = Just (TypedSplice spl) -#else - type SpliceOf HsExpr = HsSplice - matchSplice _ (HsSpliceE _ spl) = Just spl -#endif - matchSplice _ _ = Nothing -#if MIN_VERSION_ghc(9,5,0) + matchSplice _ _ = Nothing expandSplice _ (UntypedSplice e) = fmap (first Right) $ rnUntypedSpliceExpr e expandSplice _ (TypedSplice e) = fmap (first Right) $ rnTypedSplice e -#else - expandSplice _ = fmap (first Right) . rnSpliceExpr -#endif instance HasSplice AnnListItem Pat where -#if MIN_VERSION_ghc(9,5,0) type SpliceOf Pat = HsUntypedSplice -#else - type SpliceOf Pat = HsSplice -#endif matchSplice _ (SplicePat _ spl) = Just spl matchSplice _ _ = Nothing expandSplice _ = -#if MIN_VERSION_ghc(9,5,0) fmap (first (Left . unLoc . utsplice_result . snd )) . -#endif rnSplicePat instance HasSplice AnnListItem HsType where -#if MIN_VERSION_ghc(9,5,0) type SpliceOf HsType = HsUntypedSplice -#else - type SpliceOf HsType = HsSplice -#endif matchSplice _ (HsSpliceTy _ spl) = Just spl matchSplice _ _ = Nothing expandSplice _ = fmap (first Right) . rnSpliceType @@ -418,14 +395,8 @@ manualCalcEdit clientCapabilities reportEditor ran ps hscEnv typechkd srcSpan _e pure resl where dflags = hsc_dflags hscEnv - -#if MIN_VERSION_ghc(9,4,1) showErrors = showBag -#else - showErrors = show -#endif -#if MIN_VERSION_ghc(9,4,1) showBag :: Error.Diagnostic a => Bag (Error.MsgEnvelope a) -> String showBag = show . fmap (fmap toDiagnosticMessage) @@ -433,15 +404,12 @@ toDiagnosticMessage :: forall a. Error.Diagnostic a => a -> Error.DiagnosticMess toDiagnosticMessage message = Error.DiagnosticMessage { diagMessage = Error.diagnosticMessage -#if MIN_VERSION_ghc(9,5,0) (Error.defaultDiagnosticOpts @a) -#endif message , diagReason = Error.diagnosticReason message , diagHints = Error.diagnosticHints message } -#endif -- | FIXME: Is thereAny "clever" way to do this exploiting TTG? unRenamedE :: @@ -458,11 +426,7 @@ unRenamedE dflags expr = do showSDoc dflags $ ppr expr pure expr' where -#if MIN_VERSION_ghc(9,4,1) showErrors = showBag . Error.getMessages -#else - showErrors = show -#endif data SearchResult r = Continue | Stop | Here r @@ -510,12 +474,8 @@ codeAction state plId (CodeActionParams _ _ docId ran _) = do (L (AsSrcSpan l@(RealSrcSpan spLoc _)) expr :: LHsExpr GhcPs) | spanIsRelevant l -> case expr of -#if MIN_VERSION_ghc(9,5,0) HsTypedSplice{} -> Here (spLoc, Expr) HsUntypedSplice{} -> Here (spLoc, Expr) -#else - HsSpliceE {} -> Here (spLoc, Expr) -#endif _ -> Continue _ -> Stop ) diff --git a/test/testdata/schema/ghc94/default-config.golden.json b/test/testdata/schema/ghc94/default-config.golden.json deleted file mode 100644 index 8467b451f1..0000000000 --- a/test/testdata/schema/ghc94/default-config.golden.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "cabalFormattingProvider": "cabal-gild", - "checkParents": "CheckOnSave", - "checkProject": true, - "formattingProvider": "ormolu", - "maxCompletions": 40, - "plugin": { - "alternateNumberFormat": { - "globalOn": true - }, - "cabal": { - "codeActionsOn": true, - "completionOn": true, - "diagnosticsOn": true, - "hoverOn": true, - "symbolsOn": true - }, - "cabal-fmt": { - "config": { - "path": "cabal-fmt" - } - }, - "cabal-gild": { - "config": { - "path": "cabal-gild" - } - }, - "cabalHaskellIntegration": { - "globalOn": true - }, - "callHierarchy": { - "globalOn": true - }, - "changeTypeSignature": { - "globalOn": true - }, - "class": { - "codeActionsOn": true, - "codeLensOn": true - }, - "eval": { - "codeActionsOn": true, - "codeLensOn": true, - "config": { - "diff": true, - "exception": false - } - }, - "explicit-fields": { - "codeActionsOn": true, - "inlayHintsOn": true - }, - "explicit-fixity": { - "globalOn": true - }, - "fourmolu": { - "config": { - "external": false, - "path": "fourmolu" - } - }, - "gadt": { - "globalOn": true - }, - "ghcide-code-actions-bindings": { - "globalOn": true - }, - "ghcide-code-actions-fill-holes": { - "globalOn": true - }, - "ghcide-code-actions-imports-exports": { - "globalOn": true - }, - "ghcide-code-actions-type-signatures": { - "globalOn": true - }, - "ghcide-completions": { - "config": { - "autoExtendOn": true, - "snippetsOn": true - }, - "globalOn": true - }, - "ghcide-hover-and-symbols": { - "hoverOn": true, - "symbolsOn": true - }, - "ghcide-type-lenses": { - "config": { - "mode": "always" - }, - "globalOn": true - }, - "hlint": { - "codeActionsOn": true, - "config": { - "flags": [] - }, - "diagnosticsOn": true - }, - "importLens": { - "codeActionsOn": true, - "codeLensOn": true, - "inlayHintsOn": true - }, - "moduleName": { - "globalOn": true - }, - "ormolu": { - "config": { - "external": false - } - }, - "overloaded-record-dot": { - "globalOn": true - }, - "pragmas-completion": { - "globalOn": true - }, - "pragmas-disable": { - "globalOn": true - }, - "pragmas-suggest": { - "globalOn": true - }, - "qualifyImportedNames": { - "globalOn": true - }, - "rename": { - "config": { - "crossModule": false - }, - "globalOn": true - }, - "retrie": { - "globalOn": true - }, - "semanticTokens": { - "config": { - "classMethodToken": "method", - "classToken": "class", - "dataConstructorToken": "enumMember", - "functionToken": "function", - "moduleToken": "namespace", - "operatorToken": "operator", - "patternSynonymToken": "macro", - "recordFieldToken": "property", - "typeConstructorToken": "enum", - "typeFamilyToken": "interface", - "typeSynonymToken": "type", - "typeVariableToken": "typeParameter", - "variableToken": "variable" - }, - "globalOn": false - }, - "splice": { - "globalOn": true - }, - "stan": { - "globalOn": false - } - }, - "sessionLoading": "singleComponent" -} diff --git a/test/testdata/schema/ghc94/vscode-extension-schema.golden.json b/test/testdata/schema/ghc94/vscode-extension-schema.golden.json deleted file mode 100644 index 1c0b19eb27..0000000000 --- a/test/testdata/schema/ghc94/vscode-extension-schema.golden.json +++ /dev/null @@ -1,1058 +0,0 @@ -{ - "haskell.plugin.alternateNumberFormat.globalOn": { - "default": true, - "description": "Enables alternateNumberFormat plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabal-fmt.config.path": { - "default": "cabal-fmt", - "markdownDescription": "Set path to 'cabal-fmt' executable", - "scope": "resource", - "type": "string" - }, - "haskell.plugin.cabal-gild.config.path": { - "default": "cabal-gild", - "markdownDescription": "Set path to 'cabal-gild' executable", - "scope": "resource", - "type": "string" - }, - "haskell.plugin.cabal.codeActionsOn": { - "default": true, - "description": "Enables cabal code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabal.completionOn": { - "default": true, - "description": "Enables cabal completions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabal.diagnosticsOn": { - "default": true, - "description": "Enables cabal diagnostics", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabal.hoverOn": { - "default": true, - "description": "Enables cabal hover", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabal.symbolsOn": { - "default": true, - "description": "Enables cabal symbols", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.cabalHaskellIntegration.globalOn": { - "default": true, - "description": "Enables cabalHaskellIntegration plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.callHierarchy.globalOn": { - "default": true, - "description": "Enables callHierarchy plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.changeTypeSignature.globalOn": { - "default": true, - "description": "Enables changeTypeSignature plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.class.codeActionsOn": { - "default": true, - "description": "Enables class code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.class.codeLensOn": { - "default": true, - "description": "Enables class code lenses", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.eval.codeActionsOn": { - "default": true, - "description": "Enables eval code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.eval.codeLensOn": { - "default": true, - "description": "Enables eval code lenses", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.eval.config.diff": { - "default": true, - "markdownDescription": "Enable the diff output (WAS/NOW) of eval lenses", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.eval.config.exception": { - "default": false, - "markdownDescription": "Enable marking exceptions with `*** Exception:` similarly to doctest and GHCi.", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.explicit-fields.codeActionsOn": { - "default": true, - "description": "Enables explicit-fields code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.explicit-fields.inlayHintsOn": { - "default": true, - "description": "Enables explicit-fields inlay hints", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.explicit-fixity.globalOn": { - "default": true, - "description": "Enables explicit-fixity plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.fourmolu.config.external": { - "default": false, - "markdownDescription": "Call out to an external \"fourmolu\" executable, rather than using the bundled library.", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.fourmolu.config.path": { - "default": "fourmolu", - "markdownDescription": "Set path to executable (for \"external\" mode).", - "scope": "resource", - "type": "string" - }, - "haskell.plugin.gadt.globalOn": { - "default": true, - "description": "Enables gadt plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-code-actions-bindings.globalOn": { - "default": true, - "description": "Enables ghcide-code-actions-bindings plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-code-actions-fill-holes.globalOn": { - "default": true, - "description": "Enables ghcide-code-actions-fill-holes plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-code-actions-imports-exports.globalOn": { - "default": true, - "description": "Enables ghcide-code-actions-imports-exports plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-code-actions-type-signatures.globalOn": { - "default": true, - "description": "Enables ghcide-code-actions-type-signatures plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-completions.config.autoExtendOn": { - "default": true, - "markdownDescription": "Extends the import list automatically when completing a out-of-scope identifier", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-completions.config.snippetsOn": { - "default": true, - "markdownDescription": "Inserts snippets when using code completions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-completions.globalOn": { - "default": true, - "description": "Enables ghcide-completions plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-hover-and-symbols.hoverOn": { - "default": true, - "description": "Enables ghcide-hover-and-symbols hover", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-hover-and-symbols.symbolsOn": { - "default": true, - "description": "Enables ghcide-hover-and-symbols symbols", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ghcide-type-lenses.config.mode": { - "default": "always", - "description": "Control how type lenses are shown", - "enum": [ - "always", - "exported", - "diagnostics" - ], - "enumDescriptions": [ - "Always displays type lenses of global bindings", - "Only display type lenses of exported global bindings", - "Follows error messages produced by GHC about missing signatures" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.ghcide-type-lenses.globalOn": { - "default": true, - "description": "Enables ghcide-type-lenses plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.hlint.codeActionsOn": { - "default": true, - "description": "Enables hlint code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.hlint.config.flags": { - "default": [], - "markdownDescription": "Flags used by hlint", - "scope": "resource", - "type": "array" - }, - "haskell.plugin.hlint.diagnosticsOn": { - "default": true, - "description": "Enables hlint diagnostics", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.importLens.codeActionsOn": { - "default": true, - "description": "Enables importLens code actions", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.importLens.codeLensOn": { - "default": true, - "description": "Enables importLens code lenses", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.importLens.inlayHintsOn": { - "default": true, - "description": "Enables importLens inlay hints", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.moduleName.globalOn": { - "default": true, - "description": "Enables moduleName plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.ormolu.config.external": { - "default": false, - "markdownDescription": "Call out to an external \"ormolu\" executable, rather than using the bundled library", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.overloaded-record-dot.globalOn": { - "default": true, - "description": "Enables overloaded-record-dot plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.pragmas-completion.globalOn": { - "default": true, - "description": "Enables pragmas-completion plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.pragmas-disable.globalOn": { - "default": true, - "description": "Enables pragmas-disable plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.pragmas-suggest.globalOn": { - "default": true, - "description": "Enables pragmas-suggest plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.qualifyImportedNames.globalOn": { - "default": true, - "description": "Enables qualifyImportedNames plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.rename.config.crossModule": { - "default": false, - "markdownDescription": "Enable experimental cross-module renaming", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.rename.globalOn": { - "default": true, - "description": "Enables rename plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.retrie.globalOn": { - "default": true, - "description": "Enables retrie plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.semanticTokens.config.classMethodToken": { - "default": "method", - "description": "LSP semantic token type to use for typeclass methods", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.classToken": { - "default": "class", - "description": "LSP semantic token type to use for typeclasses", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.dataConstructorToken": { - "default": "enumMember", - "description": "LSP semantic token type to use for data constructors", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.functionToken": { - "default": "function", - "description": "LSP semantic token type to use for functions", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.moduleToken": { - "default": "namespace", - "description": "LSP semantic token type to use for modules", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.operatorToken": { - "default": "operator", - "description": "LSP semantic token type to use for operators", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.patternSynonymToken": { - "default": "macro", - "description": "LSP semantic token type to use for pattern synonyms", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.recordFieldToken": { - "default": "property", - "description": "LSP semantic token type to use for record fields", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.typeConstructorToken": { - "default": "enum", - "description": "LSP semantic token type to use for type constructors", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.typeFamilyToken": { - "default": "interface", - "description": "LSP semantic token type to use for type families", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.typeSynonymToken": { - "default": "type", - "description": "LSP semantic token type to use for type synonyms", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.typeVariableToken": { - "default": "typeParameter", - "description": "LSP semantic token type to use for type variables", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.config.variableToken": { - "default": "variable", - "description": "LSP semantic token type to use for variables", - "enum": [ - "namespace", - "type", - "class", - "enum", - "interface", - "struct", - "typeParameter", - "parameter", - "variable", - "property", - "enumMember", - "event", - "function", - "method", - "macro", - "keyword", - "modifier", - "comment", - "string", - "number", - "regexp", - "operator", - "decorator" - ], - "enumDescriptions": [ - "LSP Semantic Token Type: namespace", - "LSP Semantic Token Type: type", - "LSP Semantic Token Type: class", - "LSP Semantic Token Type: enum", - "LSP Semantic Token Type: interface", - "LSP Semantic Token Type: struct", - "LSP Semantic Token Type: typeParameter", - "LSP Semantic Token Type: parameter", - "LSP Semantic Token Type: variable", - "LSP Semantic Token Type: property", - "LSP Semantic Token Type: enumMember", - "LSP Semantic Token Type: event", - "LSP Semantic Token Type: function", - "LSP Semantic Token Type: method", - "LSP Semantic Token Type: macro", - "LSP Semantic Token Type: keyword", - "LSP Semantic Token Type: modifier", - "LSP Semantic Token Type: comment", - "LSP Semantic Token Type: string", - "LSP Semantic Token Type: number", - "LSP Semantic Token Type: regexp", - "LSP Semantic Token Type: operator", - "LSP Semantic Token Type: decorator" - ], - "scope": "resource", - "type": "string" - }, - "haskell.plugin.semanticTokens.globalOn": { - "default": false, - "description": "Enables semanticTokens plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.splice.globalOn": { - "default": true, - "description": "Enables splice plugin", - "scope": "resource", - "type": "boolean" - }, - "haskell.plugin.stan.globalOn": { - "default": false, - "description": "Enables stan plugin", - "scope": "resource", - "type": "boolean" - } -}