mirror of
https://github.com/haskell/ghcide.git
synced 2024-11-26 12:25:25 +03:00
* [#518] Build ghcide with GHC 8.10.1 Resolves #518 * Move CPP logic to the Compat module * Revert changes to mkHieFile * Add local fork of HieAst for 8.10.1 The fix for mkHieFile didn't make it into 8.10.1, so the override is still needed * Ignore hlint in src-ghc810/HieAst.hs * Whitelist CPP for Development.IDE.GHC.Orphans * [#518] Build ghcide with GHC 8.10.1 Resolves #518 * Move CPP logic to the Compat module * Revert changes to mkHieFile * Add local fork of HieAst for 8.10.1 The fix for mkHieFile didn't make it into 8.10.1, so the override is still needed * Ignore hlint in src-ghc810/HieAst.hs * Whitelist CPP for Development.IDE.GHC.Orphans * Plugin tests known broken in 8.10.1 (#556) * Bump up ghc-check version Co-authored-by: Pepe Iborra <pepeiborra@gmail.com> Co-authored-by: pepe iborra <pepeiborra@gmail.com>
This commit is contained in:
parent
d7c2bb6ff3
commit
07cf929ac6
@ -5,6 +5,8 @@ jobs:
|
||||
vmImage: 'ubuntu-latest'
|
||||
strategy:
|
||||
matrix:
|
||||
stack_810:
|
||||
STACK_YAML: "stack810.yaml"
|
||||
stack_88:
|
||||
STACK_YAML: "stack88.yaml"
|
||||
stack_86:
|
||||
|
@ -5,6 +5,8 @@ jobs:
|
||||
vmImage: 'windows-2019'
|
||||
strategy:
|
||||
matrix:
|
||||
stack_810:
|
||||
STACK_YAML: "stack810.yaml"
|
||||
stack_88:
|
||||
STACK_YAML: "stack88.yaml"
|
||||
stack_86:
|
||||
|
@ -81,6 +81,7 @@
|
||||
- Development.IDE.Core.Compile
|
||||
- Development.IDE.Core.Rules
|
||||
- Development.IDE.GHC.Compat
|
||||
- Development.IDE.GHC.Orphans
|
||||
- Development.IDE.GHC.Util
|
||||
- Development.IDE.Import.FindImports
|
||||
- Development.IDE.LSP.Outline
|
||||
|
@ -149,7 +149,12 @@ library
|
||||
Development.IDE.Plugin.CodeAction.RuleTypes
|
||||
Development.IDE.Plugin.Completions.Logic
|
||||
Development.IDE.Plugin.Completions.Types
|
||||
if impl(ghc > 8.7) || flag(ghc-lib)
|
||||
if (impl(ghc > 8.7) && impl(ghc < 8.10)) || flag(ghc-lib)
|
||||
hs-source-dirs: src-ghc88
|
||||
other-modules:
|
||||
Development.IDE.GHC.HieAst
|
||||
if (impl(ghc > 8.9))
|
||||
hs-source-dirs: src-ghc810
|
||||
other-modules:
|
||||
Development.IDE.GHC.HieAst
|
||||
ghc-options: -Wall -Wno-name-shadowing
|
||||
|
1928
src-ghc810/Development/IDE/GHC/HieAst.hs
Normal file
1928
src-ghc810/Development/IDE/GHC/HieAst.hs
Normal file
File diff suppressed because it is too large
Load Diff
@ -536,7 +536,7 @@ getHiFileRule = defineEarlyCutoff $ \GetHiFile f -> do
|
||||
case r of
|
||||
Right iface -> do
|
||||
let result = HiFileResult ms iface
|
||||
return (Just (fingerprintToBS (mi_mod_hash iface)), ([], Just result))
|
||||
return (Just (fingerprintToBS (getModuleHash iface)), ([], Just result))
|
||||
Left err -> do
|
||||
let diag = ideErrorWithSource (Just "interface file loading") (Just DsError) f . T.pack $ err
|
||||
return (Nothing, (pure diag, Nothing))
|
||||
|
@ -25,6 +25,7 @@ module Development.IDE.GHC.Compat(
|
||||
includePathsGlobal,
|
||||
includePathsQuote,
|
||||
addIncludePathsQuote,
|
||||
getModuleHash,
|
||||
pattern DerivD,
|
||||
pattern ForD,
|
||||
pattern InstD,
|
||||
@ -43,6 +44,7 @@ module Development.IDE.GHC.Compat(
|
||||
import StringBuffer
|
||||
import DynFlags
|
||||
import FieldLabel
|
||||
import Fingerprint (Fingerprint)
|
||||
import qualified Module
|
||||
|
||||
import qualified GHC
|
||||
@ -52,9 +54,13 @@ import Avail
|
||||
import ErrUtils (ErrorMessages)
|
||||
import FastString (FastString)
|
||||
|
||||
#if MIN_GHC_API_VERSION(8,10,0)
|
||||
import HscTypes (mi_mod_hash)
|
||||
#endif
|
||||
|
||||
#if MIN_GHC_API_VERSION(8,8,0)
|
||||
import Control.Applicative ((<|>))
|
||||
import Development.IDE.GHC.HieAst
|
||||
import Development.IDE.GHC.HieAst (mkHieFile)
|
||||
import HieBin
|
||||
import HieTypes
|
||||
|
||||
@ -276,3 +282,10 @@ getHeaderImports a b c d =
|
||||
catch (Right <$> Hdr.getImports a b c d)
|
||||
(return . Left . srcErrorMessages)
|
||||
#endif
|
||||
|
||||
getModuleHash :: ModIface -> Fingerprint
|
||||
#if MIN_GHC_API_VERSION(8,10,0)
|
||||
getModuleHash = mi_mod_hash . mi_final_exts
|
||||
#else
|
||||
getModuleHash = mi_mod_hash
|
||||
#endif
|
||||
|
@ -1,8 +1,10 @@
|
||||
-- Copyright (c) 2019 The DAML Authors. All rights reserved.
|
||||
-- SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# OPTIONS_GHC -Wno-orphans #-}
|
||||
#include "ghc-api-version.h"
|
||||
|
||||
-- | Orphan instances for GHC.
|
||||
-- Note that the 'NFData' instances may not be law abiding.
|
||||
@ -52,8 +54,10 @@ instance Show ParsedModule where
|
||||
instance NFData ModSummary where
|
||||
rnf = rwhnf
|
||||
|
||||
#if !MIN_GHC_API_VERSION(8,10,0)
|
||||
instance NFData FastString where
|
||||
rnf = rwhnf
|
||||
#endif
|
||||
|
||||
instance NFData ParsedModule where
|
||||
rnf = rwhnf
|
||||
|
@ -123,7 +123,7 @@ locationsAtPoint
|
||||
-> Position
|
||||
-> [SpanInfo]
|
||||
-> m [Location]
|
||||
locationsAtPoint getHieFile IdeOptions{..} pos =
|
||||
locationsAtPoint getHieFile _ideOptions pos =
|
||||
fmap (map srcSpanToLocation) . mapMaybeM (getSpan . spaninfoSource) . spansAtPoint pos
|
||||
where getSpan :: SpanSource -> m (Maybe SrcSpan)
|
||||
getSpan NoSource = pure Nothing
|
||||
|
17
stack810.yaml
Normal file
17
stack810.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
resolver: nightly-2020-02-13
|
||||
compiler: ghc-8.10.1
|
||||
allow-newer: true
|
||||
packages:
|
||||
- .
|
||||
extra-deps:
|
||||
- haskell-lsp-0.21.0.0
|
||||
- haskell-lsp-types-0.21.0.0
|
||||
- lsp-test-0.10.2.0
|
||||
- ghc-check-0.3.0.1
|
||||
|
||||
# for ghc-8.10
|
||||
- Cabal-3.2.0.0
|
||||
- lens-4.19.1
|
||||
|
||||
nix:
|
||||
packages: [zlib]
|
@ -1449,7 +1449,8 @@ findDefinitionAndHoverTests = let
|
||||
no = const Nothing -- don't run this test at all
|
||||
|
||||
pluginTests :: TestTree
|
||||
pluginTests = testSessionWait "plugins" $ do
|
||||
pluginTests = (`xfail8101` "known broken (#556)")
|
||||
$ testSessionWait "plugins" $ do
|
||||
let content =
|
||||
T.unlines
|
||||
[ "{-# OPTIONS_GHC -fplugin GHC.TypeLits.KnownNat.Solver #-}"
|
||||
@ -1907,6 +1908,13 @@ pattern R x y x' y' = Range (Position x y) (Position x' y')
|
||||
xfail :: TestTree -> String -> TestTree
|
||||
xfail = flip expectFailBecause
|
||||
|
||||
xfail8101 :: TestTree -> String -> TestTree
|
||||
#if MIN_GHC_API_VERSION(8,10,0)
|
||||
xfail8101 = flip expectFailBecause
|
||||
#else
|
||||
xfail8101 t _ = t
|
||||
#endif
|
||||
|
||||
data Expect
|
||||
= ExpectRange Range -- Both gotoDef and hover should report this range
|
||||
| ExpectLocation Location
|
||||
|
Loading…
Reference in New Issue
Block a user