[Git][ghc/ghc][wip/spj-apporv-Oct24] in QuicklookArg, wrap the inferAppHead_maybe with an optional error context...
Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC Commits: 929a03d5 by Apoorv Ingle at 2025-12-02T15:32:25-06:00 in QuicklookArg, wrap the inferAppHead_maybe with an optional error context update. If the head is a XExpr, we need to flip the state to generated - - - - - 1 changed file: - compiler/GHC/Tc/Gen/App.hs Changes: ===================================== compiler/GHC/Tc/Gen/App.hs ===================================== @@ -1959,7 +1959,8 @@ quickLookArg1 pos app_lspan (fun, fun_lspan) larg@(L arg_loc arg) sc_arg_ty@(Sca | otherwise = fun_lspan_arg' -- Step 1: get the type of the head of the argument - ; (fun_ue, mb_fun_ty) <- tcCollectingUsage $ tcInferAppHead_maybe rn_fun_arg + ; (fun_ue, mb_fun_ty) <- maybe_update_err_ctxt fun_lspan_arg rn_fun_arg $ + (tcCollectingUsage $ tcInferAppHead_maybe rn_fun_arg) -- tcCollectingUsage: the use of an Id at the head generates usage-info -- See the call to `tcEmitBindingUsage` in `check_local_id`. So we must -- capture and save it in the `EValArgQL`. See (QLA6) in @@ -2027,6 +2028,17 @@ quickLookArg1 pos app_lspan (fun, fun_lspan) larg@(L arg_loc arg) sc_arg_ty@(Sca , eaql_encl = arg_influences_enclosing_call , eaql_res_rho = app_res_rho }) }}} + +maybe_update_err_ctxt :: SrcSpan -> HsExpr GhcRn -> TcM a -> TcM a +maybe_update_err_ctxt fun_lspan_arg rn_fun_arg thing_inside + | not (isGeneratedSrcSpan fun_lspan_arg) + , XExpr (ExpandedThingRn{}) <- rn_fun_arg + = addLExprCtxt fun_lspan_arg rn_fun_arg $ thing_inside + | otherwise + = thing_inside + + + mk_origin :: SrcSpan -- SrcSpan of the argument -> HsExpr GhcRn -- The head of the expression application chain -> HsExpr GhcRn -- Fallback expression to appear in the error message View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/929a03d58f6a7c07341dde47ecd62935... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/929a03d58f6a7c07341dde47ecd62935... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Apoorv Ingle (@ani)