diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-10 12:28:21 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-10 19:21:59 -0500 |
commit | 19deb002daa74de15cebaae3d861e6f2f932f7fd (patch) | |
tree | 0feb4ec86c5679f2b9770967dfb46f786befcfe4 | |
parent | 2f99255bc390db543ae57dec36a037cae9cd2996 (diff) | |
download | haskell-19deb002daa74de15cebaae3d861e6f2f932f7fd.tar.gz |
Refine tcSemigroupWarnings to work in ghc-prim
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 |