This in preparation for a fix for Trac #12035 but I ended up
cleaning up a bit of this code.
- Now we have:
- if_rec_types (in IfGblEnv)
- if_self_types (in IfLclEnv)
This is to keep typecheckIface's knot-tying (which can't go through EPS) separate from hs-boot knot-tying. This will prevent typecheckIface from clobbering any global hs-boot knot-tying we should keep around, which turns out to be important in the fix for Trac #12035.
- I dropped IfLclEnv from DsGblEnv, since it didn't really make sense (IfLclEnv is set while we are typechecking an interface; we're definitely not typechecking an interface in this case!) To compensate I had to reimplement dsLookupGlobal, which in turn meant I had to factor out ifLookupGlobal from tcIfaceGlobal. The resulting code is longer but clearer, I think.
- I axed initIfaceLcl; we just use initIfaceTc uniformly in all cases.
- initIfaceTc now lives in the IfM monad rather than TcRnIf. This is Right(TM), because we want to preserve the IfGblEnv rather than initialize one from scratch.
Signed-off-by: Edward Z. Yang <firstname.lastname@example.org>