#4477: GHC silently accepts bang patterns in outermost position
---------------------------------+------------------------------------------
    Reporter:  dons              |       Owner:                             
        Type:  bug               |      Status:  new                        
    Priority:  normal            |   Component:  Compiler (Parser)          
     Version:  7.0.1 RC1         |    Keywords:                             
    Testcase:                    |   Blockedby:                             
          Os:  Unknown/Multiple  |    Blocking:                             
Architecture:  Unknown/Multiple  |     Failure:  GHC accepts invalid program
---------------------------------+------------------------------------------
 GHC 6.8, 6.12, 7.0 at least accept bang patterns on the outside of
 patterns silently.

 {{{
 main = do
     let !x = 1
     return ()
 }}}

 I expect an "illegal bang pattern" error, but it is accepted:

 {{{

 $ ghci A.hs
 GHCi, version 7.0.0.20101028: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 [1 of 1] Compiling Main             ( A.hs, interpreted )
 Ok, modules loaded: Main.
 }}}

 However, if we move it inside some parens, it correctly fails:

 {{{
 main = do
     let (!x) = 1
     return ()
 }}}

 failing with

 {{{

 A.hs:2:10:
     Illegal bang-pattern (use -XBangPatterns):
     ! x
 }}}

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