[Git][ghc/ghc][wip/expand-do] change the match ctxt while type checking HsLam if the lambda match is due to...

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Sat May 27 00:08:15 UTC 2023



Apoorv Ingle pushed to branch wip/expand-do at Glasgow Haskell Compiler / GHC


Commits:
7ff1c26d by Apoorv Ingle at 2023-05-26T19:08:07-05:00
change the match ctxt while type checking HsLam if the lambda match is due to an expression generated from a do block

- - - - -


1 changed file:

- compiler/GHC/Tc/Gen/Expr.hs


Changes:

=====================================
compiler/GHC/Tc/Gen/Expr.hs
=====================================
@@ -267,7 +267,10 @@ tcExpr (HsLam _ match) res_ty
   = do  { (wrap, match') <- tcMatchLambda herald match_ctxt match res_ty
         ; return (mkHsWrap wrap (HsLam noExtField match')) }
   where
-    match_ctxt = MC { mc_what = LambdaExpr, mc_body = tcBody }
+    match_ctxt = MC { mc_what = case mg_ext match of
+                                  Generated DoExpansion -> StmtCtxt (HsDoStmt (DoExpr Nothing))
+                                  _ -> LambdaExpr
+                    , mc_body = tcBody }
     herald = ExpectedFunTyLam match
 
 tcExpr e@(HsLamCase x lc_variant matches) res_ty



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ff1c26dafd53b1c836df8f7d0db1b6c265ee6c4

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7ff1c26dafd53b1c836df8f7d0db1b6c265ee6c4
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/20230526/6cd92674/attachment.html>


More information about the ghc-commits mailing list