[commit: ghc] wip/orf-2017: Use OccSet instead of [FastString] in rnHsRecFields.rn_dotdot (2833f0e)

git at git.haskell.org git at git.haskell.org
Wed Feb 8 21:24:16 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/orf-2017
Link       : http://ghc.haskell.org/trac/ghc/changeset/2833f0eae725e85bc180be151798f637bb5251c7/ghc

>---------------------------------------------------------------

commit 2833f0eae725e85bc180be151798f637bb5251c7
Author: Adam Gundry <adam at well-typed.com>
Date:   Wed Feb 8 21:22:54 2017 +0000

    Use OccSet instead of [FastString] in rnHsRecFields.rn_dotdot


>---------------------------------------------------------------

2833f0eae725e85bc180be151798f637bb5251c7
 compiler/rename/RnPat.hs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/compiler/rename/RnPat.hs b/compiler/rename/RnPat.hs
index 84dcc69..c18138b 100644
--- a/compiler/rename/RnPat.hs
+++ b/compiler/rename/RnPat.hs
@@ -618,20 +618,20 @@ rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot })
            ; (rdr_env, lcl_env) <- getRdrEnvs
            ; con_fields <- lookupConstructorFields con
            ; when (null con_fields) (addErr (badDotDotCon con))
-           ; let present_flds = map (occNameFS . rdrNameOcc) $ getFieldLbls flds
+           ; let present_flds = mkOccSet $ map rdrNameOcc (getFieldLbls flds)
 
                    -- For constructor uses (but not patterns)
                    -- the arg should be in scope locally;
                    -- i.e. not top level or imported
                    -- Eg.  data R = R { x,y :: Int }
                    --      f x = R { .. }   -- Should expand to R {x=x}, not R{x=x,y=y}
-                 arg_in_scope lbl = mkVarUnqual lbl `elemLocalRdrEnv` lcl_env
+                 arg_in_scope lbl = mkRdrUnqual lbl `elemLocalRdrEnv` lcl_env
 
                  (dot_dot_fields, dot_dot_gres)
                         = unzip [ (fl, gre)
                                 | fl <- con_fields
-                                , let lbl = flLabel fl
-                                , not (lbl `elem` present_flds)
+                                , let lbl = mkVarOccFS (flLabel fl)
+                                , not (lbl `elemOccSet` present_flds)
                                 , Just gre <- [lookupGRE_FieldLabel rdr_env fl]
                                               -- Check selector is in scope
                                 , case ctxt of



More information about the ghc-commits mailing list