GHC 8.10's API can load interfaces with the wrong package identifier when looking for plugins
Originally a doctest bug report: https://github.com/sol/doctest/issues/264
I inlined the relevant code from doctest into the provided reproducer, producing this reduced reproducer. Run with
On my machine, I get an error that looks like this:
test-doctest: Bad interface file: [..]/dist-newstyle/build/x86_64-linux/ghc-8.10.1/dummy-plugin-0.1.0.0/build/DummyDefs.hi Something is amiss; requested module dummy-plugin-0.1.0.0:DummyDefs differs from name found in the interface file ghc-compact-0.1.0.0:DummyDefs (if these names look the same, try again with -dppr-debug)
Where does that
ghc-compact come from? I have no idea. Even more puzzlingly, if I turn up GHC's verbosity, that turns into
test-doctest.hs is the (now misleadingly-named) code driving GHC, and as far as I can tell it's not doing anything exotic or bizarre.
Haddock.Interface is the roughly corresponding code in Haddock, which seems to mostly do the same thing - and yet Haddock works and doctest doesn't. I have no idea what the difference is, except that it might be something to do with order-sensitivity in how modules are loaded.
The error doesn't happen on GHC 8.8. I couldn't find anything in the release notes warning me about any changes here, so this is a regression.