Skip to content

Fix ghc source plugins for GHC 9.2 #3311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions ghcide/src/Development/IDE/Core/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,18 @@ typecheckModule :: IdeDefer
typecheckModule (IdeDefer defer) hsc tc_helpers pm = do
let modSummary = pm_mod_summary pm
dflags = ms_hspp_opts modSummary
mmodSummary' <- catchSrcErrors (hsc_dflags hsc) "typecheck (initialize plugins)"
(mmodSummary') <- catchSrcErrors (hsc_dflags hsc) "typecheck (initialize plugins)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(mmodSummary') <- catchSrcErrors (hsc_dflags hsc) "typecheck (initialize plugins)"
mmodSummary' <- catchSrcErrors (hsc_dflags hsc) "typecheck (initialize plugins)"

(initPlugins hsc modSummary)
case mmodSummary' of
Left errs -> return (errs, Nothing)
Right modSummary' -> do
Right (modSummary', hsc') -> do
(warnings, etcm) <- withWarnings "typecheck" $ \tweak ->
let
session = tweak (hscSetFlags dflags hsc)
session = tweak hsc'
-- TODO: maybe settings ms_hspp_opts is unnecessary?
mod_summary'' = modSummary' { ms_hspp_opts = hsc_dflags session}
in
catchSrcErrors (hsc_dflags hsc) "typecheck" $ do
catchSrcErrors (hsc_dflags session) "typecheck" $ do
tcRnModule session tc_helpers $ demoteIfDefer pm{pm_mod_summary = mod_summary''}
let errorPipeline = unDefer . hideDiag dflags . tagDiag
diags = map errorPipeline warnings
Expand Down Expand Up @@ -478,7 +478,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
Nothing
#endif

#else
#else
let !partial_iface = force (mkPartialIface session details simplified_guts)
final_iface <- mkFullIface session partial_iface
#endif
Expand Down Expand Up @@ -569,10 +569,10 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
. (("Error during " ++ T.unpack source) ++) . show @SomeException
]

initPlugins :: HscEnv -> ModSummary -> IO ModSummary
initPlugins :: HscEnv -> ModSummary -> IO (ModSummary, HscEnv)
initPlugins session modSummary = do
session1 <- liftIO $ initializePlugins (hscSetFlags (ms_hspp_opts modSummary) session)
return modSummary{ms_hspp_opts = hsc_dflags session1}
return (modSummary{ms_hspp_opts = hsc_dflags session1}, session1 )

-- | Whether we should run the -O0 simplifier when generating core.
--
Expand Down
1 change: 0 additions & 1 deletion ghcide/test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,6 @@ checkFileCompiles fp diag =
pluginSimpleTests :: TestTree
pluginSimpleTests =
ignoreInWindowsForGHC810 $
ignoreForGHC92Plus "blocked on ghc-typelits-natnormalise" $
testSessionWithExtraFiles "plugin-knownnat" "simple plugin" $ \dir -> do
_ <- openDoc (dir </> "KnownNat.hs") "haskell"
liftIO $ writeFile (dir</>"hie.yaml")
Expand Down