[Git][ghc/ghc][wip/T25647] Fix under application for data fam
Patrick (@soulomoon)
gitlab at gitlab.haskell.org
Fri Feb 14 22:44:29 UTC 2025
Patrick pushed to branch wip/T25647 at Glasgow Haskell Compiler / GHC
Commits:
8d0fb86b by Patrick at 2025-02-15T06:44:20+08:00
Fix under application for data fam
- - - - -
2 changed files:
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Instance/Class.hs
Changes:
=====================================
compiler/GHC/Tc/Gen/HsType.hs
=====================================
@@ -788,7 +788,7 @@ tcFamTyPats :: TyCon
-- Used for both type and data families
tcFamTyPats fam_tc hs_pats mb_clsinfo
= do { traceTc "tcFamTyPats {" $
- vcat [ ppr fam_tc, text "arity:" <+> ppr fam_arity ]
+ vcat [ ppr fam_tc, text "arity:" <+> ppr fam_arity, text "pats:" <+> ppr hs_pats ]
; mode <- mkHoleMode TypeLevel (HM_FamPat FreeArg)
-- HM_FamPat: See Note [Wildcards in family instances] in
=====================================
compiler/GHC/Tc/Instance/Class.hs
=====================================
@@ -112,11 +112,7 @@ buildAssocInstInfo fam_tc (Just (cls, tvs, env)) = InClsInst cls tvs env argType
buildPatsArgTypes :: (Outputable x) => AssocInstInfo -> [x] -> [(x, FamArgType)]
buildPatsArgTypes NotAssociated xs = buildPatsModeTypes FreeArg xs
-buildPatsArgTypes (InClsInst {..}) xs =
- assertPpr ((length ai_arg_types) == length xs)
- (text "associated type family instance header patterns mismatch with ai_arg_types on length: "
- <+> text "Args: "<> ppr xs <+> text "ai_arg_types:" <+> ppr xs)
- $ zip xs ai_arg_types
+buildPatsArgTypes (InClsInst {..}) xs = zip xs (ai_arg_types ++ cycle [FreeArg])
buildPatsModeTypes :: FamArgType -> [x] -> [(x, FamArgType)]
buildPatsModeTypes fa xs = (,fa) <$> xs
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8d0fb86bbb6f825620b70ea816fa120a67a97fc7
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/8d0fb86bbb6f825620b70ea816fa120a67a97fc7
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250214/2238ca4d/attachment-0001.html>
More information about the ghc-commits
mailing list