[GHC] #13717: Pattern synonym exhaustiveness checks don't play well with EmptyCase
GHC
ghc-devs at haskell.org
Thu May 18 15:54:40 UTC 2017
#13717: Pattern synonym exhaustiveness checks don't play well with EmptyCase
-------------------------------------+-------------------------------------
Reporter: dfeuer | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.4.1
Component: Compiler | Version: 8.2.1-rc1
Resolution: | Keywords:
| PatternSynonyms,
| PatternMatchWarnings
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):
I tried to reproduce this error, but I couldn't. I don't know what
implementations for `FZ` and `FS` you had in mind, so I tried whipping up
my own example from scratch:
{{{#!hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# OPTIONS_GHC -Wall #-}
module T (T(TInt, TBool), tCharAbsurd1) where
import Data.Void
data T a where
MkTInt :: T Int
MkTBool :: T Bool
pattern TInt :: () => n ~ Int => T n
pattern TInt = MkTInt
pattern TBool :: () => n ~ Bool => T n
pattern TBool = MkTBool
{-# COMPLETE TInt, TBool #-}
tCharAbsurd1 :: T Char -> Void
tCharAbsurd1 x = case x of {}
}}}
This, however, compiles without any warnings. I even tried using `T` in
another module:
{{{#!hs
{-# LANGUAGE EmptyCase #-}
{-# OPTIONS_GHC -Wall #-}
module Bug where
import Data.Void
import T
tCharAbsurd2 :: T Char -> Void
tCharAbsurd2 x = case x of {}
}}}
This too compiles without warning:
{{{
$ ghc/inplace/bin/ghc-stage2 --interactive Bug.hs
GHCi, version 8.3.20170516: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 2] Compiling T ( T.hs, interpreted )
[2 of 2] Compiling Bug ( Bug.hs, interpreted )
Ok, modules loaded: Bug, T.
}}}
How did you get this supposed pattern coverage warning?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13717#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list