[Git][ghc/ghc][wip/spj-reinstallable-base2.rebased] Fix flag names in documentation
Wolfgang Jeltsch pushed to branch wip/spj-reinstallable-base2.rebased at Glasgow Haskell Compiler / GHC Commits: 26d77eb6 by Wolfgang Jeltsch at 2026-04-23T22:54:50+03:00 Fix flag names in documentation - - - - - 3 changed files: - compiler/GHC/Builtin.hs - compiler/GHC/Iface/Load.hs - libraries/base/src/System/IO.hs Changes: ===================================== compiler/GHC/Builtin.hs ===================================== @@ -235,8 +235,8 @@ How known-occ entities work * There are three flags that control the treatment of known entities: -frebindable-known-names - -fdefines-known-names - -fexclude-known-define=wombat See wrinkle (KN2) + -fdefines-known-key-names + -fexclude-known-key-define=wombat See wrinkle (KN2) Details in the following bullets. * You initiate a known-occ lookup by calling @@ -342,7 +342,7 @@ Wrinkles So we simply suppress an unused-import-decl warning if it has a "as Rebindable" qualifier. See (UI1) in Note [Unused imports] in GHC.Rename.Names -(KN2) The flag `-fdefines-known-names` is module-wide. But what if that module +(KN2) The flag `-fdefines-known-key-names` is module-wide. But what if that module happens to define an entity that /isn't/ a known-key entity, but /does/ share the same OccName. For example: module GHC.Internal.Data.Foldable where @@ -350,11 +350,11 @@ Wrinkles module GHC.Internal.IsList where class IsList l where { ...; toList :: l -> [Item l] } Foldable is a known-key entity, so GHC.Internal.Data.Foldable must be compiled - with `-fdefines-known-names`. But its `toList` method is /not/ known-key. + with `-fdefines-known-key-names`. But its `toList` method is /not/ known-key. Rather, the `toList` from GHC.Internal.IsList is teh known-key entity. So we compile GHC.Internal.Data.Foldable with - -fexclude-known-define=toList + -fexclude-known-key-define=toList (KN3) We don't need to export wired-in entities from GHC.Essentials because we (should) never look up a wired-in name via its key. That is, @@ -388,10 +388,10 @@ Note [Recipe for adding a known-key name] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To make `wombat` into a known-key name, do the following. -* Ensure that the module M that defines `wombat` is compiled with `-fdefines-known-names`. +* Ensure that the module M that defines `wombat` is compiled with `-fdefines-known-key-names`. * If M.hs has an `M.hs-boot` file, ensure that it too is compiled - with `-fdefines-known-names`. + with `-fdefines-known-key-names`. * Ensure that the module `GHC.Essentials` exports `wombat`. ===================================== compiler/GHC/Iface/Load.hs ===================================== @@ -163,7 +163,7 @@ data KnownNameSource | KNS_FromModule -- Look up the known-occ name in the export list of GHC.Essentials - -- This is the "normal path", and happens when -frebindable-key-name + -- This is the "normal path", and happens when -frebindable-known-names -- is /not/ set instance Outputable KnownNameSource where ===================================== libraries/base/src/System/IO.hs ===================================== @@ -187,6 +187,26 @@ module System.IO import GHC.Internal.System.IO (putStrLn, print) +import GHC.Essentials as Rebindable + ( + Module (Module), + TrName (TrNameS), + TypeLitSort (TypeLitSymbol, TypeLitChar, TypeLitNat), + TyCon (TyCon), + KindRep + ( + KindRepVar, + KindRepTYPE, + KindRepTypeLitS, + KindRepFun, + KindRepTyConApp, + KindRepApp + ), + fail, + Num, + fromInteger + ) + import GHC.Base (Bool (False, True), otherwise, failIO) import GHC.Err (errorWithoutStackTrace) import GHC.List ((++), reverse, break) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/26d77eb6d0bcaff9fced897f06adabaf... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/26d77eb6d0bcaff9fced897f06adabaf... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Wolfgang Jeltsch (@jeltsch)