Patrick pushed to branch wip/soulomoon/T26154-work-around at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • compiler/GHC/Tc/Instance/Family.hs
    ... ... @@ -405,7 +405,13 @@ getFamInsts hpt_fam_insts mod
    405 405
       | Just env <- lookupModuleEnv hpt_fam_insts mod = return env
    
    406 406
       | otherwise = do { _ <- initIfaceTcRn (loadSysInterface doc mod)
    
    407 407
                        ; eps <- getEps
    
    408
    -                   ; return (expectJust $
    
    408
    +                   -- Workaround for #26154:
    
    409
    +                   -- We use `fromMaybe emptyFamInstEnv` instead of `expectJust` because
    
    410
    +                   -- the module `mod` comes from the `ModIface`'s `Dependencies`, while
    
    411
    +                   -- `hpt_fam_insts` is built from `moduleGraphModulesBelow`.
    
    412
    +                   -- Due to inconsistencies between the two, `mod` might not be present
    
    413
    +                   -- in `hpt_fam_insts`.
    
    414
    +                   ; return (fromMaybe emptyFamInstEnv $
    
    409 415
                                  lookupModuleEnv (eps_mod_fam_inst_env eps) mod) }
    
    410 416
       where
    
    411 417
         doc = ppr mod <+> text "is a family-instance module"