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,
IfaceTopBndrs (and should therefore be renamed), renaming them (in
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
ifaceConDeclFields) and then looks each of these
OccNames up in the name cache, thereby retrieving the un-renamed
Name. This seems wrong.