Apoorv Ingle pushed to branch wip/ani/kill-popErrCtxt at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Tc/Gen/App.hs
    ... ... @@ -964,12 +964,13 @@ addArgCtxt arg_no (fun, fun_lspan) (L arg_loc arg) thing_inside
    964 964
                                                                _ -> text "<USER>" <+> pprErrCtxtMsg y)
    
    965 965
                                                                        (take 4 (zip err_ctx err_ctx_msg)))
    
    966 966
                                         ])
    
    967
    -       ; if in_generated_code && isGeneratedSrcSpan fun_lspan
    
    968
    -         then updCtxtForArg (L arg_loc arg) $
    
    969
    -                   thing_inside
    
    970
    -         else do setSrcSpanA arg_loc                    $
    
    971
    -                   addErrCtxt (FunAppCtxt (FunAppCtxtExpr fun arg) arg_no) $
    
    972
    -                   thing_inside }
    
    967
    +       ; if not (isGeneratedSrcSpan fun_lspan)
    
    968
    +         then setSrcSpanA arg_loc                    $
    
    969
    +                 addErrCtxt (FunAppCtxt (FunAppCtxtExpr fun arg) arg_no) $
    
    970
    +                 thing_inside
    
    971
    +         else updCtxtForArg (L arg_loc arg) $
    
    972
    +                 thing_inside
    
    973
    + }
    
    973 974
       where
    
    974 975
         updCtxtForArg :: LHsExpr GhcRn -> TcRn a -> TcRn a
    
    975 976
         updCtxtForArg e@(L lspan _) thing_inside
    

  • testsuite/tests/rebindable/rebindable6.stderr
    1
    -
    
    2 1
     rebindable6.hs:110:17: error: [GHC-39999]
    
    3 2
         • Ambiguous type variable ‘t0’ arising from a do statement
    
    4 3
           prevents the constraint ‘(HasSeq
    
    5 4
                                       (IO a -> t0 -> IO b))’ from being solved.
    
    6
    -        (maybe you haven't applied a function to enough arguments?)
    
    5
    +      (maybe you haven't applied a function to enough arguments?)
    
    7 6
           Relevant bindings include
    
    8 7
             g :: IO (Maybe b) (bound at rebindable6.hs:108:19)
    
    9 8
             f :: IO a (bound at rebindable6.hs:108:17)
    
    ... ... @@ -28,7 +27,7 @@ rebindable6.hs:111:17: error: [GHC-39999]
    28 27
         • Ambiguous type variables ‘t1’, ‘t0’ arising from a do statement
    
    29 28
           prevents the constraint ‘(HasBind
    
    30 29
                                       (IO (Maybe b) -> (Maybe b -> t1) -> t0))’ from being solved.
    
    31
    -        (maybe you haven't applied a function to enough arguments?)
    
    30
    +      (maybe you haven't applied a function to enough arguments?)
    
    32 31
           Relevant bindings include
    
    33 32
             g :: IO (Maybe b) (bound at rebindable6.hs:108:19)
    
    34 33
             test_do :: IO a -> IO (Maybe b) -> IO b
    
    ... ... @@ -50,9 +49,9 @@ rebindable6.hs:111:17: error: [GHC-39999]
    50 49
                      return b
    
    51 50
     
    
    52 51
     rebindable6.hs:112:17: error: [GHC-39999]
    
    53
    -    • Ambiguous type variable ‘t1’ arising from a use of ‘return’
    
    52
    +    • Ambiguous type variable ‘t1’ arising from a do statement
    
    54 53
           prevents the constraint ‘(HasReturn (b -> t1))’ from being solved.
    
    55
    -        (maybe you haven't applied a function to enough arguments?)
    
    54
    +      (maybe you haven't applied a function to enough arguments?)
    
    56 55
           Relevant bindings include
    
    57 56
             b :: b (bound at rebindable6.hs:111:23)
    
    58 57
             g :: IO (Maybe b) (bound at rebindable6.hs:108:19)
    
    ... ... @@ -71,3 +70,4 @@ rebindable6.hs:112:17: error: [GHC-39999]
    71 70
                 = do f
    
    72 71
                      Just (b :: b) <- g
    
    73 72
                      return b
    
    73
    +