OverloadedLists disables -Woverflowed-literals for values above maxBound
Summary
OverloadedLists
disables -Woverflowed-literals
for values above maxBound
.
Steps to reproduce
In a new ghci
session:
> [-1] :: [Data.Word.Word8]
<interactive>:1:3: warning: [-Woverflowed-literals]
Literal -1 is out of the GHC.Word.Word8 range 0..255
[255]
> [256] :: [Data.Word.Word8]
<interactive>:2:2: warning: [-Woverflowed-literals]
Literal 256 is out of the GHC.Word.Word8 range 0..255
[0]
So far so good. But once we enable OverloadedLists
the second warning misteriously disappears:
> :set -XOverloadedLists
> [-1] :: [Data.Word.Word8]
<interactive>:4:3: warning: [-Woverflowed-literals]
Literal -1 is out of the GHC.Word.Word8 range 0..255
[255]
> [256] :: [Data.Word.Word8]
[0]
Expected behavior
I expected to receive warning: [-Woverflowed-literals] Literal 256 is out of the GHC.Word.Word8 range 0..255
, even when OverloadedLists
are enabled.
Environment
- GHC version used: 8.10.1
Optional:
- Operating System: macOS 10.15.2
- System Architecture: darwin