Refactor loadInterface/ModIface to remove the bottom fields
Recently I came across this code in loadInterface
; let { final_iface = iface {
mi_decls = panic "No mi_decls in PIT",
mi_insts = panic "No mi_insts in PIT",
mi_fam_insts = panic "No mi_fam_insts in PIT",
mi_rules = panic "No mi_rules in PIT",
mi_anns = panic "No mi_anns in PIT"
}
}
It's really unfortunate that this pattern is so widely used in GHC as it causes so much trouble working on the relevant code. This recently cause trouble while working on !2100 (closed).
Some ways to fix this:
- Create a new ModIface-like type without the fields
- Add more type parameters to ModIface for these fields, make them
()
when they're not available