#1347: warning message could be more helpful
-----------------------+----------------------------------------------------
  Reporter:  guest     |          Owner:         
      Type:  bug       |         Status:  new    
  Priority:  normal    |      Milestone:         
 Component:  Compiler  |        Version:  6.6.1  
  Severity:  normal    |       Keywords:         
Difficulty:  Unknown   |             Os:  Unknown
  Testcase:            |   Architecture:  Unknown
-----------------------+----------------------------------------------------
Code was:
 {{{
 case msg of
     wM_DESTROY -> do
         sendMessage hwnd wM_QUIT 1 0
         return 0
     otherwise -> defWindowProc (Just hwnd) msg wparam lparam
 }}}

 warning message was:

 {{{
 Warning: Pattern match(es) are overlapped
          In a case alternative: otherwise -> ...
 }}}

 It took me a long time to realize that wM_DESTROY was being interpreted as
 a new variable name shadowing the imported constant.  The compiler
 realizes that something is probably wrong (overlapped patterns).  It could
 further check and see that wM_DESTROY is shadowing an already existing
 binding and give a messages like this:

 {{{
 Warning: Pattern match(es) are overlapped
          In a case alternative: otherwise -> ...
          Hint: Are you sure you want to shadow the existing binding for
 wM_DESTROY?
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1347>
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