Skip to content

Handle shadowing in DmdAnal (#22718)

Sebastian Graf requested to merge wip/T22718 into master

Previously, when we had a shadowing situation like

f x = ... -- demand signature <1L><1L>

main = ... \f -> f 1 ...

we'd happily use the shadowed demand signature at the call site inside the lambda. Of course, that's wrong and solution is simply to remove the demand signature from the AnalEnv when we enter the lambda. This patch does so for all binding constructs Core.

In #22718 (closed) the issue was caused by LetUp not shadowing away the existing demand signature for the let binder in the let body. The resulting absent error is fickle to reproduce; hence no reproduction test case. #17478 would help.

Fixes #22718 (closed).

Merge request reports