From 91d5084fd9b9c6d2c5a91a0f0e00599ab0aa7954 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Mon, 19 Nov 2007 11:43:01 +0000 Subject: [PATCH] FIX Trac #1806: test for correct arity for datacon in infix pattern patch Happily the fix is easy; pls merge --- compiler/typecheck/TcPat.lhs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcPat.lhs b/compiler/typecheck/TcPat.lhs index fca172f..f220154 100644 --- a/compiler/typecheck/TcPat.lhs +++ b/compiler/typecheck/TcPat.lhs @@ -717,9 +717,10 @@ tcConArgs data_con arg_tys (PrefixCon arg_pats) pstate thing_inside con_arity = dataConSourceArity data_con no_of_args = length arg_pats -tcConArgs data_con [arg_ty1,arg_ty2] (InfixCon p1 p2) pstate thing_inside +tcConArgs data_con arg_tys (InfixCon p1 p2) pstate thing_inside = do { checkTc (con_arity == 2) -- Check correct arity (arityErr "Constructor" data_con con_arity 2) + ; let [arg_ty1,arg_ty2] = arg_tys -- This can't fail after the arity check ; ([p1',p2'], tvs, res) <- tcMultiple tcConArg [(p1,arg_ty1),(p2,arg_ty2)] pstate thing_inside ; return (InfixCon p1' p2', tvs, res) } -- 1.7.10.4