
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 7641a74a by Simon Peyton Jones at 2025-04-26T22:05:19-04:00 Get a decent MatchContext for pattern synonym bindings In particular when we have a pattern binding K p1 .. pn = rhs where K is a pattern synonym. (It might be nested.) This small MR fixes #25995. It's a tiny fix, to an error message, removing an always-dubious `unkSkol`. The bug report was in the context of horde-ad, a big program, and I didn't manage to make a small repro case quickly. I decided not to bother further. - - - - - 1 changed file: - compiler/GHC/Tc/Gen/Pat.hs Changes: ===================================== compiler/GHC/Tc/Gen/Pat.hs ===================================== @@ -1265,9 +1265,10 @@ tcPatSynPat (L con_span con_name) pat_syn pat_ty penv arg_pats thing_inside ; let all_arg_tys = ty : prov_theta ++ (map scaledThing arg_tys) ; checkGADT (PatSynCon pat_syn) ex_tvs all_arg_tys penv - ; skol_info <- case pe_ctxt penv of - LamPat mc -> mkSkolemInfo (PatSkol (PatSynCon pat_syn) mc) - LetPat {} -> return unkSkol -- Doesn't matter + ; let match_ctxt = case pe_ctxt penv of + LamPat mc -> mc + LetPat {} -> PatBindRhs + ; skol_info <- mkSkolemInfo (PatSkol (PatSynCon pat_syn) match_ctxt) ; (tenv, ex_tvs') <- tcInstSuperSkolTyVarsX skol_info subst ex_tvs -- This freshens: Note [Freshen existentials] View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7641a74a21eb7fb6c60b0cd94fc5fd26... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7641a74a21eb7fb6c60b0cd94fc5fd26... You're receiving this email because of your account on gitlab.haskell.org.