Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

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
    1959 1959
                                | otherwise = fun_lspan_arg'
    
    1960 1960
     
    
    1961 1961
            -- Step 1: get the type of the head of the argument
    
    1962
    -       ; (fun_ue, mb_fun_ty) <- tcCollectingUsage $ tcInferAppHead_maybe rn_fun_arg
    
    1962
    +       ; (fun_ue, mb_fun_ty) <- maybe_update_err_ctxt fun_lspan_arg rn_fun_arg $
    
    1963
    +                                (tcCollectingUsage $ tcInferAppHead_maybe rn_fun_arg)
    
    1963 1964
              -- tcCollectingUsage: the use of an Id at the head generates usage-info
    
    1964 1965
              -- See the call to `tcEmitBindingUsage` in `check_local_id`.  So we must
    
    1965 1966
              -- 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
    2027 2028
                                , eaql_encl     = arg_influences_enclosing_call
    
    2028 2029
                                , eaql_res_rho  = app_res_rho }) }}}
    
    2029 2030
     
    
    2031
    +
    
    2032
    +maybe_update_err_ctxt :: SrcSpan -> HsExpr GhcRn ->  TcM a -> TcM a
    
    2033
    +maybe_update_err_ctxt fun_lspan_arg rn_fun_arg thing_inside
    
    2034
    +  | not (isGeneratedSrcSpan fun_lspan_arg)
    
    2035
    +  , XExpr (ExpandedThingRn{}) <- rn_fun_arg
    
    2036
    +  = addLExprCtxt fun_lspan_arg rn_fun_arg $ thing_inside
    
    2037
    +  | otherwise
    
    2038
    +  = thing_inside
    
    2039
    +
    
    2040
    +
    
    2041
    +
    
    2030 2042
     mk_origin :: SrcSpan       -- SrcSpan of the argument
    
    2031 2043
               -> HsExpr GhcRn  -- The head of the expression application chain
    
    2032 2044
               -> HsExpr GhcRn  -- Fallback expression to appear in the error message