[GHC] #14838: missing "incomplete-patterns" warning for TH-generated functions

GHC ghc-devs at haskell.org
Wed Feb 21 23:15:51 UTC 2018


#14838: missing "incomplete-patterns" warning for TH-generated functions
-------------------------------------+-------------------------------------
        Reporter:  gelisam           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.2.2
      Resolution:                    |             Keywords:
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):

 Amazing find. It turns out that this can all be tied back to this line of
 code (introduced in GHC 8.0, in commit
 8a506104d5b5b71d5640afc69c992e0af40f2213):

 {{{#!hs
         ; unless (isGenerated origin) $
           when (isAnyPmCheckEnabled dflags (DsMatchContext ctxt locn)) $
           addTmCsDs (genCaseTmCs1 mb_scr new_vars) $
               -- See Note [Type and Term Equality Propagation]
           checkMatches dflags (DsMatchContext ctxt locn) new_vars matches
 }}}

 Specifically, the `unless (isGenerated origin)` part. It turns out that
 `-Wincomplete-patterns` is completely suppressed for any code that has an
 `Origin` of `Generated`, and Template Haskell–spliced code happens to fall
 under that bucket.

 I see two ways out of this:

 1. Go through the code in `Convert` and change every use of `Generated` to
 `FromSource`.
 2. Come up with a separate origin for Template Haskell code (perhaps
 `FromTH`?). I'm not sure if it's worth the trouble, though.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14838#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list