From: simonpj@microsoft.com Date: Wed, 30 May 2007 07:16:25 +0000 (+0000) Subject: Reject newtypes with strictness annotations; fixes read008 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=923ee9d360ed15331ac6faf8a6b4aca334fc0cee;p=ghc-hetmet.git Reject newtypes with strictness annotations; fixes read008 This used to be a parse error, but ! annotations are now handled further downstream in the compiler, and I'd forgotten to check that newtypes do not have strictness annotations. The test read008 is technically in the wrong place (it's a typechecker test now) but that doesn't matter --- diff --git a/compiler/typecheck/TcTyClsDecls.lhs b/compiler/typecheck/TcTyClsDecls.lhs index ae90ef8..5f7a680 100644 --- a/compiler/typecheck/TcTyClsDecls.lhs +++ b/compiler/typecheck/TcTyClsDecls.lhs @@ -1008,6 +1008,8 @@ checkNewDataCon con -- Return type is (T a b c) ; checkTc (null ex_tvs && null theta) (newtypeExError con) -- No existentials + ; checkTc (null (dataConStrictMarks con)) (newtypeStrictError con) + -- No strictness } where (_univ_tvs, ex_tvs, eq_spec, theta, arg_tys, _res_ty) = dataConFullSig con @@ -1152,6 +1154,10 @@ newtypeExError con = sep [ptext SLIT("A newtype constructor cannot have an existential context,"), nest 2 $ ptext SLIT("but") <+> quotes (ppr con) <+> ptext SLIT("does")] +newtypeStrictError con + = sep [ptext SLIT("A newtype constructor cannot have a strictness annotation,"), + nest 2 $ ptext SLIT("but") <+> quotes (ppr con) <+> ptext SLIT("does")] + newtypePredError con = sep [ptext SLIT("A newtype constructor must have a return type of form T a1 ... an"), nest 2 $ ptext SLIT("but") <+> quotes (ppr con) <+> ptext SLIT("does not")]