projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adding TcGadt.lhs
[ghc-hetmet.git]
/
compiler
/
parser
/
RdrHsSyn.lhs
diff --git
a/compiler/parser/RdrHsSyn.lhs
b/compiler/parser/RdrHsSyn.lhs
index
d338b7c
..
ca24070
100644
(file)
--- a/
compiler/parser/RdrHsSyn.lhs
+++ b/
compiler/parser/RdrHsSyn.lhs
@@
-530,8
+530,12
@@
checkAPat loc e = case e of
NegApp (L _ (HsOverLit pos_lit)) _
-> return (mkNPat pos_lit (Just noSyntaxExpr))
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 ->
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)
-> 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
checkValDef lhs opt_sig grhss
= do { mb_fun <- isFunLhs lhs
; case mb_fun of
@@
-747,10
+755,10
@@
mkImport :: CallConv
-> P (HsDecl RdrName)
mkImport (CCall cconv) safety (entity, v, ty) = do
importSpec <- parseCImport entity cconv safety v
-> P (HsDecl RdrName)
mkImport (CCall cconv) safety (entity, v, ty) = do
importSpec <- parseCImport entity cconv safety v
- return (ForD (ForeignImport v ty importSpec False))
+ return (ForD (ForeignImport v ty importSpec))
mkImport (DNCall ) _ (entity, v, ty) = do
spec <- parseDImport entity
mkImport (DNCall ) _ (entity, v, ty) = do
spec <- parseDImport entity
- return $ ForD (ForeignImport v ty (DNImport spec) False)
+ return $ ForD (ForeignImport v ty (DNImport spec))
-- parse the entity string of a foreign import declaration for the `ccall' or
-- `stdcall' calling convention'
-- parse the entity string of a foreign import declaration for the `ccall' or
-- `stdcall' calling convention'
@@
-851,7
+859,7
@@
mkExport :: CallConv
-> (Located FastString, Located RdrName, LHsType RdrName)
-> P (HsDecl RdrName)
mkExport (CCall cconv) (L loc entity, v, ty) = return $
-> (Located FastString, Located RdrName, LHsType RdrName)
-> P (HsDecl RdrName)
mkExport (CCall cconv) (L loc entity, v, ty) = return $
- ForD (ForeignExport v ty (CExport (CExportStatic entity' cconv)) False)
+ ForD (ForeignExport v ty (CExport (CExportStatic entity' cconv)))
where
entity' | nullFS entity = mkExtName (unLoc v)
| otherwise = entity
where
entity' | nullFS entity = mkExtName (unLoc v)
| otherwise = entity