InScopeSet bug in the Specialiser
There's a bug in already_covered in GHC.Core.Opt.Specialise.specCall:
already_covered :: [CoreRule] -> [CoreExpr] -> Bool
already_covered new_rules args -- Note [Specialisations already covered]
= isJust (specLookupRule env_with_dict_bndrs fn args
(new_rules ++ existing_rules))
The envt env_with_dict_bndrs doesn't have in its in-scope set the free vars of args. To do that we need to pass rhs_env2 (inside spec_call) to already_covered.
Patch coming