[commit: ghc] master: Check for illegal syntax in types (fixes Trac #7943) (cfb9bee)

Simon Peyton Jones simonpj at microsoft.com
Tue May 28 15:02:37 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/cfb9bee7cd3e93bb872cbf6f3fa944d8ad5aabf3

>---------------------------------------------------------------

commit cfb9bee7cd3e93bb872cbf6f3fa944d8ad5aabf3
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue May 28 13:14:54 2013 +0100

    Check for illegal syntax in types (fixes Trac #7943)

>---------------------------------------------------------------

 compiler/rename/RnTypes.lhs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/compiler/rename/RnTypes.lhs b/compiler/rename/RnTypes.lhs
index a230701..69921a2 100644
--- a/compiler/rename/RnTypes.lhs
+++ b/compiler/rename/RnTypes.lhs
@@ -187,9 +187,10 @@ rnHsTyKi isType doc (HsBangTy b ty)
     do { (ty', fvs) <- rnLHsType doc ty
        ; return (HsBangTy b ty', fvs) }
 
-rnHsTyKi isType doc (HsRecTy flds)
-  = ASSERT ( isType ) 
-    do { (flds', fvs) <- rnConDeclFields doc flds
+rnHsTyKi _ doc ty@(HsRecTy flds)
+  = do { addErr (hang (ptext (sLit "Record syntax is illegal here:"))
+                    2 (ppr ty))
+       ; (flds', fvs) <- rnConDeclFields doc flds
        ; return (HsRecTy flds', fvs) }
 
 rnHsTyKi isType doc (HsFunTy ty1 ty2)





More information about the ghc-commits mailing list