[Git][ghc/ghc][wip/spj-apporv-Oct24] accept a test case. Remove HsPar as a special case from add_expr_ctxt
Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC Commits: ac1c8658 by Apoorv Ingle at 2025-11-25T16:57:11-06:00 accept a test case. Remove HsPar as a special case from add_expr_ctxt - - - - - 3 changed files: - compiler/GHC/Tc/Gen/Head.hs - compiler/GHC/Tc/Gen/Match.hs - testsuite/tests/indexed-types/should_fail/T1897b.stderr Changes: ===================================== compiler/GHC/Tc/Gen/Head.hs ===================================== @@ -1091,14 +1091,8 @@ add_expr_ctxt e thing_inside -- when we don't want to say "In the expression: _", -- because it is mentioned in the error message itself - HsPar{} -> thing_inside - -- We don't want to say 'In the expression (e)', - -- we just want to say 'In the expression, 'e' - -- which will be handeled by the recursive call in thing_inside - ExprWithTySig _ (L _ e') _ - | XExpr (ExpandedThingRn o _) <- e' -> addExpansionErrCtxt o (ExprCtxt e) - thing_inside + | XExpr (ExpandedThingRn o _) <- e' -> addExpansionErrCtxt o (ExprCtxt e) thing_inside -- There is a special case for expressions with signatures to avoid having too verbose -- error context. So here we flip the ErrCtxt state to expanded if the expression is expanded. -- c.f. RecordDotSyntaxFail9 ===================================== compiler/GHC/Tc/Gen/Match.hs ===================================== @@ -426,7 +426,7 @@ tcBody (L lspan e) res_ty ; setSrcSpanA lspan $ addErrCtxt (ExprCtxt e) $ -- We want the right hand side of a match or an equation - -- to always get printed + -- to always get printed in the error context tcPolyExpr e res_ty } ===================================== testsuite/tests/indexed-types/should_fail/T1897b.stderr ===================================== @@ -1,14 +1,14 @@ T1897b.hs:16:1: error: [GHC-83865] - • Couldn't match type: Depend b0 - with: Depend b - Expected: t (Depend b) -> Bool - Actual: t (Depend b0) -> Bool + • Couldn't match type: Depend a0 + with: Depend a + Expected: t (Depend a) -> Bool + Actual: t (Depend a0) -> Bool Note: ‘Depend’ is a non-injective type family. - The type variable ‘b0’ is ambiguous + The type variable ‘a0’ is ambiguous • In the ambiguity check for the inferred type for ‘isValid’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes When checking the inferred type - isValid :: forall {t :: * -> *} {b}. - (Foldable t, Bug b) => - t (Depend b) -> Bool + isValid :: forall {t :: * -> *} {a}. + (Foldable t, Bug a) => + t (Depend a) -> Bool View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ac1c86588be8d88f4fe08c5209605558... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/ac1c86588be8d88f4fe08c5209605558... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Apoorv Ingle (@ani)