Skip to content
  • Simon Peyton Jones's avatar
    Report family instance orphans correctly · 46a53bb2
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    This fixes the fact that we were not reporting orphan family instances
    at all. The fix here is easy, but touches a bit of code. I refactored
    the code to be much more similar to the way that class instances are done:
    
       - Add a fi_orphan field to FamInst, like the is_orphan field in ClsInst
       - Make newFamInst initialise this field, just like newClsInst
       - And make newFamInst report a warning for an orphan, just like newClsInst
       - I moved newFamInst from GHC.Tc.Instance.Family to GHC.Tc.Utils.Instantiate,
         just like newClsInst.
       - I added mkLocalFamInst to FamInstEnv, just like mkLocalClsInst in InstEnv
       - TcRnOrphanInstance and SuggestFixOrphanInstance are now parametrised
         over class instances vs type/data family instances.
    
    Fixes #19773
    46a53bb2