[Git][ghc/ghc][wip/spj-apporv-Oct24] remove special case of tcbody from tcLambdaMatches
Apoorv Ingle (@ani)
gitlab at gitlab.haskell.org
Mon Mar 10 19:27:25 UTC 2025
Apoorv Ingle pushed to branch wip/spj-apporv-Oct24 at Glasgow Haskell Compiler / GHC
Commits:
55d506d1 by Apoorv Ingle at 2025-03-10T13:49:10-05:00
remove special case of tcbody from tcLambdaMatches
- - - - -
3 changed files:
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Match.hs
Changes:
=====================================
compiler/GHC/Hs/Expr.hs
=====================================
@@ -531,13 +531,6 @@ type instance XXExpr GhcTc = XXExprGhcTc
data HsThingRn = OrigExpr (HsExpr GhcRn) -- ^ The source, user written, expression
| OrigStmt (ExprLStmt GhcRn) HsDoFlavour -- ^ which kind of do-block did this statement come from
-isHsThingRnExpr, isHsThingRnStmt :: HsThingRn -> Bool
-isHsThingRnExpr (OrigExpr{}) = True
-isHsThingRnExpr _ = False
-
-isHsThingRnStmt (OrigStmt{}) = True
-isHsThingRnStmt _ = False
-
data XXExprGhcRn
= ExpandedThingRn { xrn_orig :: HsThingRn -- The original source thing to be used for error messages
, xrn_expanded :: HsExpr GhcRn -- The compiler generated expanded thing
=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -1252,5 +1252,4 @@ addExprCtxt e thing_inside
-- when we don't want to say "In the expression: _",
-- because it is mentioned in the error message itself
HsUnboundVar {} -> thing_inside
- XExpr (ExpandedThingRn {}) -> thing_inside
_ -> addErrCtxt (ExprCtxt e) thing_inside
=====================================
compiler/GHC/Tc/Gen/Match.hs
=====================================
@@ -155,21 +155,13 @@ tcLambdaMatches e lam_variant matches invis_pat_tys res_ty
; (wrapper, r)
<- matchExpectedFunTys herald GenSigCtxt arity res_ty $ \ pat_tys rhs_ty ->
- tcMatches tc_body (invis_pat_tys ++ pat_tys) rhs_ty matches
+ tcMatches tcBody (invis_pat_tys ++ pat_tys) rhs_ty matches
; return (wrapper, r) }
where
herald = ExpectedFunTyLam lam_variant e
-- See Note [Herald for matchExpectedFunTys] in GHC.Tc.Utils.Unify
- tc_body | isDoExpansionGenerated (mg_ext matches)
- -- See Part 3. B. of Note [Expanding HsDo with XXExprGhcRn] in
- -- `GHC.Tc.Gen.Do`. Testcase: Typeable1
- = tcBodyNC -- NB: Do not add any error contexts
- -- It has already been done
- | otherwise
- = tcBody
-
{-
@tcCaseMatches@ doesn't do the argument-count check because the
parser guarantees that each equation has exactly one argument.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/55d506d156a9668411c5d816bc59249ac5b31412
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/55d506d156a9668411c5d816bc59249ac5b31412
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250310/d181c4e9/attachment-0001.html>
More information about the ghc-commits
mailing list