• Simon Peyton Jones's avatar
    Fix GHCi/GHC-API tidying and modules (Trac #9424, #9426) · 67a0cab6
    Simon Peyton Jones authored
    There were two related bugs here
    Trac #9426
       We must increment the ic_mod_index field of the InteractiveContext
       if we have new instances, because we maek DFunIds that should be
       distinct from previous ones.  Previously we were only incrementing
       when defining new user-visible Ids.
       The main change is in HscTypes.extendInteractiveContext, which now
       alwyas bumps the ic_mod_index.  I also added a specialised
       extendInteractiveContextWithIds for the case where we are *only*
       adding new user-visible Ids.
    Trac #9424
       In HscMain.hscDeclsWithLocations we were failing to use the
       *tidied* ClsInsts; but the un-tidied ones are LocalIds which
       causes a later ASSERT error.
       On the way I realised that, to behave consistently, the tcg_insts
       and tcg_fam_insts field of TcGblEnv should really only contain
       instances from the current GHCi command, not all the ones to date.
       That in turn meant I had to move the code for deleting replacement
       instances from addLocalInst, addLocalFamInst to
FamInstEnv.hs 40.2 KB