Skip to content

mkPluginUsage: file not found

I have the following TestPlugin.hs file:

module TestPlugin (plugin) where

import GhcPlugins

plugin :: Plugin
plugin = defaultPlugin {installCoreToDos = install}
  where install _ todos = return (test : todos)

        test = CoreDoPluginPass "Test" return

And the following Test.hs file:

{-# OPTIONS_GHC -fplugin TestPlugin #-}

main :: IO ()
main = return ()

They are both in the same directory. With ghc 8.4.2, I have:

$ ghci-8.4.2 -package ghc Test.hs
GHCi, version 8.4.2: http://www.haskell.org/ghc/  :? for help
[1 of 2] Compiling TestPlugin       ( TestPlugin.hs, interpreted )
[2 of 2] Compiling Main             ( Test.hs, interpreted )
Ok, two modules loaded.

But with ghc 8.6.3, I get:

$ ghci-8.6.3 -package ghc Test.hs
GHCi, version 8.6.3: http://www.haskell.org/ghc/  :? for help
[1 of 2] Compiling TestPlugin       ( TestPlugin.hs, interpreted )
[2 of 2] Compiling Main             ( Test.hs, interpreted )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.6.3 for x86_64-apple-darwin):
	mkPluginUsage: file not found
  TestPlugin ./TestPlugin.o
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
        pprPanic, called at compiler/deSugar/DsUsage.hs:234:15 in ghc:DsUsage

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

The problem goes away if I first compile TestPlugin.hs and create a .o file; but nonetheless this seems to be a regression from 8.4.2.

Edited by Levent Erkök
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information