Opened 4 years ago

Last modified 4 years ago

#11253 new bug

Duplicate warnings for pattern guards and relevant features (e.g. View Patterns)

Reported by: gkaracha Owned by: gkaracha
Priority: normal Milestone:
Component: Compiler Version: 7.11
Keywords: pattern matching, exhaustiveness, pattern checker, PatternMatchWarnings Cc: gkaracha
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: #595 Differential Rev(s):
Wiki Page: PatternMatchCheck, PatternMatchCheckImplementation

Description (last modified by gkaracha)

There are some cases where the new exhaustiveness checker emits duplicate warnings. E.g. for f:

f :: Bool -> Bool -> ()
f (not -> True) (not -> False) = ()

we get:

DuplicateWarn.hs:6:1: warning:
    Pattern match(es) are non-exhaustive
    In an equation for ‘f’:
        Patterns not matched:
            _ _     -- represents (not -> False) _
            _ _     -- represents (not -> True)  (not -> True)

As indicated in the comments, the two warnings represent different missing cases, but since we do not print the additional information, they look alike. It would be better to either:

  • Give additional information to the user to distinguish between the two or
  • Print a single warning (_ _)

I cannot think of a nice solution to this yet but I will keep thinking about it.

Attachments (1)

DuplicateWarn.hs (193 bytes) - added by gkaracha 4 years ago.

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by gkaracha

Attachment: DuplicateWarn.hs added

comment:1 Changed 4 years ago by gkaracha

Description: modified (diff)

comment:2 Changed 4 years ago by bgamari

Keywords: checker added

comment:3 Changed 4 years ago by simonpj

Keywords: PatternMatchWarnings added
Note: See TracTickets for help on using tickets.