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

Commits:

4 changed files:

Changes:

  • compiler/GHC/HsToCore/Expr.hs
    ... ... @@ -719,13 +719,13 @@ ds_app (XExpr (ConLikeTc con)) _hs_args core_args
    719 719
     ds_app (XExpr (HsRecSelTc (FieldOcc { foLabel = L _ sel_id }))) _hs_args core_args
    
    720 720
       = ds_app_rec_sel sel_id sel_id core_args
    
    721 721
     
    
    722
    -ds_app (XExpr (ExpandedThingTc _orig e)) hs_args core_args
    
    723
    -  = ds_app e hs_args core_args
    
    722
    +ds_app (XExpr (ExpandedThingTc (HSE _orig e))) hs_args core_args
    
    723
    +  = ds_app (unLoc e) hs_args core_args
    
    724 724
       -- NB: this is important for the 'getField' case of 'ds_app_var', which needs
    
    725 725
       -- to see all type arguments to 'getField' at once, while for record field
    
    726 726
       -- projections such as (.fld) we may get:
    
    727 727
       --
    
    728
    -  --   XExpr (ExpandedThingTc (.fld) (getField @Symbol @LiftedRep @LiftedRep "fld"))
    
    728
    +  --   XExpr (ExpandedThingTc (HSE (.fld) (getField @Symbol @LiftedRep @LiftedRep "fld")))
    
    729 729
       --     `HsAppType` rec_ty `HsAppType` fld
    
    730 730
     
    
    731 731
     ds_app (HsVar _ lfun) hs_args core_args
    

  • compiler/GHC/Tc/Gen/Do.hs
    ... ... @@ -451,7 +451,7 @@ It stores the original statement (with location) and the expanded expression
    451 451
         of the error context stack which contains the error message for
    
    452 452
         the previous statement: eg. "In the stmt of a do block: e1".
    
    453 453
         This popping is implicitly done when we push the error context message for the next statment.
    
    454
    -    See Note [ErrCtxtStack Manipulation] and `LclEnv.setLclCtxtHsCtxt`
    
    454
    +    See `LclEnv.setLclCtxtHsCtxt`
    
    455 455
     
    
    456 456
         Sans the popping business for error context stack,
    
    457 457
         if there were to be a type error in `e2`, we would get a spurious and confusing error message
    

  • compiler/GHC/Tc/Types/LclEnv.hs
    ... ... @@ -89,10 +89,6 @@ data TcLclEnv -- Changes as we move inside an expression
    89 89
             tcl_errs :: TcRef (Messages TcRnMessage)     -- Place to accumulate diagnostics
    
    90 90
         }
    
    91 91
     
    
    92
    --- | Get the top of the error message stack
    
    93
    -get_err_ctxt_stack_head :: ErrCtxtStack -> HsCtxt
    
    94
    -get_err_ctxt_stack_head (e : _) = e
    
    95
    -get_err_ctxt_stack_head _ = error "get_err_ctxt_stack_head: oops! Empty error message stack"
    
    96 92
     
    
    97 93
     data TcLclCtxt
    
    98 94
       = TcLclCtxt {
    
    ... ... @@ -176,7 +172,7 @@ setLclEnvHsCtxt ec = modifyLclCtxt (setLclCtxtHsCtxt ec)
    176 172
     
    
    177 173
     setLclCtxtHsCtxt :: HsCtxt -> TcLclCtxt -> TcLclCtxt
    
    178 174
     setLclCtxtHsCtxt ec lclCtxt
    
    179
    -  -- Never stack 2 statement error contexts on top of each other
    
    175
    +  -- Never stack 2 do statement error messages on top of each other
    
    180 176
       | StmtErrCtxt{} : ecs <- tcl_err_ctxt lclCtxt
    
    181 177
       , StmtErrCtxt{} <- ec
    
    182 178
       = lclCtxt { tcl_err_ctxt =  ec : ecs }
    

  • compiler/GHC/Tc/Types/Origin.hs
    ... ... @@ -916,7 +916,7 @@ foldMapCtOrigin f = go
    916 916
             DerivOriginDC {} -> f orig
    
    917 917
             DerivOriginCoerce {}  -> f orig
    
    918 918
             DefaultOrigin {} -> f orig
    
    919
    -        DoOrigin {} -> f orig
    
    919
    +        DoStmtOrigin {} -> f orig
    
    920 920
             DoPatOrigin {} -> f orig
    
    921 921
             MCompOrigin {} -> f orig
    
    922 922
             MCompPatOrigin {} -> f orig