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

Commits:

2 changed files:

Changes:

  • compiler/GHC/Tc/Gen/Expr.hs
    ... ... @@ -650,20 +650,20 @@ tcExpr expr@(RecordUpd { rupd_expr = record_expr
    650 650
         do  { -- Expand the record update. See Note [Record Updates].
    
    651 651
             ; (ds_expr, ds_res_ty, err_ctxt)
    
    652 652
                 <- expandRecordUpd record_expr possible_parents rbnds res_ty
    
    653
    -
    
    654
    -          -- Typecheck the expanded expression.
    
    655
    -        ; expr' <- addErrCtxt err_ctxt $
    
    656
    -                   setInGeneratedCode (OrigExpr expr) $
    
    657
    -                   tcExpr ds_expr (Check ds_res_ty)
    
    658
    -            -- NB: it's important to use ds_res_ty and not res_ty here.
    
    659
    -            -- Test case: T18802b.
    
    660
    -
    
    661
    -        ; addErrCtxt err_ctxt $ tcWrapResultMono expr expr' ds_res_ty res_ty
    
    662
    -            -- We need to unify the result type of the expanded
    
    663
    -            -- expression with the expected result type.
    
    664
    -            --
    
    665
    -            -- See Note [Unifying result types in tcRecordUpd].
    
    666
    -            -- Test case: T10808.
    
    653
    +        ; addErrCtxt err_ctxt $
    
    654
    +          setInGeneratedCode (OrigExpr expr) $
    
    655
    +          do { -- Typecheck the expanded expression.
    
    656
    +               expr' <- tcExpr ds_expr (Check ds_res_ty)
    
    657
    +               -- NB: it's important to use ds_res_ty and not res_ty here.
    
    658
    +               -- Test case: T18802b.
    
    659
    +
    
    660
    +             ; tcWrapResultMono expr expr' ds_res_ty res_ty
    
    661
    +             -- We need to unify the result type of the expanded
    
    662
    +             -- expression with the expected result type.
    
    663
    +             --
    
    664
    +             -- See Note [Unifying result types in tcRecordUpd].
    
    665
    +             -- Test case: T10808.
    
    666
    +             }
    
    667 667
             }
    
    668 668
     
    
    669 669
     tcExpr e@(RecordUpd { rupd_flds = OverloadedRecUpdFields {}}) _
    

  • testsuite/tests/printer/T17697.stderr
    1
    -T17697.hs:5:8: warning: [GHC-81995] [-Wunused-do-bind (in -Wall)]
    
    2
    -    A do-notation statement discarded a result of type
    
    3
    -      ‘GHC.Internal.Types.ZonkAny 1’
    
    4
    -    Suggested fix: Suppress this warning by saying ‘_ <- threadDelay 1’
    
    5
    -
    
    6 1
     T17697.hs:6:5: warning: [GHC-88464] [-Wdeferred-out-of-scope-variables (in -Wdefault)]
    
    7 2
         Variable not in scope: threadDelay :: t0 -> IO a0
    
    3
    +