summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore/Pmc/Solver.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simon.peytonjones@gmail.com>2023-01-26 15:35:41 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-30 21:20:35 -0500
commitd0f34f25ceaae9ef0a21f15f811469d0bed9da69 (patch)
treec42d57f585cef54e0a9e2a52956d45eadb949ade /compiler/GHC/HsToCore/Pmc/Solver.hs
parent2f1450521b816a7d287b72deba14d59b6ccfbdbf (diff)
downloadhaskell-d0f34f25ceaae9ef0a21f15f811469d0bed9da69.tar.gz
Take account of loop breakers in specLookupRule
The key change is that in GHC.Core.Opt.Specialise.specLookupRule we were using realIdUnfolding, which ignores the loop-breaker flag. When given a loop breaker, rule matching therefore looped infinitely -- #22802. In fixing this I refactored a bit. * Define GHC.Core.InScopeEnv as a data type, and use it. (Previously it was a pair: hard to grep for.) * Put several functions returning an IdUnfoldingFun into GHC.Types.Id, namely idUnfolding alwaysActiveUnfoldingFun, whenActiveUnfoldingFun, noUnfoldingFun and use them. (The are all loop-breaker aware.)
Diffstat (limited to 'compiler/GHC/HsToCore/Pmc/Solver.hs')
-rw-r--r--compiler/GHC/HsToCore/Pmc/Solver.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/GHC/HsToCore/Pmc/Solver.hs b/compiler/GHC/HsToCore/Pmc/Solver.hs
index b70c868c2f..07176b87cc 100644
--- a/compiler/GHC/HsToCore/Pmc/Solver.hs
+++ b/compiler/GHC/HsToCore/Pmc/Solver.hs
@@ -881,7 +881,7 @@ addCoreCt nabla x e = do
where
expr_ty = exprType e
expr_in_scope = mkInScopeSet (exprFreeVars e)
- in_scope_env = (expr_in_scope, const NoUnfolding)
+ in_scope_env = ISE expr_in_scope noUnfoldingFun
-- It's inconvenient to get hold of a global in-scope set
-- here, but it'll only be needed if exprIsConApp_maybe ends
-- up substituting inside a forall or lambda (i.e. seldom)