diff options
author | Alfredo Di Napoli <alfredo@well-typed.com> | 2021-07-13 08:32:12 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-07-19 19:37:47 -0400 |
commit | 3e8b39eaf098769d33c9a46657c18a277397424c (patch) | |
tree | b4bd86688e692f194d29ec29396cc8c44fc5d71d /compiler/GHC/Rename | |
parent | 952ba18e596f406d08003a9ff07f95a5a94a2ede (diff) | |
download | haskell-3e8b39eaf098769d33c9a46657c18a277397424c.tar.gz |
Rename RecordPuns to NamedFieldPuns in LangExt.Extension
This commit renames the `RecordPuns` type constructor inside
`GHC.LanguageExtensions.Type.hs` to `NamedFieldPuns`.
The rationale is that the `RecordPuns` language extension was deprecated
a long time ago, but it was still present in the AST, introducing an
annoying mismatch between what GHC suggested (i.e. "use NamedFieldPuns")
and what that translated into in terms of Haskell types.
Diffstat (limited to 'compiler/GHC/Rename')
-rw-r--r-- | compiler/GHC/Rename/Expr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Rename/Pat.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Rename/Utils.hs | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/compiler/GHC/Rename/Expr.hs b/compiler/GHC/Rename/Expr.hs index cd0707ef59..72e18ed388 100644 --- a/compiler/GHC/Rename/Expr.hs +++ b/compiler/GHC/Rename/Expr.hs @@ -448,7 +448,7 @@ rnExpr (RecordUpd { rupd_expr = expr, rupd_flds = rbinds }) addErr $ TcRnUnknownMessage $ mkPlainError noHints $ text "RebindableSyntax is required if OverloadedRecordUpdate is enabled." ; let punnedFields = [fld | (L _ fld) <- flds, hfbPun fld] - ; punsEnabled <-xoptM LangExt.RecordPuns + ; punsEnabled <-xoptM LangExt.NamedFieldPuns ; unless (null punnedFields || punsEnabled) $ addErr $ TcRnUnknownMessage $ mkPlainError noHints $ text "For this to work enable NamedFieldPuns." diff --git a/compiler/GHC/Rename/Pat.hs b/compiler/GHC/Rename/Pat.hs index 28e4c806a1..0a149f473e 100644 --- a/compiler/GHC/Rename/Pat.hs +++ b/compiler/GHC/Rename/Pat.hs @@ -754,7 +754,7 @@ rnHsRecFields -- This is used for record construction and pattern-matching, but not updates. rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot }) - = do { pun_ok <- xoptM LangExt.RecordPuns + = do { pun_ok <- xoptM LangExt.NamedFieldPuns ; disambig_ok <- xoptM LangExt.DisambiguateRecordFields ; let parent = guard disambig_ok >> mb_con ; flds1 <- mapM (rn_fld pun_ok parent) flds @@ -863,7 +863,7 @@ rnHsRecUpdFields :: [LHsRecUpdField GhcPs] -> RnM ([LHsRecUpdField GhcRn], FreeVars) rnHsRecUpdFields flds - = do { pun_ok <- xoptM LangExt.RecordPuns + = do { pun_ok <- xoptM LangExt.NamedFieldPuns ; dup_fields_ok <- xopt_DuplicateRecordFields <$> getDynFlags ; (flds1, fvss) <- mapAndUnzipM (rn_fld pun_ok dup_fields_ok) flds ; mapM_ (addErr . dupFieldErr HsRecFieldUpd) dup_flds diff --git a/compiler/GHC/Rename/Utils.hs b/compiler/GHC/Rename/Utils.hs index ed1cf40ea4..37a229e203 100644 --- a/compiler/GHC/Rename/Utils.hs +++ b/compiler/GHC/Rename/Utils.hs @@ -180,7 +180,7 @@ checkShadowedOccs (global_env,local_env) get_loc_occ ns -- punning or wild-cards are on (cf #2723) is_shadowed_gre gre | isRecFldGRE gre = do { dflags <- getDynFlags - ; return $ not (xopt LangExt.RecordPuns dflags + ; return $ not (xopt LangExt.NamedFieldPuns dflags || xopt LangExt.RecordWildCards dflags) } is_shadowed_gre _other = return True |