#5728: Warnings from -fwarn-incomplete-record-updates even with all constructors
matched
-----------------------------------------------+----------------------------
 Reporter:  mjo                                |          Owner:                
  
     Type:  bug                                |         Status:  new           
  
 Priority:  normal                             |      Component:  Compiler      
  
  Version:  7.2.1                              |       Keywords:                
  
       Os:  Unknown/Multiple                   |   Architecture:  
Unknown/Multiple
  Failure:  Incorrect warning at compile-time  |       Testcase:                
  
Blockedby:                                     |       Blocking:                
  
  Related:                                     |  
-----------------------------------------------+----------------------------
 I don't think that the following should be considered an incomplete record
 update, since I match on the other constructor before the record update:

 {{{
 data Foo = None | Bar { baz :: Int }

 quux :: Foo -> Foo
 quux None = None
 quux x = x { baz = 2 }

 main :: IO ()
 main = return ()
 }}}

 But it still throws a warning:

 {{{
 $ ghc -fwarn-incomplete-record-updates test.hs
 [1 of 1] Compiling Main             ( test.hs, test.o )

 test.hs:6:10:
     Warning: Pattern match(es) are non-exhaustive
              In a record-update construct: Patterns not matched: None
 Linking test ...
 }}}

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to