diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2021-07-16 11:57:41 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-27 12:02:25 -0400 |
commit | 0c4a0c3ba11db852d4d99bcff5162dae76c382d1 (patch) | |
tree | a671da20c84c789209286575b9f6bc18c2f1f19a /compiler/GHC/Tc/Gen/Arrow.hs | |
parent | 7b0ceafbc7f20ed1b53952bae90403cb4f08feda (diff) | |
download | haskell-0c4a0c3ba11db852d4d99bcff5162dae76c382d1.tar.gz |
Make CallStacks work better with RebindableSyntax
As #19918 pointed out, the CallStack mechanism didn't work well with
RebindableSyntax.
This patch improves matters. See GHC.Tc.Types.Evidence
Note [Overview of implicit CallStacks]
* New predicate isPushCallStackOrigin distinguishes when a CallStack
constraint should be solved "directly" or by pushing an item on the
stack.
* The constructor EvCsPushCall now has a FastString, which can
describe not only a function call site, but also things like
"the literal 42" or "an if-then-else expression".
* I also fixed #20126 thus:
exprCtOrigin (HsIf {}) = IfThenElseOrigin
(Previously it was "can't happen".)
Diffstat (limited to 'compiler/GHC/Tc/Gen/Arrow.hs')
-rw-r--r-- | compiler/GHC/Tc/Gen/Arrow.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/GHC/Tc/Gen/Arrow.hs b/compiler/GHC/Tc/Gen/Arrow.hs index d04944661d..e898b74be5 100644 --- a/compiler/GHC/Tc/Gen/Arrow.hs +++ b/compiler/GHC/Tc/Gen/Arrow.hs @@ -185,10 +185,10 @@ tc_cmd env (HsCmdIf x fun@(SyntaxExprRn {}) pred b1 b2) res_ty -- Rebindable syn ; let r_ty = mkTyVarTy r_tv ; checkTc (not (r_tv `elemVarSet` tyCoVarsOfType pred_ty)) (TcRnUnknownMessage $ mkPlainError noHints $ text "Predicate type of `ifThenElse' depends on result type") - ; (pred', fun') - <- tcSyntaxOp IfOrigin fun (map synKnownType [pred_ty, r_ty, r_ty]) - (mkCheckExpType r_ty) $ \ _ _ -> - tcCheckMonoExpr pred pred_ty + ; (pred', fun') <- tcSyntaxOp IfThenElseOrigin fun + (map synKnownType [pred_ty, r_ty, r_ty]) + (mkCheckExpType r_ty) $ \ _ _ -> + tcCheckMonoExpr pred pred_ty ; b1' <- tcCmd env b1 res_ty ; b2' <- tcCmd env b2 res_ty |