Skip to content

GHC does not warn for mistakenly empty case

{-# LANGUAGE EmptyCase #-}
{-# OPTIONS_GHC -Wall -fwarn-incomplete-uni-patterns #-}

oops :: Int -> a
oops x = case x of {}

Since Int is inhabited, I would expect a warning, but I get none. Since empty case is typically used in situations where programmers want GHC to see an absurdity, this seems most unfortunate.

Trac metadata
Trac field Value
Version 7.10.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information