From aab1ff042c452bac0414f69499d1c354a6cd73c7 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Mon, 9 Jul 2007 17:54:11 +0000 Subject: [PATCH] Add -XPatternSigs flag --- compiler/main/DynFlags.hs | 3 +++ compiler/rename/RnBinds.lhs | 4 ++-- compiler/rename/RnTypes.lhs | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index a675ff3..3fdfb0b 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -194,6 +194,7 @@ data DynFlag | Opt_MagicHash | Opt_EmptyDataDecls | Opt_KindSignatures + | Opt_PatternSignatures | Opt_ParallelListComp | Opt_GeneralizedNewtypeDeriving | Opt_RecursiveDo @@ -1120,6 +1121,7 @@ xFlags = [ ( "PolymorphicComponents", Opt_PolymorphicComponents ), ( "ExistentialQuantification", Opt_ExistentialQuantification ), ( "KindSignatures", Opt_KindSignatures ), + ( "PatternSignatures", Opt_PatternSignatures ), ( "EmptyDataDecls", Opt_EmptyDataDecls ), ( "ParallelListComp", Opt_ParallelListComp ), ( "FI", Opt_FFI ), -- support `-ffi'... @@ -1192,6 +1194,7 @@ glasgowExtsFlags = [ Opt_GlasgowExts , Opt_ParallelListComp , Opt_EmptyDataDecls , Opt_KindSignatures + , Opt_PatternSignatures , Opt_GeneralizedNewtypeDeriving , Opt_TypeFamilies ] diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs index ff0629a..1733e7a 100644 --- a/compiler/rename/RnBinds.lhs +++ b/compiler/rename/RnBinds.lhs @@ -555,10 +555,10 @@ rnMatch' ctxt match@(Match pats maybe_rhs_sig grhss) = -- Deal with the rhs type signature bindPatSigTyVarsFV rhs_sig_tys $ - doptM Opt_GlasgowExts `thenM` \ opt_GlasgowExts -> + doptM Opt_PatternSignatures `thenM` \ opt_PatternSignatures -> (case maybe_rhs_sig of Nothing -> returnM (Nothing, emptyFVs) - Just ty | opt_GlasgowExts -> rnHsTypeFVs doc_sig ty `thenM` \ (ty', ty_fvs) -> + Just ty | opt_PatternSignatures -> rnHsTypeFVs doc_sig ty `thenM` \ (ty', ty_fvs) -> returnM (Just ty', ty_fvs) | otherwise -> addLocErr ty patSigErr `thenM_` returnM (Nothing, emptyFVs) diff --git a/compiler/rename/RnTypes.lhs b/compiler/rename/RnTypes.lhs index 25a1c45..15f4daf 100644 --- a/compiler/rename/RnTypes.lhs +++ b/compiler/rename/RnTypes.lhs @@ -572,7 +572,7 @@ rnPat (VarPat name) returnM (VarPat vname, emptyFVs) rnPat (SigPatIn pat ty) - = doptM Opt_GlasgowExts `thenM` \ glaExts -> + = doptM Opt_PatternSignatures `thenM` \ glaExts -> if glaExts then rnLPat pat `thenM` \ (pat', fvs1) -> @@ -815,7 +815,7 @@ bogusCharError c patSigErr ty = (ptext SLIT("Illegal signature in pattern:") <+> ppr ty) - $$ nest 4 (ptext SLIT("Use -fglasgow-exts to permit it")) + $$ nest 4 (ptext SLIT("Use -XPatternSigs to permit it")) dupFieldErr str dup = hsep [ptext SLIT("duplicate field name"), -- 1.7.10.4