Apoorv Ingle pushed to branch wip/ani/tc-expand at Glasgow Haskell Compiler / GHC
Commits:
-
7ef903c6
by Apoorv Ingle at 2026-03-16T16:03:06-05:00
3 changed files:
- compiler/GHC/Tc/Gen/Do.hs
- compiler/GHC/Tc/Gen/Expr.hs
- testsuite/tests/ghci/prog-mhu001/prog-mhu001c.stdout
Changes:
| ... | ... | @@ -113,7 +113,7 @@ expand_do_stmts doFlavour (stmt@(L loc (BindStmt xbsrn pat e)): lstmts) |
| 113 | 113 | | otherwise
|
| 114 | 114 | = pprPanic "expand_do_stmts: The impossible happened, missing bind operator from renamer" (text "stmt" <+> ppr stmt)
|
| 115 | 115 | |
| 116 | -expand_do_stmts doFlavour (stmt@(L loc (BodyStmt _ (L e_lspan e) (SyntaxExprRn then_op) _)) : lstmts) =
|
|
| 116 | +expand_do_stmts doFlavour (stmt@(L loc (BodyStmt _ (L _ e) (SyntaxExprRn then_op) _)) : lstmts) =
|
|
| 117 | 117 | -- See Note [BodyStmt] in Language.Haskell.Syntax.Expr
|
| 118 | 118 | -- See Note [Expanding HsDo with XXExprGhcRn] Equation (1) below
|
| 119 | 119 | -- stmts ~~> stmts'
|
| ... | ... | @@ -121,7 +121,7 @@ expand_do_stmts doFlavour (stmt@(L loc (BodyStmt _ (L e_lspan e) (SyntaxExprRn t |
| 121 | 121 | -- e ; stmts ~~> (>>) e stmts'
|
| 122 | 122 | do expand_stmts_expr <- expand_do_stmts doFlavour lstmts
|
| 123 | 123 | let expansion = genHsExpApps then_op -- (>>)
|
| 124 | - [ L e_lspan (mkExpandedStmt stmt doFlavour e)
|
|
| 124 | + [ wrapGenSpan e
|
|
| 125 | 125 | , expand_stmts_expr ]
|
| 126 | 126 | return $ L loc (mkExpandedStmt stmt doFlavour expansion)
|
| 127 | 127 |
| ... | ... | @@ -1865,10 +1865,6 @@ checkMissingFields con_like rbinds arg_tys |
| 1865 | 1865 | tcExpandExpr :: HsExpr GhcRn -> TcM (HsExpr GhcRn)
|
| 1866 | 1866 | tcExpandExpr orig_expr@(HsDo _ flav (L _ stmts))
|
| 1867 | 1867 | = do { expanded_expr <- expandDoStmts flav stmts
|
| 1868 | - -- We lose the location on the first statement location in GhcTc, unfortunately.
|
|
| 1869 | - -- It is needed for get the pattern match warnings right cf. T14546d
|
|
| 1870 | - -- That location is currently recovered from the location stored in StmtErrCtxt
|
|
| 1871 | - -- in dsExpr of ExpandedThingTc
|
|
| 1872 | 1868 | ; return (mkExpandedLExpr orig_expr expanded_expr) }
|
| 1873 | 1869 | |
| 1874 | 1870 | tcExpandExpr e = return e |
| ... | ... | @@ -9,6 +9,7 @@ e/E.hs:(15,3)-(15,6): GHC.Internal.Types.Int -> GHC.Internal.Base.String |
| 9 | 9 | e/E.hs:(22,3)-(22,6): E.E -> GHC.Internal.Base.String
|
| 10 | 10 | e/E.hs:(25,3)-(25,10): GHC.Internal.Base.String -> GHC.Internal.Types.IO ()
|
| 11 | 11 | e/E.hs:(25,12)-(25,37): GHC.Internal.Base.String
|
| 12 | +e/E.hs:(25,3)-(25,37): GHC.Internal.Types.IO ()
|
|
| 12 | 13 | e/E.hs:(24,16)-(25,37): GHC.Internal.Types.IO ()
|
| 13 | 14 | e/E.hs:(19,9)-(19,9): E.E
|
| 14 | 15 | e/E.hs:(5,7)-(5,8): GHC.Internal.Bignum.Integer.Integer
|