Draft: Improve Lint check for empty case alternatives
See #22439.
This MR is relatively ambitious. Given case e of {}
, Lint checks that either
-
e
has an empty type (seeisEmptyTy
), or -
e
is known to diverge
This would be easy to defeat. E.g. you could transform
case (error "urk") of {}
===>
(\x. case x of {}) (error "urk")
and the latter would trigger the above Lint error. But the latter program is not actually wrong -- it's just harder to see that the empty case is truly inaccessible.
But in fact it turns out, I think, that no transformation introduces a situation in which inaccessibility is concealed. This patch explores that possiblity.
It bootstraps GHC and survives the testsuite, so it's looking good.
I invite
- Reviews
- Can someone try it on head.hackage?
Thanks!