[GHC] #8710: Overlapping patterns warning misplaced

GHC ghc-devs at haskell.org
Mon Feb 15 10:00:16 UTC 2016


#8710: Overlapping patterns warning misplaced
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  low               |            Milestone:
       Component:  Compiler          |              Version:  7.7
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1910
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 > If we print a separate warning for every redundant clause it may become
 overwhelming

 Really? There are a few artificial examples in the testsuite, but I'd have
 thought that one error per redundant equation would be ok.

 But still, I'd really like the common case of one redundant equation to
 look like
 {{{
 Bug.hs:24:3: warning:                     -- Note correct line number
     Pattern match(es) are redundant
     In an equation for ‘show’:
         len _     = ... (at Bug.hs:24:3)
 }}}
 Or maybe even
 {{{
 Bug.hs:24:3: warning:
     Pattern match(es) are redundant
     In an equation for ‘show’:
         len _     = ...            -- No need to duplicate here
 }}}
 If there are more than one, then adding the individual locations is good
 {{{
 Bug.hs:24:3: warning:
     Pattern match(es) are redundant
     In an equation for ‘show’:
         len _     = ... (at Bug.hs:24:3)
         len _     = ... (at Bug.hs:25:3)
 }}}
 but the herald should mention the first.

 Can't be hard, I guess.

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


More information about the ghc-tickets mailing list