Skip to content
  • Sebastian Graf's avatar
    Pmc: Consider Required Constraints when guessing PatSyn arg types (#19475) · 1793ca9d
    Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
    
    
    This patch makes `guessConLikeUnivTyArgsFromResTy` consider required
    Thetas of PatSynCons, by treating them as Wanted constraints to be
    discharged with the constraints from the Nabla's TyState and saying
    "does not match the match type" if the Wanted constraints are unsoluble.
    It calls out into a new function `GHC.Tc.Solver.tcCheckWanteds` to do
    so.
    
    In pushing the failure logic around call sites of `initTcDsForSolver`
    inside it by panicking, I realised that there was a bunch of dead code
    surrounding `pmTopMoraliseType`: I was successfully able to delete the
    `NoChange` data constructor of `TopNormaliseTypeResult`.
    
    The details are in `Note [Matching against a ConLike result type]` and
    `Note [Instantiating a ConLike].
    
    The regression test is in `T19475`. It's pretty much a fork of `T14422`
    at the moment.
    
    Co-authored-by: default avatarCale Gibbard <cgibbard@gmail.com>
    1793ca9d