Skip to content

Fix linear Lint handling of DEFAULT clauses (#23025)

Krzysztof Gogolewski requested to merge wip/T23025 into master

In this correct program

f :: a %1 -> a
f x = case x of x { _DEFAULT -> x }

after checking the alternative we weren't popping the case binder 'x' from the usage environment, which meant that the lambda-bound 'x' was counted twice: in the scrutinee and (incorrectly) in the alternative.

In fact, we weren't checking the usage of 'x' at all.

Now the code for handling _DEFAULT is similar to the one handling data constructors.

Fixes #23025 (closed).

Edited by Krzysztof Gogolewski

Merge request reports