Skip to content

Fix type variable substitution in gen_Newtype_fam_insts

Ryan Scott requested to merge wip/T23329 into master

Previously, gen_Newtype_fam_insts was substituting the type variable binders of a type family instance using substTyVars, which failed to take type variable dependencies into account. There is similar code in GHC.Tc.TyCl.Class.tcATDefault that does perform this substitution properly, so this patch:

  1. Factors out this code into a top-level substATBndrs function, and
  2. Uses substATBndrs in gen_Newtype_fam_insts.

Fixes #23329.

Edited by Ryan Scott

Merge request reports