Suspicious treatment of renaming of field labels
While working on my rework of interface file names (Phab:D2467) I noticed that there is some funniness in the treatment of renaming field selectors. Namely, ifaceConDeclFields
are IfaceTopBndr
s (and should therefore be renamed), renaming them (in RnModIface
) causes bkpreex06
to fail with the panic find_lbl missing foo
.
Looking at the environment reveals that there are selectors named foo
in scope, but they were not renamed.
I believe this is due to the implementation of tcIfaceDataCons
, which typechecks the fields with mapM (traverse lookupIfaceTop) (ifaceConDeclFields if_cons)
. In essence, this projects the field labels back to OccName
s (in ifaceConDeclFields
) and then looks each of these OccName
s up in the name cache, thereby retrieving the un-renamed Name
. This seems wrong.