Warn on all out-of-range literals in pats/exprs

Authored by harpocrates on Dec 3 2018, 6:03 AM.

Description

Warn on all out-of-range literals in pats/exprs

Summary:
These changes were motivated by Trac #13256. While poking around, I
realized we weren't very consistent in our "-Woverflowed-literals"
warnings. This patch fixes that by:

  • warning earlier on in the pipeline (ie. before we've desugared 'Int' patterns into 'I# Int#')
  • handling 'HsLit' as well as 'HsOverLit' (this covers unboxed literals)
  • covering more pattern / expression forms

4/6 of the warnings in the 'Overflow' test are due to this patch. The
other two are mostly for completeness.

Also fixed a missing empty-enumeration warning for 'Natural'.

This warnings were tripped up by the 'Bounded Word' instance (see Trac #9505),
but the fix was obvious and simple: use unboxed word literals.

Test Plan: make TEST=Overflow && make TEST=T10930

Reviewers: hvr, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, carter

GHC Trac Issues: Trac #13256, Trac #10930

Differential Revision: https://phabricator.haskell.org/D5181

Details

Committed
RyanGlScottDec 3 2018, 6:03 AM
Reviewer
RyanGlScott
Differential Revision
D5181: Warn on all out-of-range literals in pats/exprs
Parents
rGHC93a3f9070d5d: update (CicleCI) CI script to work with ghc-ci
Branches
Unknown
Tags
Unknown