Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC Commits: 4ea84b19 by Apoorv Ingle at 2025-11-25T13:52:46-06:00 always add expressions in the error messages on the rhs of equations and matches - - - - - 2 changed files: - compiler/GHC/Tc/Gen/Head.hs - compiler/GHC/Tc/Gen/Match.hs Changes: ===================================== compiler/GHC/Tc/Gen/Head.hs ===================================== @@ -1107,12 +1107,11 @@ add_expr_ctxt e thing_inside -- Flip error ctxt into expansion mode _ -> addErrCtxt (ExprCtxt e) thing_inside - -- no op in generated code addLExprCtxt :: SrcSpan -> HsExpr GhcRn -> TcRn a -> TcRn a addLExprCtxt lspan e thing_inside | not (isGeneratedSrcSpan lspan) = setSrcSpan lspan $ add_expr_ctxt e thing_inside - | otherwise + | otherwise -- no op in generated code = thing_inside ===================================== compiler/GHC/Tc/Gen/Match.hs ===================================== @@ -42,7 +42,7 @@ import GHC.Prelude import {-# SOURCE #-} GHC.Tc.Gen.Expr( tcSyntaxOp, tcInferRho, tcInferRhoFRRNC , tcMonoLExprNC, tcMonoLExpr, tcExpr , tcCheckMonoExpr, tcCheckMonoExprNC - , tcCheckPolyExpr, tcPolyLExpr ) + , tcCheckPolyExpr, tcPolyExpr ) import GHC.Rename.Utils ( bindLocalNames ) import GHC.Tc.Errors.Types @@ -420,10 +420,15 @@ tcDoStmts mDoExpr ss@(L _ stmts) res_ty } tcBody :: LHsExpr GhcRn -> ExpRhoType -> TcM (LHsExpr GhcTc) -tcBody body res_ty - = do { traceTc "tcBody" (ppr res_ty) - ; tcPolyLExpr body res_ty - } +tcBody (L lspan e) res_ty + = L lspan <$> + do { traceTc "tcBody" (ppr res_ty) + ; setSrcSpanA lspan $ + addErrCtxt (ExprCtxt e) $ + -- We want the right hand side of a match or an equation + -- to always get printed + tcPolyExpr e res_ty) + } {- ************************************************************************ View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ea84b199496579abdcb9024ccbb8864... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ea84b199496579abdcb9024ccbb8864... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Apoorv Ingle (@ani)