[Git][ghc/ghc][wip/spj-apporv-Oct24] addExprCtxt ignores Expanded Statements

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Fri Nov 8 18:20:38 UTC 2024



Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC


Commits:
fab1aa92 by Apoorv Ingle at 2024-11-08T12:20:10-06:00
addExprCtxt ignores Expanded Statements

- - - - -


1 changed file:

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


Changes:

=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -1260,6 +1260,9 @@ addThingCtxt (OrigStmt (L loc stmt) flav) thing_inside = do
   gen <- inGeneratedCode
   if gen
     then setSrcSpanA loc $ addStmtCtxt stmt flav $ setInGeneratedCode $ thing_inside
+         -- If we are in generated code, we need to set the error context at the correct
+         -- location and then switch context back into generated code to do the thing_inside
+         -- See Note [Rebindable syntax and XXExprGhcRn]
     else addStmtCtxt stmt flav $ thing_inside
 addThingCtxt _ thing_inside = thing_inside
 
@@ -1278,6 +1281,7 @@ addExprCtxt :: HsExpr GhcRn -> TcRn a -> TcRn a
 addExprCtxt e thing_inside
   = case e of
       HsUnboundVar {} -> thing_inside
+      XExpr (ExpandedThingRn (OrigStmt{}) _) -> thing_inside
       _ -> addErrCtxt (exprCtxt e) thing_inside
    -- The HsUnboundVar special case addresses situations like
    --    f x = _



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fab1aa924939b5e88d247f1caceca313827dec8a
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/20241108/e81db345/attachment-0001.html>


More information about the ghc-commits mailing list