From: simonpj Date: Fri, 14 Feb 2003 13:01:32 +0000 (+0000) Subject: [project @ 2003-02-14 13:01:32 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~1165 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=9d3463add032cf170615d3fe9fe4f3e7a1d99ff5;p=ghc-hetmet.git [project @ 2003-02-14 13:01:32 by simonpj] Fix for deriving of records with leading underscore, and corresponding lex --- diff --git a/ghc/compiler/typecheck/TcGenDeriv.lhs b/ghc/compiler/typecheck/TcGenDeriv.lhs index ac6abdf..bafa008 100644 --- a/ghc/compiler/typecheck/TcGenDeriv.lhs +++ b/ghc/compiler/typecheck/TcGenDeriv.lhs @@ -854,10 +854,11 @@ gen_Read_binds get_fixity tycon BindStmt (VarPat a) (mkHsVarApps reset_RDR [readPrec_RDR]) loc] -- When reading field labels we might encounter - -- a = 3 + -- a = 3 + -- _a = 3 -- or (#) = 4 -- Note the parens! - read_lbl lbl | isAlpha (head lbl_str) + read_lbl lbl | is_id_start (head lbl_str) = [bindLex (ident_pat lbl_lit)] | otherwise = [read_punc "(", @@ -866,6 +867,7 @@ gen_Read_binds get_fixity tycon where lbl_str = occNameUserString (getOccName (fieldLabelName lbl)) lbl_lit = mkHsString lbl_str + is_id_start c = isAlpha c || c == '_' \end{code}