Environment in Typechecker plugins does not match the passed in one
When using typeCheckResultAction
to write a type checker plugin the explicitly passed TcGblEnv and the TcGblEnv from the environment do not match up. The definition of typeCheckResultAction
currently is
, typeCheckResultAction :: [CommandLineOption] -> ModSummary -> TcGblEnv
-> TcM TcGblEnv
-- ^ Modify the module when it is type checked. This is called at the
-- very end of typechecking.
In a plugin implementation one would expect
typeCheckResultAction = \_ _ tcg_gbl_env -> do
env <- getGblEnv
assert (env == tcg_gbl_env)
to hold but currently the TcGblEnv from the environment doesn't contain
- the module doc header
- the renamed exports (and export list)
(A workaround is to use setGblEnv tcg_gbl_env
here but it sure is unexpected)
See !4766 (closed) for a fix.
Edited by alexbiehl-gc