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

Commits:

2 changed files:

Changes:

  • compiler/GHC/Tc/Gen/App.hs
    ... ... @@ -413,11 +413,13 @@ tcApp rn_expr exp_res_ty
    413 413
            -- Step 2: Infer the type of `fun`, the head of the application
    
    414 414
            ; (tc_fun, fun_sigma) <- tcInferAppHead fun
    
    415 415
            ; let tc_head = (tc_fun, fun_ctxt)
    
    416
    -       ; traceTc "tcApp:inferAppHead" $
    
    417
    -         vcat [ text "tc_fun:" <+> ppr tc_fun
    
    418
    -              , text "fun_sigma:" <+> ppr fun_sigma]
    
    419 416
            -- Step 3: Instantiate the function type (taking a quick look at args)
    
    420 417
            ; do_ql <- wantQuickLook rn_fun
    
    418
    +       ; traceTc "tcApp:inferAppHead" $
    
    419
    +         vcat [ text "tc_fun:" <+> ppr tc_fun
    
    420
    +              , text "fun_sigma:" <+> ppr fun_sigma
    
    421
    +              , text "do_ql:" <+> ppr do_ql]
    
    422
    +
    
    421 423
            ; (inst_args, app_res_rho)
    
    422 424
                   <- tcInstFun do_ql True (tc_fun, rn_fun, fun_ctxt) fun_sigma rn_args
    
    423 425
     
    

  • compiler/GHC/Tc/Gen/Head.hs
    ... ... @@ -300,6 +300,7 @@ splitHsApps e = go e (top_ctxt 0 e) []
    300 300
         top_ctxt n (HsPragE _ _ fun)    = top_lctxt n fun
    
    301 301
         top_ctxt n (HsAppType _ fun _)  = top_lctxt (n+1) fun
    
    302 302
         top_ctxt n (HsApp _ fun _)      = top_lctxt (n+1) fun
    
    303
    +    top_ctxt n (XExpr (PopErrCtxt fun)) = top_ctxt n fun
    
    303 304
         top_ctxt n other_fun            = VACall other_fun n noSrcSpan
    
    304 305
     
    
    305 306
         top_lctxt :: Int -> LHsExpr GhcRn -> AppCtxt
    
    ... ... @@ -332,6 +333,9 @@ splitHsApps e = go e (top_ctxt 0 e) []
    332 333
                         -- and its hard to say exactly what that is
    
    333 334
                    : EWrap (EExpand e)
    
    334 335
                    : args )
    
    336
    +    go (XExpr (PopErrCtxt fun)) ctxt args = go fun ctxt args
    
    337
    +      -- look through PopErrCtxt (cf. T17594f) we do not want to lose the opportunity of calling tcEValArgQL
    
    338
    +      -- unlike HsPar, it is okay to forget about the PopErrCtxts as it does not persist over in GhcTc land
    
    335 339
     
    
    336 340
         go e ctxt args = pure ((e,ctxt), args)
    
    337 341