
#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 gkaracha): Replying to [comment:8 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.
Hmmm, true. The number of redundant clauses (and of those with inaccessible RHS) is bound by the number of clauses a match has (it's not the case with the uncovered though). In practice I have not seen matches with many redundant cases. Hence, I created Phab:D1920 too, which implements this approach (one warning per redundant clause, each with its own location).
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.
Agreed on this one too, I have updated Phab:D1910 to behave like this. Merge at will the revision you prefer. :-) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8710#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler