Opened 2 months ago

Last modified 2 months ago

#14133 new bug

COMPLETE pragmas seem to be ignored when using view patterns

Reported by: jle Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.2.1
Keywords: PatternSynonyms, PatternMatchWarnings Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect error/warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by jle)

{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE PatternSynonyms #-}

pattern I :: Int -> Int
pattern I x <- (id -> x)
{-# COMPLETE I #-}

foo :: Int -> Int
foo (I x) = x + 3

bar :: Int -> Int
bar (id->I x) = x + 3

main :: IO ()
main = return ()

Raises a warning for bar:

Bug.hs:12:1: warning: [-Wincomplete-patterns]
    Pattern match(es) are non-exhaustive
    In an equation for 'bar': Patterns not matched: _
   |
12 | bar (id->I x) = x + 3
   | ^^^^^^^^^^^^^^^^^^^^^^^

but not for foo.

Change History (2)

comment:1 Changed 2 months ago by jle

Description: modified (diff)

comment:2 Changed 2 months ago by RyanGlScott

Keywords: PatternSynonyms PatternMatchWarnings added
Note: See TracTickets for help on using tickets.