summaryrefslogtreecommitdiff
path: root/compiler/GHC/Stg/Lint.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Stg/Lint.hs')
-rw-r--r--compiler/GHC/Stg/Lint.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/GHC/Stg/Lint.hs b/compiler/GHC/Stg/Lint.hs
index abdc5e8328..d22e355b2b 100644
--- a/compiler/GHC/Stg/Lint.hs
+++ b/compiler/GHC/Stg/Lint.hs
@@ -232,7 +232,14 @@ lintAlt (DEFAULT, _, rhs) =
lintAlt (LitAlt _, _, rhs) =
lintStgExpr rhs
-lintAlt (DataAlt _, bndrs, rhs) = do
+lintAlt (DataAlt con, bndrs, rhs) = do
+ when (dataConRepArity con /= length bndrs) $ do
+ opts <- getStgPprOpts
+ addErrL (text "DataConRep arity doesn't match binder count!" $$
+ text "DataCon:" <> ppr con $$
+ text "Arity:" <> ppr (dataConRepArity con) $$
+ text "Binders:" <> ppr bndrs $$
+ text "RHS:" <> pprStgExpr opts rhs)
mapM_ checkPostUnariseBndr bndrs
addInScopeVars bndrs (lintStgExpr rhs)