
#12949: Pattern coverage mistake -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: gkaracha Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: | PatternMatchWarnings Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): In case it's helpful, I've come up with a much simpler case: {{{#!hs {-# LANGUAGE ScopedTypeVariables #-} module Exh where class Foo a where foo :: Maybe a data Result a b = Neither | This a | That b | Both a b q :: forall a b . (Foo a, Foo b) => Result a b q = case foo :: Maybe a of Nothing -> case foo :: Maybe b of Nothing -> Neither Just c -> That c Just i -> case foo :: Maybe b of Nothing -> This i Just c -> Both i c }}} This produces the following warnings, both of them incorrect: {{{ Exh.hs:13:20: warning: [-Woverlapping-patterns] Pattern match is redundant In a case alternative: Just c -> ... | 13 | Just c -> That c | ^^^^^^^^^^^^^^^^ Exh.hs:15:20: warning: [-Woverlapping-patterns] Pattern match is redundant In a case alternative: Nothing -> ... | 15 | Nothing -> This i | ^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12949#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler