Result type signatures are no longer supported (partial)
[ghc-hetmet.git] / compiler / parser / RdrHsSyn.lhs
index cd82da1..ca24070 100644 (file)
@@ -530,8 +530,12 @@ checkAPat loc e = case e of
    NegApp (L _ (HsOverLit pos_lit)) _ 
                        -> return (mkNPat pos_lit (Just noSyntaxExpr))
    
-   SectionR (L _ (HsVar bang)) e 
-       | bang == bang_RDR -> checkLPat e >>= (return . BangPat)
+   SectionR (L _ (HsVar bang)) e       -- (! x)
+       | bang == bang_RDR 
+       -> do { bang_on <- extension bangPatEnabled
+             ; if bang_on then checkLPat e >>= (return . BangPat)
+               else parseError loc "Illegal bang-pattern (use -fbang-patterns)" }
+
    ELazyPat e        -> checkLPat e >>= (return . LazyPat)
    EAsPat n e        -> checkLPat e >>= (return . AsPat n)
    ExprWithTySig e t  -> checkLPat e >>= \e ->
@@ -592,6 +596,10 @@ checkValDef :: LHsExpr RdrName
            -> Located (GRHSs RdrName)
            -> P (HsBind RdrName)
 
+checkValDef lhs (Just sig) grhss
+       -- x :: ty = rhs  parses as a *pattern* binding
+  = checkPatBind (L (combineLocs lhs sig) (ExprWithTySig lhs sig)) grhss
+
 checkValDef lhs opt_sig grhss
   = do { mb_fun <- isFunLhs lhs
        ; case mb_fun of