From 6aa2bf20adef309cbf6ff39f4989a96ef0338138 Mon Sep 17 00:00:00 2001 From: simonpj Date: Thu, 14 Feb 2002 14:56:04 +0000 Subject: [PATCH] [project @ 2002-02-14 14:56:04 by simonpj] --------------------------------------- Record updates are ok for types involving existential data constructors, so long as the existential ones aren't the ones updated. --------------------------------------- This check was already in the type checker, but the desugarer had an over-zealous assert. --- ghc/compiler/deSugar/DsExpr.lhs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghc/compiler/deSugar/DsExpr.lhs b/ghc/compiler/deSugar/DsExpr.lhs index 5560d36..45b02fb 100644 --- a/ghc/compiler/deSugar/DsExpr.lhs +++ b/ghc/compiler/deSugar/DsExpr.lhs @@ -454,7 +454,7 @@ dictionaries. dsExpr (RecordUpdOut record_expr record_in_ty record_out_ty dicts []) = dsExpr record_expr -dsExpr (RecordUpdOut record_expr record_in_ty record_out_ty dicts rbinds) +dsExpr expr@(RecordUpdOut record_expr record_in_ty record_out_ty dicts rbinds) = getSrcLocDs `thenDs` \ src_loc -> dsExpr record_expr `thenDs` \ record_expr' -> @@ -488,7 +488,9 @@ dsExpr (RecordUpdOut record_expr record_in_ty record_out_ty dicts rbinds) src_loc) in -- Record stuff doesn't work for existentials - ASSERT( all (not . isExistentialDataCon) data_cons ) + -- The type checker checks for this, but we need + -- worry only about the constructors that are to be updated + ASSERT2( all (not . isExistentialDataCon) cons_to_upd, ppr expr ) -- It's important to generate the match with matchWrapper, -- and the right hand sides with applications of the wrapper Id -- 1.7.10.4