[GHC] #15886: Spurious warning about incomplete pattern with PatternSynonyms

GHC ghc-devs at haskell.org
Sat Nov 10 04:26:11 UTC 2018


#15886: Spurious warning about incomplete pattern with PatternSynonyms
-------------------------------------+-------------------------------------
           Reporter:  selinger       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.3
          Component:  Compiler       |           Version:  8.6.1
           Keywords:                 |  Operating System:  Linux
       Architecture:  x86_64         |   Type of failure:  Incorrect
  (amd64)                            |  error/warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE ViewPatterns #-}
 {-# LANGUAGE PatternSynonyms #-}

 module Test where

 f :: Int -> Bool
 f (id -> a) = True

 pattern X a <- (id -> a)

 g :: Int -> Bool
 g (X a) = True
 }}}

 When compiling with -Wincomplete-patterns, this code produces an
 (incorrect) warning for `g`, but not for `f`. The only difference is that
 `g` uses a pattern synonym.

 {{{
 K.hs:12:1: warning: [-Wincomplete-patterns]
     Pattern match(es) are non-exhaustive
     In an equation for ā€˜gā€™: Patterns not matched: _
    |
 12 | g (X a) = True
    | ^^^^^^^^^^^^^^
 }}}

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


More information about the ghc-tickets mailing list