[Git][ghc/ghc][wip/expand-do] - don't add any ctxt in addExprCtxt for `XExpr(ExpandedStmt{})` as it is not...

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Wed Jun 7 22:33:04 UTC 2023



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


Commits:
e495b49f by Apoorv Ingle at 2023-06-07T17:30:50-05:00
- don't add any ctxt in addExprCtxt for `XExpr(ExpandedStmt{})` as it is not very useful, the statement ctxt is already added by `tcExpr` and `addHeadCtxt`

- - - - -


2 changed files:

- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Match.hs


Changes:

=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -1487,6 +1487,7 @@ addExprCtxt :: HsExpr GhcRn -> TcRn a -> TcRn a
 addExprCtxt e thing_inside
   = case e of
       HsUnboundVar {} -> thing_inside
+      XExpr (ExpandedStmt _) -> thing_inside
       _ -> addErrCtxt (exprCtxt e) thing_inside
    -- The HsUnboundVar special case addresses situations like
    --    f x = _


=====================================
compiler/GHC/Tc/Gen/Match.hs
=====================================
@@ -1228,7 +1228,7 @@ expand_do_stmts _ [stmt@(L loc (LastStmt _ body _ ret_expr))]
    = return $ wrapGenSpan (mkExpandedStmt stmt (genHsApp (wrapGenSpan ret) body))
 
 
-expand_do_stmts do_or_lc (stmt@(L loc (LetStmt _ bs)) : lstmts) =
+expand_do_stmts do_or_lc ((L _ (LetStmt _ bs)) : lstmts) =
 --                      stmts ~~> stmts'
 --    ------------------------------------------------
 --       let x = e ; stmts ~~> let x = e in stmts'



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e495b49f9084cc6d10150765b6b614854377174b
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/20230607/00b08f2d/attachment-0001.html>


More information about the ghc-commits mailing list