Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 5.5k
    • Issues 5.5k
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 624
    • Merge requests 624
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • 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
  • #19940
Closed
Open
Issue created Jun 04, 2021 by sheaf@sheafMaintainer

tcLookup in plugins seems broken on HEAD

The operation of looking up names in a typechecker plugin seems to have been broken sometime recently. For instance:

-- MyModule
type family MyFam a b where

-- MyPlugin
tcPluginInit :: TcPluginM ()
tcPluginInit = do
  myModule     <- findModule myPackage myModuleName
  lookupResult <- tcLookupGlobal =<< lookupOrig myModule ( mkTcOcc "MyFam" )
  pprPanic "Result was:" ( ppr lookupResult )

findModule :: String -> String -> TcPluginM Module
findModule pkg modName = do
  findResult <- findImportedModule ( mkModuleName modName ) ( Just $ fsLit pkg )
  case findResult of
    Found _ res     -> pure res
    FoundMultiple _ -> error $ "MyPlugin: found multiple modules named " <> modName <> "."
    _               -> error $ "MyPlugin: could not find any module named " <> modName <> "."

On GHC 9.2.1 (alpha1), I get the expected result:

  GHC version 9.2.0.20210331:
        Result was:
  Type constructor `MyFam'

On GHC HEAD, when running in ghci I get:

 GHC version 9.3.20210604:
        Result was:
  Identifier `disableBuffering'

and when compiling normally, I get:

  GHC version 9.3.20210604:
        Result was:
  Identifier `plugin'

I have only checked 7a05185a and 79d12d34 and they both present the same issue. Note that this is on Windows 10 x64 (10.0.19041).
See here for full reproducer: tclookup.zip

Edited Jun 04, 2021 by sheaf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking