Skip to content

Commit

Permalink
Fix cross package goto definition (digital-asset#1834)
Browse files Browse the repository at this point in the history
The reason for why it was broken was rather simple: We just lost the
non-compat logic somewhere along the way.

fixes digital-asset#1582
  • Loading branch information
cocreature authored and mergify[bot] committed Jun 24, 2019
1 parent 0b396be commit d828956
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion compiler/hie-core/src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ getHieFileRule =
defineNoFile $ \(GetHieFile f) -> do
u <- liftIO $ mkSplitUniqSupply 'a'
let nameCache = initNameCache u []
liftIO $ fmap fst $ readHieFile nameCache f
liftIO $ fmap (hie_file_result . fst) $ readHieFile nameCache f

-- | A rule that wires per-file rules together
mainRule :: Rules ()
Expand Down
12 changes: 10 additions & 2 deletions compiler/hie-core/src/Development/IDE/GHC/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@

-- | Attempt at hiding the GHC version differences we can.
module Development.IDE.GHC.Compat(
HieFileResult(..),
HieFile(..),
mkHieFile,
writeHieFile,
readHieFile
) where

#ifndef GHC_STABLE
import HieAst
import HieBin
import HieTypes
#else
import GHC
import GhcPlugins
import NameCache
Expand All @@ -24,7 +30,9 @@ mkHieFile _ _ _ = return (HieFile () [])
writeHieFile :: FilePath -> HieFile -> IO ()
writeHieFile _ _ = return ()

readHieFile :: NameCache -> FilePath -> IO (HieFile, ())
readHieFile _ _ = return (HieFile () [], ())
readHieFile :: NameCache -> FilePath -> IO (HieFileResult, ())
readHieFile _ _ = return (HieFileResult (HieFile () []), ())

data HieFile = HieFile {hie_module :: (), hie_exports :: [AvailInfo]}
data HieFileResult = HieFileResult { hie_file_result :: HieFile }
#endif
4 changes: 0 additions & 4 deletions daml-foundations/daml-ghc/test-src/DA/Test/ShakeIdeClient.hs
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,6 @@ goToDefinitionTests mbScenarioService = Tasty.testGroup "Go to definition tests"
expectGoToDefinition (foo,1,[17..17]) (At (foo,4,0))
-- B
expectGoToDefinition (foo,1,[19..19]) (At (foo,4,9))
{-
-- Disabled for now. See issue
-- https://github.com/digital-asset/daml/issues/1582
, testCase' "Cross-package goto definition" $ do
foo <- makeModule "Foo"
[ "test = scenario do"
Expand All @@ -451,7 +448,6 @@ goToDefinitionTests mbScenarioService = Tasty.testGroup "Go to definition tests"
setFilesOfInterest [foo]
expectNoErrors
expectGoToDefinition (foo, 3, [7..14]) (In "DA.Internal.LF")
-}
]
where
testCase' = testCase mbScenarioService
Expand Down

0 comments on commit d828956

Please sign in to comment.