Simplifier: `countValArgs` counts type args
As I got aware of in !10088 (comment 486696), this is the current definition (at least since Sep 22) of GHC.Core.Opt.Simplify.Utils.countValARgs
:
countValArgs :: SimplCont -> Int
-- Count value arguments only
countValArgs (ApplyToTy { sc_cont = cont }) = 1 + countValArgs cont --- UH OH
countValArgs (ApplyToVal { sc_cont = cont }) = 1 + countValArgs cont
countValArgs (CastIt _ cont) = countValArgs cont
countValArgs _ = 0
The first clause should not increment the count. Fortunately it is only used in mkArgInfo
, but it could still have detrimental effect.
This means we potentially mis-optimise a few programs. The fix is simple and should be easy to backport.