summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2022-08-25 15:43:56 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-29 04:18:57 -0400
commitcbe51ac5e0bbe2667b6c7204ae62a534a9bc7c95 (patch)
tree3d21c9302ca6a0c0603dea875498045bdd66bebc /compiler
parent68e6786f3d1bde5d044a649462cdf2b6034a2df8 (diff)
downloadhaskell-cbe51ac5e0bbe2667b6c7204ae62a534a9bc7c95.tar.gz
Fix a bug in anyInRnEnvR
This bug was a subtle error in anyInRnEnvR, introduced by commit d4d3fe6e02c0eb2117dbbc9df72ae394edf50f06 Author: Andreas Klebinger <klebinger.andreas@gmx.at> Date: Sat Jul 9 01:19:52 2022 +0200 Rule matching: Don't compute the FVs if we don't look at them. The net result was #22028, where a rewrite rule would wrongly match on a lambda. The fix to that function is easy.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Types/Var/Env.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/GHC/Types/Var/Env.hs b/compiler/GHC/Types/Var/Env.hs
index 88337b9e9d..88f27af415 100644
--- a/compiler/GHC/Types/Var/Env.hs
+++ b/compiler/GHC/Types/Var/Env.hs
@@ -9,7 +9,7 @@ module GHC.Types.Var.Env (
-- ** Manipulating these environments
emptyVarEnv, unitVarEnv, mkVarEnv, mkVarEnv_Directly,
- elemVarEnv, disjointVarEnv,
+ elemVarEnv, disjointVarEnv, anyVarEnv,
extendVarEnv, extendVarEnv_C, extendVarEnv_Acc,
extendVarEnvList,
plusVarEnv, plusVarEnv_C, plusVarEnv_CD, plusMaybeVarEnv_C,
@@ -62,7 +62,8 @@ module GHC.Types.Var.Env (
-- ** Operations on RnEnv2s
mkRnEnv2, rnBndr2, rnBndrs2, rnBndr2_var,
- rnOccL, rnOccR, inRnEnvL, inRnEnvR, rnOccL_maybe, rnOccR_maybe,
+ rnOccL, rnOccR, inRnEnvL, inRnEnvR, anyInRnEnvR,
+ rnOccL_maybe, rnOccR_maybe,
rnBndrL, rnBndrR, nukeRnEnvL, nukeRnEnvR, rnSwap,
delBndrL, delBndrR, delBndrsL, delBndrsR,
extendRnInScopeSetList,
@@ -72,7 +73,7 @@ module GHC.Types.Var.Env (
-- * TidyEnv and its operation
TidyEnv,
- emptyTidyEnv, mkEmptyTidyEnv, delTidyEnvList, anyInRnEnvR
+ emptyTidyEnv, mkEmptyTidyEnv, delTidyEnvList
) where
import GHC.Prelude
@@ -409,7 +410,7 @@ anyInRnEnvR :: RnEnv2 -> VarSet -> Bool
anyInRnEnvR (RV2 { envR = env }) vs
-- Avoid allocating the predicate if we deal with an empty env.
| isEmptyVarEnv env = False
- | otherwise = anyVarEnv (`elemVarSet` vs) env
+ | otherwise = anyVarSet (`elemVarEnv` env) vs
lookupRnInScope :: RnEnv2 -> Var -> Var
lookupRnInScope env v = lookupInScope (in_scope env) v `orElse` v