[GHC] #9911: Pattern synonyms with no signatures should yield warnings
#9911: Pattern synonyms with no signatures should yield warnings -------------------------------------+------------------------------------- Reporter: cactus | Owner: cactus Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler (Type | Version: 7.8.3 checker) | Operating System: Keywords: PatternSynonyms | Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: Incorrect Difficulty: Unknown | warning at compile-time Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- When `-fwarn-missing-signatures` is turned on, GHC should emit warnings for pattern synonyms with no signatures -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9911> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9911: Pattern synonyms with no signatures should yield warnings -------------------------------------+------------------------------------- Reporter: cactus | Owner: cactus Type: feature | Status: new request | Milestone: 7.10.1 Priority: normal | Version: 7.8.3 Component: Compiler | Keywords: PatternSynonyms (Type checker) | Architecture: Unknown/Multiple Resolution: | Difficulty: Unknown Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: Incorrect | warning at compile-time | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by cactus): The reason this doesnt Just Work(tm) is that the set of names that need signatures (`sig_names` in `TcRnDriver.tcTopSrcDecls`) is computed from the `HsBind Name`s on the input side (so for a pattern synonym `P`, the set would contain `P` itself), but then when checking against this set, the names from the typechecked bindings are used; so for a pattern synonym `P`, we try to look up `$mP` for the matcher and `$bP` for the builder. Another problem is that even if we would look up `P` (e.g. by changing matcher names to be the original pattern name without the added `$m` prefix), the warning would show the type of the matcher, instead of the pattern synonym type. So all in all, a real solution to this will require using the typechecked pattern synonym itself (a `PatSyn`) when doing the signature check, since that has the correct `Name` and the type. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9911#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9911: Pattern synonyms with no signatures should yield warnings -------------------------------------+------------------------------------- Reporter: cactus | Owner: cactus Type: feature request | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 7.8.3 checker) | Keywords: Resolution: duplicate | PatternSynonyms Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #11053 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => duplicate * related: => #11053 Comment: commit 1883afb2eee88c828adf6aa8014bab64dd6e8096 {{{ Author: Matthew Pickering <matthewtpickering@gmail.com> Date: Sat Dec 12 16:38:07 2015 +0000 Implement -fwarn-missing-pat-syn-sigs This adds a warning when a pattern synonym is not accompanied by a signature in the style of `-fwarn-missing-sigs`. It is turned on by -Wall. If the user specifies, `-fwarn-missing-exported-signatures` with `-fwarn-missing-pat-syn-sigs` then it will only warn when the pattern synonym is exported. Test Plan: ./validate Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1596 GHC Trac Issues: #11053 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9911#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC