[GHC] #11474: incorrect redundant-constraints warning

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 (Type checker) | Keywords: | 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): | Wiki Page: -------------------------------------+------------------------------------- The following code when compiled with GHC 8 {{{#!hs {-# LANGUAGE Haskell2010, FunctionalDependencies, KindSignatures, ScopedTypeVariables, TypeOperators, UndecidableInstances #-} import GHC.Generics data Options data Value newtype Tagged s b = Tagged {unTagged :: b} class GToJSON f where gToJSON :: Options -> f a -> Value class SumToJSON f allNullary where sumToJSON :: Options -> f a -> Tagged allNullary Value class AllNullary (f :: * -> *) allNullary | f -> allNullary instance ( AllNullary (a :+: b) allNullary, -- <- removing this line causes a compile error SumToJSON (a :+: b) allNullary ) => GToJSON (a :+: b) where gToJSON opts = (unTagged :: Tagged allNullary Value -> Value) . sumToJSON opts }}} emits a warning {{{ bug.hs:19:10: warning: • Redundant constraint: AllNullary (a :+: b) allNullary • In the instance declaration for ‘GToJSON (a :+: b)’ }}} when commenting out the `AllNullary` constraint, this however results the compile error {{{ bug.hs:19:10: error: • Could not deduce (SumToJSON (a :+: b) allNullary0) from the context: SumToJSON (a :+: b) allNullary bound by an instance declaration: SumToJSON (a :+: b) allNullary => GToJSON (a :+: b) at redconstr.hs:(19,10)-(22,24) The type variable ‘allNullary0’ is ambiguous • In the ambiguity check for an instance declaration To defer the ambiguity check to use sites, enable AllowAmbiguousTypes In the instance declaration for ‘GToJSON (a :+: b)’ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: 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): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Good point. Indeed the evidence for `AllNullary` is not used, but its functional dependencies are. I don't know how to reliably detect that. I suppose I could not warn if the class has functional dependencies. (Or maybe if any of its superclasses, transititively, do?) Meanwhile I think we've agreed that this warning will be off by default for 8.0 so you won't see it anyway. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: 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): Wiki Page: | -------------------------------------+------------------------------------- Changes (by asr): * cc: asr (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: 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): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * priority: highest => normal * milestone: 8.0.1 => 8.2.1 Comment: Given that this warning is now disabled by default I'm reducing priority and bumping off to 8.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | tests/typecheck/should_compile/T11474.hs Blocked By: | Blocking: Related Tickets: #10100 | Differential Rev(s): Phab:D4739 Wiki Page: | -------------------------------------+------------------------------------- Changes (by sighingnow): * status: new => patch * testcase: => tests/typecheck/should_compile/T11474.hs * differential: => Phab:D4739 * related: => #10100 Comment: This is indeed a duplicate of #10100, which was fixed in 10fab31211961c9200d230556ec7742e07a6c831. However 6eabb6ddb7c53784792ee26b1e0657bde7eee7fb introduced this regression. Now Phab:D4739 should fix this ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.8.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | tests/typecheck/should_compile/T11474.hs Blocked By: | Blocking: Related Tickets: #10100 | Differential Rev(s): Phab:D4739 Wiki Page: | -------------------------------------+------------------------------------- Comment (by alpmestan): AFAICT, the patch from D4739 looks ready, any objection to merging (for 8.8 I suppose) and calling this bug resolved? :-) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.8.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | tests/typecheck/should_compile/T11474.hs Blocked By: | Blocking: Related Tickets: #10100 | Differential Rev(s): Phab:D4739 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj):
AFAICT, the patch from D4739 looks ready, any objection to merging (for 8.8 I suppose) and calling this bug resolved? :-)
Good point. I think I see an easier way... stay tuned -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.8.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | tests/typecheck/should_compile/T11474.hs Blocked By: | Blocking: Related Tickets: #10100 | Differential Rev(s): Phab:D4739 Wiki Page: | -------------------------------------+------------------------------------- Changes (by alpmestan): * cc: alpmestan (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning
-------------------------------------+-------------------------------------
Reporter: hvr | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone: 8.8.1
Component: Compiler (Type | Version: 8.0.1-rc1
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Incorrect | Test Case:
warning at compile-time | tests/typecheck/should_compile/T11474.hs
Blocked By: | Blocking:
Related Tickets: #10100 | Differential Rev(s): Phab:D4739
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.8.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | tests/typecheck/should_compile/T11474.hs Blocked By: | Blocking: Related Tickets: #10100 | Differential Rev(s): Phab:D4739 Wiki Page: | -------------------------------------+------------------------------------- Changes (by alpmestan): * status: patch => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.8.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | tests/typecheck/should_compile/T11474.hs Blocked By: | Blocking: Related Tickets: #10100 | Differential Rev(s): Phab:D4739 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): OK done. Follows the idea of the patch, but with less code. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | tests/typecheck/should_compile/T11474.hs Blocked By: | Blocking: Related Tickets: #10100 | Differential Rev(s): Phab:D4739 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * milestone: 8.8.1 => 8.6.1 Comment: This was marked as merge, but not milestoned properly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11474: incorrect redundant-constraints warning -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.6.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect | Test Case: warning at compile-time | tests/typecheck/should_compile/T11474.hs Blocked By: | Blocking: Related Tickets: #10100 | Differential Rev(s): Phab:D4739 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged in 02829747cdf72fe83e511232cef12cd01df5dce6. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11474#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC