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

Commits:

3 changed files:

Changes:

  • compiler/GHC/Tc/Gen/Head.hs
    ... ... @@ -1091,14 +1091,8 @@ add_expr_ctxt e thing_inside
    1091 1091
        -- when we don't want to say "In the expression: _",
    
    1092 1092
        -- because it is mentioned in the error message itself
    
    1093 1093
     
    
    1094
    -      HsPar{} -> thing_inside
    
    1095
    -   -- We don't want to say 'In the expression (e)',
    
    1096
    -   -- we just want to say 'In the expression, 'e'
    
    1097
    -   -- which will be handeled by the recursive call in thing_inside
    
    1098
    -
    
    1099 1094
           ExprWithTySig _ (L _ e') _
    
    1100
    -        | XExpr (ExpandedThingRn o _) <- e' -> addExpansionErrCtxt o (ExprCtxt e)
    
    1101
    -                                                  thing_inside
    
    1095
    +        | XExpr (ExpandedThingRn o _) <- e' -> addExpansionErrCtxt o (ExprCtxt e) thing_inside
    
    1102 1096
        -- There is a special case for expressions with signatures to avoid having too verbose
    
    1103 1097
        -- error context. So here we flip the ErrCtxt state to expanded if the expression is expanded.
    
    1104 1098
        -- c.f. RecordDotSyntaxFail9
    

  • compiler/GHC/Tc/Gen/Match.hs
    ... ... @@ -426,7 +426,7 @@ tcBody (L lspan e) res_ty
    426 426
               ; setSrcSpanA lspan $
    
    427 427
                   addErrCtxt (ExprCtxt e) $
    
    428 428
                    -- We want the right hand side of a match or an equation
    
    429
    -               -- to always get printed
    
    429
    +               -- to always get printed in the error context
    
    430 430
                   tcPolyExpr e res_ty
    
    431 431
               }
    
    432 432
     
    

  • testsuite/tests/indexed-types/should_fail/T1897b.stderr
    1 1
     T1897b.hs:16:1: error: [GHC-83865]
    
    2
    -    • Couldn't match type: Depend b0
    
    3
    -                     with: Depend b
    
    4
    -      Expected: t (Depend b) -> Bool
    
    5
    -        Actual: t (Depend b0) -> Bool
    
    2
    +    • Couldn't match type: Depend a0
    
    3
    +                     with: Depend a
    
    4
    +      Expected: t (Depend a) -> Bool
    
    5
    +        Actual: t (Depend a0) -> Bool
    
    6 6
           Note: ‘Depend’ is a non-injective type family.
    
    7
    -      The type variable ‘b0’ is ambiguous
    
    7
    +      The type variable ‘a0’ is ambiguous
    
    8 8
         • In the ambiguity check for the inferred type for ‘isValid’
    
    9 9
           To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
    
    10 10
           When checking the inferred type
    
    11
    -        isValid :: forall {t :: * -> *} {b}.
    
    12
    -                   (Foldable t, Bug b) =>
    
    13
    -                   t (Depend b) -> Bool
    
    11
    +        isValid :: forall {t :: * -> *} {a}.
    
    12
    +                   (Foldable t, Bug a) =>
    
    13
    +                   t (Depend a) -> Bool
    
    14 14