[Git][ghc/ghc][wip/spj-apporv-Oct24] do not wrap last do statement in an XExpr

Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC Commits: 35d5a38d by Apoorv Ingle at 2025-08-10T19:30:13-05:00 do not wrap last do statement in an XExpr - - - - - 1 changed file: - compiler/GHC/Tc/Gen/Do.hs Changes: ===================================== compiler/GHC/Tc/Gen/Do.hs ===================================== @@ -81,14 +81,16 @@ expand_do_stmts flav [stmt@(L sloc (LastStmt _ body@(L body_loc _) _ ret_expr))] -- See `checkLastStmt` and `Syntax.Expr.StmtLR.LastStmt` | NoSyntaxExprRn <- ret_expr -- Last statement is just body if we are not in ListComp context. See Syntax.Expr.LastStmt - = return $ L sloc (mkExpandedStmt stmt flav (HsPar noExtField body)) + -- = return $ L sloc (mkExpandedStmt stmt flav (HsPar noExtField body)) + = return body | SyntaxExprRn ret <- ret_expr -- -- ------------------------------------------------ -- return e ~~> return e -- to make T18324 work = do let expansion = L body_loc (genHsApp ret body) - return $ L sloc (mkExpandedStmt stmt flav (HsPar noExtField expansion)) + --return $ L sloc (mkExpandedStmt stmt flav (HsPar noExtField expansion)) + return expansion expand_do_stmts doFlavour (stmt@(L loc (LetStmt _ bs)) : lstmts) = -- See Note [Expanding HsDo with XXExprGhcRn] Equation (3) below View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/35d5a38dc11ddbc6e4482d595de1875c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/35d5a38dc11ddbc6e4482d595de1875c... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Apoorv Ingle (@ani)