summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2012-09-03 10:27:26 -0400
committerPaolo Capriotti <p.capriotti@gmail.com>2012-09-06 15:41:28 +0100
commit62da65a6ba728603b0ee4dab31cd9d59123f3135 (patch)
tree461d9d29f4f0ee17c11f1acd4381e6577345d78a
parent583c87d00d2058b1a073ea1f5d7f4e0d92b7a9a4 (diff)
downloadhaskell-62da65a6ba728603b0ee4dab31cd9d59123f3135.tar.gz
Fail nicely when encountering an invalid bang annotation (#7210)
-rw-r--r--compiler/typecheck/TcHsType.lhs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/typecheck/TcHsType.lhs b/compiler/typecheck/TcHsType.lhs
index d0e89bbab9..1f61e378d8 100644
--- a/compiler/typecheck/TcHsType.lhs
+++ b/compiler/typecheck/TcHsType.lhs
@@ -321,7 +321,11 @@ tc_hs_type :: HsType Name -> ExpKind -> TcM TcType
tc_hs_type (HsParTy ty) exp_kind = tc_lhs_type ty exp_kind
tc_hs_type (HsDocTy ty _) exp_kind = tc_lhs_type ty exp_kind
tc_hs_type (HsQuasiQuoteTy {}) _ = panic "tc_hs_type: qq" -- Eliminated by renamer
-tc_hs_type (HsBangTy {}) _ = panic "tc_hs_type: bang" -- Unwrapped by con decls
+tc_hs_type ty@(HsBangTy {}) _
+ -- While top-level bangs at this point are eliminated (eg !(Maybe Int)),
+ -- other kinds of bangs are not (eg ((!Maybe) Int)). These kinds of
+ -- bangs are invalid, so fail. (#7210)
+ = failWithTc (ptext (sLit "Unexpected strictness annotation:") <+> ppr ty)
tc_hs_type (HsRecTy _) _ = panic "tc_hs_type: record" -- Unwrapped by con decls
-- Record types (which only show up temporarily in constructor
-- signatures) should have been removed by now