diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-10 12:28:21 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-10 12:37:00 +0000 |
commit | bad6ce3257e3bc61e42f328b7ee1d55b6694b0e5 (patch) | |
tree | 6bdd8921b5cb08035ab97a15843bd01654377f65 | |
parent | 2a6f2681ad53899869473343e845bee189a809c3 (diff) | |
download | haskell-bad6ce3257e3bc61e42f328b7ee1d55b6694b0e5.tar.gz |
Refine tcSemigroupWarnings to work in ghc-primwip/fix-ghc-prim-hadrian
ghc-prim doesn't depend on base so can't have any Monoid or Semigroup
instances. However, attempting to load these definitions ran into issues
when the interface for `GHC.Base` did exist as that would try and load
the interface for `GHC.Types` (which is the module we are trying to
compile and has no interface).
The fix is to just not do this check when we are compiling a module in
ghc-prim.
Fixes #21069
-rw-r--r-- | compiler/GHC/Tc/Module.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Module.hs b/compiler/GHC/Tc/Module.hs index 34a02e70ec..026686b8cc 100644 --- a/compiler/GHC/Tc/Module.hs +++ b/compiler/GHC/Tc/Module.hs @@ -1560,10 +1560,13 @@ tcTopSrcDecls _ = panic "tcTopSrcDecls: ValBindsIn" tcSemigroupWarnings :: TcM () tcSemigroupWarnings = do - traceTc "tcSemigroupWarnings" empty - let warnFlag = Opt_WarnSemigroup - tcPreludeClashWarn warnFlag sappendName - tcMissingParentClassWarn warnFlag monoidClassName semigroupClassName + mod <- getModule + -- ghc-prim doesn't depend on base + unless (moduleUnit mod == primUnit) $ do + traceTc "tcSemigroupWarnings" empty + let warnFlag = Opt_WarnSemigroup + tcPreludeClashWarn warnFlag sappendName + tcMissingParentClassWarn warnFlag monoidClassName semigroupClassName -- | Warn on local definitions of names that would clash with future Prelude |