projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
58de6cb
)
Fix Trac #2126: re-order tests (easy)
author
simonpj@microsoft.com
<unknown>
Wed, 27 Feb 2008 16:32:02 +0000
(16:32 +0000)
committer
simonpj@microsoft.com
<unknown>
Wed, 27 Feb 2008 16:32:02 +0000
(16:32 +0000)
compiler/typecheck/TcTyClsDecls.lhs
patch
|
blob
|
history
diff --git
a/compiler/typecheck/TcTyClsDecls.lhs
b/compiler/typecheck/TcTyClsDecls.lhs
index
f3abbe9
..
6657e16
100644
(file)
--- a/
compiler/typecheck/TcTyClsDecls.lhs
+++ b/
compiler/typecheck/TcTyClsDecls.lhs
@@
-724,15
+724,17
@@
tcTyClDecl1 calc_isrec
-- Check that the stupid theta is empty for a GADT-style declaration
; checkTc (null stupid_theta || h98_syntax) (badStupidTheta tc_name)
-- Check that the stupid theta is empty for a GADT-style declaration
; checkTc (null stupid_theta || h98_syntax) (badStupidTheta tc_name)
+ -- Check that a newtype has exactly one constructor
+ -- Do this before checking for empty data decls, so that
+ -- we don't suggest -XEmptyDataDecls for newtypes
+ ; checkTc (new_or_data == DataType || isSingleton cons)
+ (newtypeConError tc_name (length cons))
+
-- Check that there's at least one condecl,
-- or else we're reading an hs-boot file, or -XEmptyDataDecls
; checkTc (not (null cons) || empty_data_decls || is_boot)
(emptyConDeclsErr tc_name)
-- Check that there's at least one condecl,
-- or else we're reading an hs-boot file, or -XEmptyDataDecls
; checkTc (not (null cons) || empty_data_decls || is_boot)
(emptyConDeclsErr tc_name)
- -- Check that a newtype has exactly one constructor
- ; checkTc (new_or_data == DataType || isSingleton cons)
- (newtypeConError tc_name (length cons))
-
; tycon <- fixM (\ tycon -> do
{ data_cons <- mapM (addLocM (tcConDecl unbox_strict ex_ok tycon final_tvs))
cons
; tycon <- fixM (\ tycon -> do
{ data_cons <- mapM (addLocM (tcConDecl unbox_strict ex_ok tycon final_tvs))
cons