Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,407
    • Issues 5,407
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 600
    • Merge requests 600
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #19191
Closed
Open
Issue created Jan 08, 2021 by alexbiehl-gc@alexbiehl-gc

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

  1. the module doc header
  2. 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 Jan 08, 2021 by alexbiehl-gc
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking