From 6344b1506042f6e150c1b105c6696f3d75a5eb66 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Fri, 1 Aug 2008 12:22:23 +0000 Subject: [PATCH] Fix Trac #2478 A minor glitch that shows up only when a data constructor has *both* a "stupid theta" in the data type decl, *and* an existential type variable. --- compiler/typecheck/TcPat.lhs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcPat.lhs b/compiler/typecheck/TcPat.lhs index 6a30754..2e86583 100644 --- a/compiler/typecheck/TcPat.lhs +++ b/compiler/typecheck/TcPat.lhs @@ -799,7 +799,9 @@ addDataConStupidTheta data_con inst_tys -- The origin should always report "occurrence of C" -- even when C occurs in a pattern stupid_theta = dataConStupidTheta data_con - tenv = zipTopTvSubst (dataConUnivTyVars data_con) inst_tys + tenv = mkTopTvSubst (dataConUnivTyVars data_con `zip` inst_tys) + -- NB: inst_tys can be longer than the univ tyvars + -- because the constructor might have existentials inst_theta = substTheta tenv stupid_theta \end{code} -- 1.7.10.4