[GHC] #10930: missing empty-Enumeration and out-of-range warning for `Natural`

GHC ghc-devs at haskell.org
Mon Dec 3 12:47:19 UTC 2018


#10930: missing empty-Enumeration and out-of-range warning for `Natural`
-------------------------------------+-------------------------------------
        Reporter:  hvr               |                Owner:  hvr
            Type:  bug               |               Status:  patch
        Priority:  low               |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #7881, #10929     |  Differential Rev(s):  Phab:D1306,
       Wiki Page:                    |  Phab:D5181
-------------------------------------+-------------------------------------

Comment (by Ryan Scott <ryan.gl.scott@…>):

 In [changeset:"75a8349b2a7d0142d3d687837caf5a95bbb4368d/ghc" 75a8349/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="75a8349b2a7d0142d3d687837caf5a95bbb4368d"
 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
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10930#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list