diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2018-12-03 07:03:44 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2018-12-03 07:03:44 -0500 |
commit | 75a8349b2a7d0142d3d687837caf5a95bbb4368d (patch) | |
tree | 7a1c14b1ba4357dcc032d2d32a10039b8c3f1cd0 /compiler/prelude | |
parent | 93a3f9070d5d69ad6a28fe94ccccd20c54609698 (diff) | |
download | haskell-75a8349b2a7d0142d3d687837caf5a95bbb4368d.tar.gz |
Warn on all out-of-range literals in pats/exprs
Summary:
These changes were motivated by #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 #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: #13256, #10930
Differential Revision: https://phabricator.haskell.org/D5181
Diffstat (limited to 'compiler/prelude')
-rw-r--r-- | compiler/prelude/TysPrim.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index 10034de650..77ea80eb0b 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -66,17 +66,17 @@ module TysPrim( weakPrimTyCon, mkWeakPrimTy, threadIdPrimTyCon, threadIdPrimTy, - int8PrimTyCon, int8PrimTy, - word8PrimTyCon, word8PrimTy, + int8PrimTyCon, int8PrimTy, int8PrimTyConName, + word8PrimTyCon, word8PrimTy, word8PrimTyConName, - int16PrimTyCon, int16PrimTy, - word16PrimTyCon, word16PrimTy, + int16PrimTyCon, int16PrimTy, int16PrimTyConName, + word16PrimTyCon, word16PrimTy, word16PrimTyConName, - int32PrimTyCon, int32PrimTy, - word32PrimTyCon, word32PrimTy, + int32PrimTyCon, int32PrimTy, int32PrimTyConName, + word32PrimTyCon, word32PrimTy, word32PrimTyConName, - int64PrimTyCon, int64PrimTy, - word64PrimTyCon, word64PrimTy, + int64PrimTyCon, int64PrimTy, int64PrimTyConName, + word64PrimTyCon, word64PrimTy, word64PrimTyConName, eqPrimTyCon, -- ty1 ~# ty2 eqReprPrimTyCon, -- ty1 ~R# ty2 (at role Representational) |