
#13965: COMPLETE sets nerf redundant pattern-match warnings -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Keywords: | Operating System: Unknown/Multiple PatternSynonyms, | PatternMatchWarnings | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- If I give redundant patterns for a datatype with a `COMPLETE` set, then GHC doesn't warn me at all. Here's an example: {{{#!hs {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ViewPatterns #-} module Bug (Boolean(F, TooGoodToBeTrue), catchAll) where data Boolean = F | T deriving Eq pattern TooGoodToBeTrue :: Boolean pattern TooGoodToBeTrue <- ((== T) -> True) where TooGoodToBeTrue = T {-# COMPLETE F, TooGoodToBeTrue #-} catchAll :: Boolean -> Int catchAll F = 0 catchAll TooGoodToBeTrue = 1 catchAll F = 2 }}} GHC thinks this is fine and dandy: {{{ $ /opt/ghc/8.2.1/bin/ghci Bug.hs -Wall GHCi, version 8.2.0.20170704: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 1] Compiling Bug ( Bug.hs, interpreted ) Ok, 1 module loaded. }}} This problem also persists across modules: {{{#!hs module Foo where import Bug catchAll2 :: Boolean -> Int catchAll2 F = 0 catchAll2 TooGoodToBeTrue = 1 catchAll2 F = 2 }}} {{{ $ /opt/ghc/8.2.1/bin/ghci Foo.hs -Wall GHCi, version 8.2.0.20170704: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/rgscott/.ghci [1 of 2] Compiling Bug ( Bug.hs, interpreted ) [2 of 2] Compiling Foo ( Foo.hs, interpreted ) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13965 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler