summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Utils
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-06-28 17:43:24 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-06-29 15:36:08 -0400
commit4e9f58c759f16a3a20c338799a5b83d334c2778d (patch)
treef7013651d23a13356499ef2d22b54919f8faa6ca /compiler/GHC/Tc/Utils
parentb760c1f743ddb496886f095baa920740b38c9ce0 (diff)
downloadhaskell-4e9f58c759f16a3a20c338799a5b83d334c2778d.tar.gz
Use HsExpansion for overloaded list patterns
Fixes #14380, #19997
Diffstat (limited to 'compiler/GHC/Tc/Utils')
-rw-r--r--compiler/GHC/Tc/Utils/Zonk.hs22
1 files changed, 9 insertions, 13 deletions
diff --git a/compiler/GHC/Tc/Utils/Zonk.hs b/compiler/GHC/Tc/Utils/Zonk.hs
index 2a38a54460..49d2885c5e 100644
--- a/compiler/GHC/Tc/Utils/Zonk.hs
+++ b/compiler/GHC/Tc/Utils/Zonk.hs
@@ -1374,17 +1374,10 @@ zonk_pat env (ViewPat ty expr pat)
; ty' <- zonkTcTypeToTypeX env ty
; return (env', ViewPat ty' expr' pat') }
-zonk_pat env (ListPat (ListPatTc ty Nothing) pats)
+zonk_pat env (ListPat ty pats)
= do { ty' <- zonkTcTypeToTypeX env ty
; (env', pats') <- zonkPats env pats
- ; return (env', ListPat (ListPatTc ty' Nothing) pats') }
-
-zonk_pat env (ListPat (ListPatTc ty (Just (ty2,wit))) pats)
- = do { (env', wit') <- zonkSyntaxExpr env wit
- ; ty2' <- zonkTcTypeToTypeX env' ty2
- ; ty' <- zonkTcTypeToTypeX env' ty
- ; (env'', pats') <- zonkPats env' pats
- ; return (env'', ListPat (ListPatTc ty' (Just (ty2',wit'))) pats') }
+ ; return (env', ListPat ty' pats') }
zonk_pat env (TuplePat tys pats boxed)
= do { tys' <- mapM (zonkTcTypeToTypeX env) tys
@@ -1466,13 +1459,16 @@ zonk_pat env (NPlusKPat ty (L loc n) (L l lit1) lit2 e1 e2)
; ty' <- zonkTcTypeToTypeX env2 ty
; return (extendIdZonkEnv env2 n',
NPlusKPat ty' (L loc n') (L l lit1') lit2' e1' e2') }
-
-zonk_pat env (XPat (CoPat co_fn pat ty))
- = do { (env', co_fn') <- zonkCoFn env co_fn
+zonk_pat env (XPat ext) = case ext of
+ { ExpansionPat orig pat->
+ do { (env, pat') <- zonk_pat env pat
+ ; return $ (env, XPat $ ExpansionPat orig pat') }
+ ; CoPat co_fn pat ty ->
+ do { (env', co_fn') <- zonkCoFn env co_fn
; (env'', pat') <- zonkPat env' (noLocA pat)
; ty' <- zonkTcTypeToTypeX env'' ty
; return (env'', XPat $ CoPat co_fn' (unLoc pat') ty')
- }
+ }}
zonk_pat _ pat = pprPanic "zonk_pat" (ppr pat)