Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/3e00d04619bb504e3cbe766eaf29e746d1211652 >--------------------------------------------------------------- commit 3e00d04619bb504e3cbe766eaf29e746d1211652 Author: Simon Peyton Jones <[email protected]> Date: Sun Mar 4 09:41:52 2012 +0000 Fix Trac #5892: a coding errors We had a lazy pattern gres@(gre:_) = blah and then a test for (null gres). But I'd forgotten that a demand for *any* of variables in the pattern matches *all* of the variables in the entire pattern. So the test for (null gres) was matching the cons, which defeats the purpose. >--------------------------------------------------------------- compiler/rename/RnPat.lhs | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rename/RnPat.lhs b/compiler/rename/RnPat.lhs index 162ce22..d0302a1 100644 --- a/compiler/rename/RnPat.lhs +++ b/compiler/rename/RnPat.lhs @@ -502,7 +502,7 @@ rnHsRecFields1 ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot } = return [] rn_dotdot (Just {}) Nothing _flds -- ".." on record update = do { addErr (badDotDot ctxt); return [] } - rn_dotdot (Just n) (Just con) flds -- ".." on record con/pat + rn_dotdot (Just n) (Just con) flds -- ".." on record construction / pat match = ASSERT( n == length flds ) do { loc <- getSrcSpanM -- Rather approximate ; dd_flag <- xoptM Opt_RecordWildCards @@ -526,11 +526,11 @@ rnHsRecFields1 ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot } where rdr = mkRdrUnqual (nameOccName fld) - dot_dot_gres = [ gre + dot_dot_gres = [ head gres | fld <- con_fields , not (fld `elem` present_flds) - , let gres@(gre:_) = lookupGRE_Name rdr_env fld - , not (null gres) + , let gres = lookupGRE_Name rdr_env fld + , not (null gres) -- Check field is in scope , case ctxt of HsRecFieldCon {} -> arg_in_scope fld _other -> True ] _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
