summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-05-01 14:48:43 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-08 15:29:41 -0400
commit88e3c8150d2b2d96c3ebc0b2942c9af44071c511 (patch)
tree42708941074fc59cf2d51f19c995b2be024fea77 /compiler/GHC/HsToCore
parent7a763cff78d2d4b23d05554e68138678cb4ba627 (diff)
downloadhaskell-88e3c8150d2b2d96c3ebc0b2942c9af44071c511.tar.gz
Fix specialisation for DFuns
When specialising a DFun we must take care to saturate the unfolding. See Note [Specialising DFuns] in Specialise. Fixes #18120
Diffstat (limited to 'compiler/GHC/HsToCore')
-rw-r--r--compiler/GHC/HsToCore/Binds.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/GHC/HsToCore/Binds.hs b/compiler/GHC/HsToCore/Binds.hs
index 1e2494c106..7bd9506ca1 100644
--- a/compiler/GHC/HsToCore/Binds.hs
+++ b/compiler/GHC/HsToCore/Binds.hs
@@ -693,20 +693,19 @@ dsSpec mb_poly_rhs (L loc (SpecPrag poly_id spec_co spec_inl))
dflags <- getDynFlags
; case decomposeRuleLhs dflags spec_bndrs ds_lhs of {
Left msg -> do { warnDs NoReason msg; return Nothing } ;
- Right (rule_bndrs, _fn, args) -> do
+ Right (rule_bndrs, _fn, rule_lhs_args) -> do
{ this_mod <- getModule
; let fn_unf = realIdUnfolding poly_id
- spec_unf = specUnfolding dflags poly_id spec_bndrs core_app arity_decrease fn_unf
+ spec_unf = specUnfolding dflags spec_bndrs core_app rule_lhs_args fn_unf
spec_id = mkLocalId spec_name spec_ty
`setInlinePragma` inl_prag
`setIdUnfolding` spec_unf
- arity_decrease = count isValArg args - count isId spec_bndrs
; rule <- dsMkUserRule this_mod is_local_id
(mkFastString ("SPEC " ++ showPpr dflags poly_name))
rule_act poly_name
- rule_bndrs args
+ rule_bndrs rule_lhs_args
(mkVarApps (Var spec_id) spec_bndrs)
; let spec_rhs = mkLams spec_bndrs (core_app poly_rhs)