Commit f4e40607 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add -XEmptyDataDecls flag

parent aa13a496
...@@ -184,6 +184,7 @@ data DynFlag ...@@ -184,6 +184,7 @@ data DynFlag
| Opt_GADTs | Opt_GADTs
| Opt_RelaxedPolyRec -- -X=RelaxedPolyRec | Opt_RelaxedPolyRec -- -X=RelaxedPolyRec
| Opt_MagicHash | Opt_MagicHash
| Opt_EmptyDataDecls
-- optimisation opts -- optimisation opts
| Opt_Strictness | Opt_Strictness
...@@ -1094,6 +1095,7 @@ fFlags = [ ...@@ -1094,6 +1095,7 @@ fFlags = [
xFlags :: [(String, DynFlag)] xFlags :: [(String, DynFlag)]
xFlags = [ xFlags = [
( "MagicHash", Opt_MagicHash ), ( "MagicHash", Opt_MagicHash ),
( "EmptyDataDecls", Opt_EmptyDataDecls ),
( "FI", Opt_FFI ), -- support `-ffi'... ( "FI", Opt_FFI ), -- support `-ffi'...
( "FFI", Opt_FFI ), -- ...and also `-fffi' ( "FFI", Opt_FFI ), -- ...and also `-fffi'
( "ForeignFunctionInterface", Opt_FFI ), ( "ForeignFunctionInterface", Opt_FFI ),
...@@ -1138,6 +1140,7 @@ glasgowExtsFlags = [ Opt_GlasgowExts ...@@ -1138,6 +1140,7 @@ glasgowExtsFlags = [ Opt_GlasgowExts
, Opt_ImplicitParams , Opt_ImplicitParams
, Opt_ScopedTypeVariables , Opt_ScopedTypeVariables
, Opt_MagicHash , Opt_MagicHash
, Opt_EmptyDataDecls
, Opt_TypeFamilies ] , Opt_TypeFamilies ]
------------------ ------------------
......
...@@ -694,6 +694,7 @@ tcTyClDecl1 calc_isrec ...@@ -694,6 +694,7 @@ tcTyClDecl1 calc_isrec
; want_generic <- doptM Opt_Generics ; want_generic <- doptM Opt_Generics
; unbox_strict <- doptM Opt_UnboxStrictFields ; unbox_strict <- doptM Opt_UnboxStrictFields
; gla_exts <- doptM Opt_GlasgowExts ; gla_exts <- doptM Opt_GlasgowExts
; empty_data_decls <- doptM Opt_EmptyDataDecls
; gadt_ok <- doptM Opt_GADTs ; gadt_ok <- doptM Opt_GADTs
; is_boot <- tcIsHsBoot -- Are we compiling an hs-boot file? ; is_boot <- tcIsHsBoot -- Are we compiling an hs-boot file?
...@@ -707,8 +708,8 @@ tcTyClDecl1 calc_isrec ...@@ -707,8 +708,8 @@ tcTyClDecl1 calc_isrec
; checkTc (null stupid_theta || h98_syntax) (badStupidTheta tc_name) ; checkTc (null stupid_theta || h98_syntax) (badStupidTheta tc_name)
-- Check that there's at least one condecl, -- Check that there's at least one condecl,
-- or else we're reading an hs-boot file, or -fglasgow-exts -- or else we're reading an hs-boot file, or -XEmptyDataDecls
; checkTc (not (null cons) || gla_exts || is_boot) ; checkTc (not (null cons) || empty_data_decls || is_boot)
(emptyConDeclsErr tc_name) (emptyConDeclsErr tc_name)
-- Check that a newtype has exactly one constructor -- Check that a newtype has exactly one constructor
...@@ -1250,5 +1251,5 @@ tyFamAppInIndexErr ty ...@@ -1250,5 +1251,5 @@ tyFamAppInIndexErr ty
emptyConDeclsErr tycon emptyConDeclsErr tycon
= sep [quotes (ppr tycon) <+> ptext SLIT("has no constructors"), = sep [quotes (ppr tycon) <+> ptext SLIT("has no constructors"),
nest 2 $ ptext SLIT("(-fglasgow-exts permits this)")] nest 2 $ ptext SLIT("(-XEmptyDataDecls permits this)")]
\end{code} \end{code}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment