[GHC] #13651: Invalid redundant pattern matches with -XTypeFamilyDependencies

#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Keywords: | Operating System: Unknown/Multiple InjectiveFamilies | Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following code triggers a warning about a redundant pattern match for `foo`: {{{ {-# LANGUAGE TypeFamilies, TypeFamilyDependencies #-} type family F r s = f | f -> r s type instance F (Bar h (Foo r)) (Bar h (Foo s)) = Bar h (Bar r s) data Bar s b data Foo a foo :: (F cr cu ~ Bar h (Bar r u), F cu cs ~ Bar (Foo h) (Bar u s)) => Bar h (Bar r u) -> Bar (Foo h) (Bar u s) -> Foo (cr -> cs) foo = undefined }}} {{{ warning: [-Woverlapping-patterns] Pattern match is redundant In an equation for ‘foo’: foo = .. }}} This warning seems invalid to me: I'm not sure how a single definition could constitute a redundant pattern match. Moreover, if I try to address the warning by removing the "redundant" pattern, the code (of course) fails to compile because there is no accompanying binding for the signature of `foo`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13651 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: | InjectiveFamilies 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 RyanGlScott): This appears to be fixed in GHC 8.2.1, although I don't recall what commit fixed it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13651#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: | InjectiveFamilies 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: | -------------------------------------+------------------------------------- Changes (by Iceland_jack): * cc: Iceland_jack (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13651#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: | InjectiveFamilies 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 simonpj): Terrific -- worth a regression test? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13651#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: | InjectiveFamilies 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 mpickering): I think it was this commit that changed this behaviour. https://phabricator.haskell.org/rGHCadb565aa74582969bbcc3b411d6d518b1c76c3cf -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13651#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: | InjectiveFamilies 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 RyanGlScott): As it turns out, that's not the full story. The first commit in which the program in this ticket compiled without warnings was eb55ec2941239dee05afc6be818b129efe51660e (Refactor functional dependencies a bit). Commit adb565aa74582969bbcc3b411d6d518b1c76c3cf, on the other hand, did squash needless pattern-match warnings in some other, similar programs, such as this one: {{{#!hs {-# LANGUAGE TypeFamilies #-} module Bug2 where foo :: Int ~ Bool => a -> a foo x = x }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13651#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies
-------------------------------------+-------------------------------------
Reporter: crockeea | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Resolution: | Keywords:
| InjectiveFamilies
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 Ryan Scott

#13651: Invalid redundant pattern matches with -XTypeFamilyDependencies -------------------------------------+------------------------------------- Reporter: crockeea | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.2 Resolution: fixed | Keywords: | InjectiveFamilies Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: error/warning at compile-time | typecheck/should_compile/T13651 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * testcase: => typecheck/should_compile/T13651 * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13651#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC