[Git][ghc/ghc][wip/ani/kill-popErrCtxt] make add arg ctx print in the nth argument if the head of the application chain is user located
Apoorv Ingle pushed to branch wip/ani/kill-popErrCtxt at Glasgow Haskell Compiler / GHC Commits: cafe92c3 by Apoorv Ingle at 2025-11-01T23:53:11-05:00 make add arg ctx print in the nth argument if the head of the application chain is user located - - - - - 2 changed files: - compiler/GHC/Tc/Gen/App.hs - testsuite/tests/rebindable/rebindable6.stderr Changes: ===================================== compiler/GHC/Tc/Gen/App.hs ===================================== @@ -964,12 +964,13 @@ addArgCtxt arg_no (fun, fun_lspan) (L arg_loc arg) thing_inside _ -> text "<USER>" <+> pprErrCtxtMsg y) (take 4 (zip err_ctx err_ctx_msg))) ]) - ; if in_generated_code && isGeneratedSrcSpan fun_lspan - then updCtxtForArg (L arg_loc arg) $ - thing_inside - else do setSrcSpanA arg_loc $ - addErrCtxt (FunAppCtxt (FunAppCtxtExpr fun arg) arg_no) $ - thing_inside } + ; if not (isGeneratedSrcSpan fun_lspan) + then setSrcSpanA arg_loc $ + addErrCtxt (FunAppCtxt (FunAppCtxtExpr fun arg) arg_no) $ + thing_inside + else updCtxtForArg (L arg_loc arg) $ + thing_inside + } where updCtxtForArg :: LHsExpr GhcRn -> TcRn a -> TcRn a updCtxtForArg e@(L lspan _) thing_inside ===================================== testsuite/tests/rebindable/rebindable6.stderr ===================================== @@ -1,9 +1,8 @@ - rebindable6.hs:110:17: error: [GHC-39999] • Ambiguous type variable ‘t0’ arising from a do statement prevents the constraint ‘(HasSeq (IO a -> t0 -> IO b))’ from being solved. - (maybe you haven't applied a function to enough arguments?) + (maybe you haven't applied a function to enough arguments?) Relevant bindings include g :: IO (Maybe b) (bound at rebindable6.hs:108:19) f :: IO a (bound at rebindable6.hs:108:17) @@ -28,7 +27,7 @@ rebindable6.hs:111:17: error: [GHC-39999] • Ambiguous type variables ‘t1’, ‘t0’ arising from a do statement prevents the constraint ‘(HasBind (IO (Maybe b) -> (Maybe b -> t1) -> t0))’ from being solved. - (maybe you haven't applied a function to enough arguments?) + (maybe you haven't applied a function to enough arguments?) Relevant bindings include g :: IO (Maybe b) (bound at rebindable6.hs:108:19) test_do :: IO a -> IO (Maybe b) -> IO b @@ -50,9 +49,9 @@ rebindable6.hs:111:17: error: [GHC-39999] return b rebindable6.hs:112:17: error: [GHC-39999] - • Ambiguous type variable ‘t1’ arising from a use of ‘return’ + • Ambiguous type variable ‘t1’ arising from a do statement prevents the constraint ‘(HasReturn (b -> t1))’ from being solved. - (maybe you haven't applied a function to enough arguments?) + (maybe you haven't applied a function to enough arguments?) Relevant bindings include b :: b (bound at rebindable6.hs:111:23) g :: IO (Maybe b) (bound at rebindable6.hs:108:19) @@ -71,3 +70,4 @@ rebindable6.hs:112:17: error: [GHC-39999] = do f Just (b :: b) <- g return b + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cafe92c3eeba2b9a6b3195a2a7ddfa4c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/cafe92c3eeba2b9a6b3195a2a7ddfa4c... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Apoorv Ingle (@ani)