[Git][ghc/ghc][wip/ani/kill-popErrCtxt] change add arg ctxt to be verbose
 
            Apoorv Ingle pushed to branch wip/ani/kill-popErrCtxt at Glasgow Haskell Compiler / GHC Commits: 5583e9f4 by Apoorv Ingle at 2025-10-03T09:48:40-05:00 change add arg ctxt to be verbose - - - - - 2 changed files: - compiler/GHC/Tc/Gen/App.hs - compiler/GHC/Tc/Gen/Expr.hs Changes: ===================================== compiler/GHC/Tc/Gen/App.hs ===================================== @@ -32,7 +32,8 @@ import GHC.Tc.Gen.HsType import GHC.Tc.Utils.Concrete ( unifyConcrete, idConcreteTvs ) import GHC.Tc.Utils.TcMType import GHC.Tc.Types.Evidence -import GHC.Tc.Types.ErrCtxt ( FunAppCtxtFunArg(..) ) +import GHC.Tc.Types.ErrCtxt ( FunAppCtxtFunArg(..), ErrCtxt (..) ) +import GHC.Tc.Errors.Ppr (pprErrCtxtMsg) import GHC.Tc.Types.Origin import GHC.Tc.Utils.TcType as TcType import GHC.Tc.Utils.Concrete( hasFixedRuntimeRep_syntactic ) @@ -943,9 +944,18 @@ addArgCtxt :: Int -> HsExpr GhcRn -> LHsExpr GhcRn -- See Note [Expanding HsDo with XXExprGhcRn] in GHC.Tc.Gen.Do addArgCtxt arg_no fun (L arg_loc arg) thing_inside = do { in_generated_code <- inGeneratedCode + ; err_ctx <- getErrCtxt + ; env0 <- liftZonkM tcInitTidyEnv + ; err_ctx_msg <- mkErrCtxt env0 err_ctx ; traceTc "addArgCtxt" (vcat [ text "generated:" <+> ppr in_generated_code , text "arg: " <+> ppr arg - , text "arg_loc" <+> ppr arg_loc]) + , text "arg_loc:" <+> ppr arg_loc + , text "fun:" <+> ppr fun + , text "err_ctx" <+> vcat (fmap (\ (x, y) -> case x of + UserCodeCtxt{} -> text "<USER>" <+> pprErrCtxtMsg y + ExpansionCodeCtxt{} -> text "<EXPN>" <+> pprErrCtxtMsg y) + (take 2 (zip err_ctx err_ctx_msg))) + ]) ; if in_generated_code then updCtxtForArg (locA arg_loc) arg $ thing_inside ===================================== compiler/GHC/Tc/Gen/Expr.hs ===================================== @@ -666,7 +666,7 @@ tcExpr expr@(RecordUpd { rupd_expr = record_expr ; (ds_expr, ds_res_ty, err_msg) <- expandRecordUpd record_expr possible_parents rbnds res_ty ; addErrCtxt err_msg $ - ; setInGeneratedCode (OrigExpr expr) $ + setInGeneratedCode (OrigExpr expr) $ do { -- Typecheck the expanded expression. expr' <- tcExpr ds_expr (Check ds_res_ty) -- NB: it's important to use ds_res_ty and not res_ty here. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5583e9f4301b51e32b137033e0b18f19... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5583e9f4301b51e32b137033e0b18f19... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
- 
                 Apoorv Ingle (@ani) Apoorv Ingle (@ani)