Refactor IfGblEnv/IfLclEnv to make more sense.
AbandonedPublic

Authored by ezyang on May 13 2016, 2:02 AM.

Details

Reviewers
simonpj
austin
bgamari
Trac Issues
#12035
Summary

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 <ezyang@cs.stanford.edu>

Test Plan

validate

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 9592
Build 11637: arc lint + arc unit
ezyang updated this revision to Diff 7570.May 13 2016, 2:02 AM
ezyang retitled this revision from to Refactor IfGblEnv/IfLclEnv to make more sense..
ezyang updated this object.
ezyang edited the test plan for this revision. (Show Details)
ezyang added a reviewer: simonpj.
ezyang updated the Trac tickets for this revision.
ezyang updated this revision to Diff 7572.May 13 2016, 2:29 AM
ezyang edited edge metadata.

remove redundant import

bgamari requested changes to this revision.Jun 8 2016, 6:28 AM
bgamari edited edge metadata.

What ticket does this apply to? Supposedly Trac #12305 does not exist.

This revision now requires changes to proceed.Jun 8 2016, 6:28 AM
bgamari added inline comments.Jun 8 2016, 6:32 AM
compiler/iface/TcIface.hs
1351

Thanks for the comments; they definitely help clear up some questions. That being said I don't see a great explanation of why the typechecking-interface and not-typechecking-interface case should differ. Perhaps stating this more clearly in Note [Tying the knot] and referencing that note from here and tcIfGlobal would help?

bgamari edited edge metadata.Jun 9 2016, 4:34 AM
bgamari updated the Trac tickets for this revision.
bgamari updated this object.
bgamari updated this object.
bgamari updated this object.
ezyang abandoned this revision.Jun 19 2016, 6:29 PM

SPJ doesn't like this, so we're going to take a different approach.