Fix deprecation of record fields
Commit 3f374399 inadvertently broke the deprecation/warning mechanism for record fields due to its introduction of record field namespaces.
This patch ensures that, when a top-level deprecation is applied to
an identifier, it applies to all the record fields as well.
This is achieved by refactoring GHC.Rename.Env.lookupLocalTcNames
, and
GHC.Rename.Env.lookupBindGroupOcc
, to not look up a fixed number of
NameSpace
s but to look up all NameSpace
s and filter out the irrelevant
ones.
In particular, instead of GHC.Rename.Env.dataTcOccs
returning a set of
RdrName
s with their NameSpace
s fixed up, it returns a function that
allows us to filter out OccName
s with irrelevant NameSpace
s. The function
is now called rdrRelevantNameSpace
.
TODO:
-
Audit the call of lookupBindGroupOcc
inlookupSigCtxtOccRn
by looking at the uses oflookupSigCtxtOccRn
. -
Document the critical change in rnSrcWarnDecls
where we must be sure to use theNameSpace
of theName
we looked up rather than theNameSpace
of theRdrName
.
I am leaving the removal of dataTcOccs
and refactoring of thRdrNameGuesses
to a future MR,
as it doesn't fix a live bug in the compiler and requires a bit more thought about the handling
of wired-in names which live in multiple namespaces (vicinity of setWiredInNameSpace
etc).