[GHC] #14253: Pattern match checker mistakenly concludes pattern match on pattern synonym is unreachable

GHC ghc-devs at haskell.org
Tue Sep 19 23:25:30 UTC 2017


#14253: Pattern match checker mistakenly concludes pattern match on pattern synonym
is unreachable
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms,
                                     |  PatternMatchWarnings
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * cc: RyanGlScott (added)
 * keywords:   => PatternSynonyms, PatternMatchWarnings


Comment:

 Here is a much simpler way to trigger the issue:

 {{{#!hs
 {-# LANGUAGE PatternSynonyms #-}
 module Test where

 data T = MkT1 | MkT2
 pattern MkT2' = MkT2
 {-# COMPLETE MkT1 #-}

 newtype S = MkS T

 u :: S -> Bool
 u (MkS MkT2') = True
 u _           = False
 }}}

 The fact that `MkT2'` occurs inside of another constructor `MkS` seems to
 be important, since changing `u` to be of type `T -> Bool` and matching
 directly on `MkT2'` in the first case resolves the issue.

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


More information about the ghc-tickets mailing list