• Edward Z. Yang's avatar
    Axe initIfaceTc, tie the knot through HPT (or if_rec_types). · e907e1f1
    Edward Z. Yang authored
    initIfaceTc was originally used to make sure when we typecheck
    an interface, it can find the TyThings for things it itself
    defined.  However, in the case of retypecheckLoop, this wasn't
    necessary because we ALREADY tied the knot through the HPT.
    This commit removes initIfaceTc, instead relying on the HPT
    to tie the knot.  genModDetails' caller needed to be modified
    to tie the knot, but there are not that many call-sites of
    typecheckIface so the change is quite reasonable.
    We also introduce a new 'initIfaceLoad', which does
    NOT set up 'if_rec_types'.  It's used when we're
    typechecking old, up-to-date interfaces in, since we're
    never going to update the type environment.
    The full details are in Note [Knot-tying typecheckIface].
    Displeasingly, we need a special case to handle DFuns in
    the case of tcHiBootIface, see
    Note [DFun knot-tying special case] for the gory details.
    I also added another test which tickles a bug in a buggy
    version of this patch (see "Why the seq?")
    Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
    Test Plan: validate
    Reviewers: simonpj, austin, bgamari
    Subscribers: thomie
    Differential Revision: https://phabricator.haskell.org/D2349
Tc266.hs 50 Bytes