Skip to content

Incomplete pattern for tuples with COMPLETE pragma

Summary

Pattern matching in a case statement on a tuple with a COMPLETE pattern does not generate incomplete pattern warnings.

Steps to reproduce

Here's a small example program: this will compile fine.

{-# LANGUAGE PatternSynonyms #-}
{-# OPTIONS_GHC -Wincomplete-patterns -Werror #-}

incomplete :: Maybe a -> Bool
incomplete ma = case (ma, ()) of
  (Nothing, _) -> False

{-# COMPLETE Pat #-}
pattern Pat :: a -> b -> (a, b)
pattern Pat a b = (a, b)

main :: IO ()
main = print $ incomplete (Just ())

Expected behavior

Generate an incomplete pattern warning (or error, in this case)

Environment

GHC version used: 8.6.4, 8.8.2

This actually appears to be fixed in GHC HEAD, but I can't find an issue for it.

Edited by Tom Smalley
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information