diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2022-06-03 11:36:20 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2022-06-03 11:36:20 +0100 |
commit | 3dfc7abe03d688d6362c011925b73c1d11e3ef88 (patch) | |
tree | 42323fdc8e9a195eece218d794ac8f3a0a6100cc /compiler | |
parent | 9fa790b4b33fe75c86ed7a3032eecd35774eb21e (diff) | |
download | haskell-wip/T21689.tar.gz |
Ensure floated dictionaries are in scope (again)wip/T21689
In the Specialiser, we missed one more call to
bringFloatedDictsIntoScope (see #21391).
This omission led to #21689. The problem is that the call
to `rewriteClassOps` needs to have in scope any dictionaries
floated out of the arguments we have just specialised.
Easy fix.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Core/Opt/Specialise.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/GHC/Core/Opt/Specialise.hs b/compiler/GHC/Core/Opt/Specialise.hs index 74ee8d1f5f..2e18049dd7 100644 --- a/compiler/GHC/Core/Opt/Specialise.hs +++ b/compiler/GHC/Core/Opt/Specialise.hs @@ -1114,7 +1114,10 @@ specExpr env (Tick tickish body) specExpr env expr@(App {}) = do { let (fun_in, args_in) = collectArgs expr ; (args_out, uds_args) <- mapAndCombineSM (specExpr env) args_in - ; let (fun_in', args_out') = rewriteClassOps env fun_in args_out + ; let env_args = env `bringFloatedDictsIntoScope` ud_binds uds_args + -- Some dicts may have floated out of args_in; + -- they should be in scope for rewriteClassOps (#21689) + (fun_in', args_out') = rewriteClassOps env_args fun_in args_out ; (fun_out', uds_fun) <- specExpr env fun_in' ; let uds_call = mkCallUDs env fun_out' args_out' ; return (fun_out' `mkApps` args_out', uds_fun `thenUDs` uds_call `thenUDs` uds_args) } @@ -1488,7 +1491,8 @@ specCalls spec_imp env dict_binds existing_rules calls_for_me fn rhs already_covered :: [CoreRule] -> [CoreExpr] -> Bool already_covered new_rules args -- Note [Specialisations already covered] - = isJust (specLookupRule env fn args (new_rules ++ existing_rules)) + = isJust (specLookupRule env_with_dict_bndrs fn args + (new_rules ++ existing_rules)) -- NB: we look both in the new_rules (generated by this invocation -- of specCalls), and in existing_rules (passed in to specCalls) |