Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Commit

Permalink
Fix getDefinition in GHC 8.4
Browse files Browse the repository at this point in the history
Did it break before 0.2.0 or after?
  • Loading branch information
pepeiborra committed Jun 21, 2020
1 parent 7bbcb4f commit ded1236
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/Development/IDE/Core/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ getModSummaryRule = defineEarlyCutoff $ \GetModSummary f -> do

getModIfaceRule :: Rules ()
getModIfaceRule = define $ \GetModIface f -> do
#if MIN_GHC_API_VERSION(8,6,0) && !defined(GHC_LIB)
fileOfInterest <- use_ IsFileOfInterest f
let useHiFile =
-- Never load interface files for files of interest
Expand Down Expand Up @@ -725,6 +726,13 @@ getModIfaceRule = define $ \GetModIface f -> do
extract (Just tmr) =
-- Bang patterns are important to force the inner fields
Just $! HiFileResult (tmrModSummary tmr) (hm_iface $ tmrModInfo tmr)
#else
tm <- use TypeCheck f
let modIface = hm_iface . tmrModInfo <$> tm
modSummary = tmrModSummary <$> tm
return $ ([], HiFileResult <$> modSummary <*> modIface)
#endif


isFileOfInterestRule :: Rules ()
isFileOfInterestRule = defineEarlyCutoff $ \IsFileOfInterest f -> do
Expand Down
3 changes: 2 additions & 1 deletion src/Development/IDE/GHC/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ import TcRnTypes
import System.IO
import Foreign.ForeignPtr
import MkIface
import System.IO.Error


hPutStringBuffer :: Handle -> StringBuffer -> IO ()
Expand Down Expand Up @@ -263,7 +264,7 @@ supportsHieFiles = False

writeHieFile _ _ = return ()

readHieFile _ _ = return undefined
readHieFile _ fp = ioError $ mkIOError doesNotExistErrorType "" Nothing (Just fp)

#endif

Expand Down

0 comments on commit ded1236

Please sign in to comment.