[GHC] #9911: Pattern synonyms with no signatures should yield warnings
GHC
ghc-devs at haskell.org
Sat Dec 20 14:03:40 UTC 2014
#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
More information about the ghc-tickets
mailing list