diff options
Diffstat (limited to 'compiler/GHC/Rename/Pat.hs')
-rw-r--r-- | compiler/GHC/Rename/Pat.hs | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/compiler/GHC/Rename/Pat.hs b/compiler/GHC/Rename/Pat.hs index c86e3f6ec2..8681903590 100644 --- a/compiler/GHC/Rename/Pat.hs +++ b/compiler/GHC/Rename/Pat.hs @@ -590,15 +590,15 @@ rnHsRecPatsAndThen mk (L _ con) where mkVarPat l n = VarPat noExtField (L (noAnnSrcSpan l) n) rn_field (L l fld, n') = - do { arg' <- rnLPatAndThen (nested_mk dd mk n') (hsRecFieldArg fld) - ; return (L l (fld { hsRecFieldArg = arg' })) } + do { arg' <- rnLPatAndThen (nested_mk dd mk n') (hfbRHS fld) + ; return (L l (fld { hfbRHS = arg' })) } loc = maybe noSrcSpan getLoc dd -- Get the arguments of the implicit binders implicit_binders fs (unLoc -> n) = collectPatsBinders CollNoDictBinders implicit_pats where - implicit_pats = map (hsRecFieldArg . unLoc) (drop n fs) + implicit_pats = map (hfbRHS . unLoc) (drop n fs) -- Don't warn for let P{..} = ... in ... check_unused_wildcard = case mk of @@ -659,11 +659,11 @@ rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot }) rn_fld :: Bool -> Maybe Name -> LHsRecField GhcPs (LocatedA arg) -> RnM (LHsRecField GhcRn (LocatedA arg)) rn_fld pun_ok parent (L l - (HsRecField - { hsRecFieldLbl = + (HsFieldBind + { hfbLHS = (L loc (FieldOcc _ (L ll lbl))) - , hsRecFieldArg = arg - , hsRecPun = pun })) + , hfbRHS = arg + , hfbPun = pun })) = do { sel <- setSrcSpan loc $ lookupRecFieldOcc parent lbl ; arg' <- if pun then do { checkErr pun_ok (badPun (L loc lbl)) @@ -671,11 +671,11 @@ rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot }) ; let arg_rdr = mkRdrUnqual (rdrNameOcc lbl) ; return (L (noAnnSrcSpan loc) (mk_arg loc arg_rdr)) } else return arg - ; return (L l (HsRecField - { hsRecFieldAnn = noAnn - , hsRecFieldLbl = (L loc (FieldOcc sel (L ll lbl))) - , hsRecFieldArg = arg' - , hsRecPun = pun })) } + ; return (L l (HsFieldBind + { hfbAnn = noAnn + , hfbLHS = (L loc (FieldOcc sel (L ll lbl))) + , hfbRHS = arg' + , hfbPun = pun })) } rn_dotdot :: Maybe (Located Int) -- See Note [DotDot fields] in GHC.Hs.Pat @@ -716,12 +716,12 @@ rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot }) ; addUsedGREs dot_dot_gres ; let locn = noAnnSrcSpan loc - ; return [ L (noAnnSrcSpan loc) (HsRecField - { hsRecFieldAnn = noAnn - , hsRecFieldLbl + ; return [ L (noAnnSrcSpan loc) (HsFieldBind + { hfbAnn = noAnn + , hfbLHS = L loc (FieldOcc sel (L (noAnnSrcSpan loc) arg_rdr)) - , hsRecFieldArg = L locn (mk_arg loc arg_rdr) - , hsRecPun = False }) + , hfbRHS = L locn (mk_arg loc arg_rdr) + , hfbPun = False }) | fl <- dot_dot_fields , let sel = flSelector fl , let arg_rdr = mkVarUnqual (flLabel fl) ] } @@ -763,9 +763,9 @@ rnHsRecUpdFields flds where rn_fld :: Bool -> DuplicateRecordFields -> LHsRecUpdField GhcPs -> RnM (LHsRecUpdField GhcRn, FreeVars) - rn_fld pun_ok dup_fields_ok (L l (HsRecField { hsRecFieldLbl = L loc f - , hsRecFieldArg = arg - , hsRecPun = pun })) + rn_fld pun_ok dup_fields_ok (L l (HsFieldBind { hfbLHS = L loc f + , hfbRHS = arg + , hfbPun = pun })) = do { let lbl = rdrNameAmbiguousFieldOcc f ; mb_sel <- setSrcSpan loc $ -- Defer renaming of overloaded fields to the typechecker @@ -785,10 +785,10 @@ rnHsRecUpdFields flds in (Unambiguous sel_name (L (noAnnSrcSpan loc) lbl), fvs `addOneFV` sel_name) AmbiguousFields -> (Ambiguous noExtField (L (noAnnSrcSpan loc) lbl), fvs) - ; return (L l (HsRecField { hsRecFieldAnn = noAnn - , hsRecFieldLbl = L loc lbl' - , hsRecFieldArg = arg'' - , hsRecPun = pun }), fvs') } + ; return (L l (HsFieldBind { hfbAnn = noAnn + , hfbLHS = L loc lbl' + , hfbRHS = arg'' + , hfbPun = pun }), fvs') } dup_flds :: [NE.NonEmpty RdrName] -- Each list represents a RdrName that occurred more than once @@ -799,14 +799,14 @@ rnHsRecUpdFields flds getFieldIds :: [LHsRecField GhcRn arg] -> [Name] -getFieldIds flds = map (unLoc . hsRecFieldSel . unLoc) flds +getFieldIds flds = map (hsRecFieldSel . unLoc) flds getFieldLbls :: forall p arg . UnXRec p => [LHsRecField p arg] -> [RdrName] getFieldLbls flds - = map (unLoc . rdrNameFieldOcc . unLoc . hsRecFieldLbl . unXRec @p) flds + = map (unLoc . rdrNameFieldOcc . unXRec @p . hfbLHS . unXRec @p) flds getFieldUpdLbls :: [LHsRecUpdField GhcPs] -> [RdrName] -getFieldUpdLbls flds = map (rdrNameAmbiguousFieldOcc . unLoc . hsRecFieldLbl . unLoc) flds +getFieldUpdLbls flds = map (rdrNameAmbiguousFieldOcc . unLoc . hfbLHS . unLoc) flds needFlagDotDot :: HsRecFieldContext -> SDoc needFlagDotDot ctxt = vcat [text "Illegal `..' in record" <+> pprRFC ctxt, |