Opened 5 years ago

Closed 4 years ago

#9911 closed feature request (duplicate)

Pattern synonyms with no signatures should yield warnings

Reported by: cactus Owned by: cactus
Priority: normal Milestone: 8.0.1
Component: Compiler (Type checker) Version: 7.8.3
Keywords: PatternSynonyms Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: #11053 Differential Rev(s):
Wiki Page:


When -fwarn-missing-signatures is turned on, GHC should emit warnings for pattern synonyms with no signatures

Change History (4)

comment:1 Changed 5 years ago 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 Names 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.

comment:2 Changed 5 years ago by thoughtpolice


Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:3 Changed 4 years ago by thoughtpolice


Milestone renamed

comment:4 Changed 4 years ago by thomie

Resolution: duplicate
Status: newclosed

commit 1883afb2eee88c828adf6aa8014bab64dd6e8096

Author: Matthew Pickering <>
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:
    GHC Trac Issues: #11053
Note: See TracTickets for help on using tickets.