diff options
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 6 | ||||
-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 | ||||
-rw-r--r-- | compiler/GHC/Tc/Errors/Ppr.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Types/Hint/Ppr.hs | 4 | ||||
-rw-r--r-- | libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs | 2 |
7 files changed, 9 insertions, 13 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 78add24b2b..b190fe70a9 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -1398,7 +1398,7 @@ languageExtensions (Just GHC2021) LangExt.InstanceSigs, LangExt.KindSignatures, LangExt.MultiParamTypeClasses, - LangExt.RecordPuns, + LangExt.NamedFieldPuns, LangExt.NamedWildCards, LangExt.NumericUnderscores, LangExt.PolyKinds, @@ -3594,7 +3594,7 @@ xFlagsDeps = [ flagSpec "MultiWayIf" LangExt.MultiWayIf, flagSpec "NumericUnderscores" LangExt.NumericUnderscores, flagSpec "NPlusKPatterns" LangExt.NPlusKPatterns, - flagSpec "NamedFieldPuns" LangExt.RecordPuns, + flagSpec "NamedFieldPuns" LangExt.NamedFieldPuns, flagSpec "NamedWildCards" LangExt.NamedWildCards, flagSpec "NegativeLiterals" LangExt.NegativeLiterals, flagSpec "HexFloatLiterals" LangExt.HexFloatLiterals, @@ -3627,7 +3627,7 @@ xFlagsDeps = [ flagSpec "RebindableSyntax" LangExt.RebindableSyntax, flagSpec "OverloadedRecordDot" LangExt.OverloadedRecordDot, flagSpec "OverloadedRecordUpdate" LangExt.OverloadedRecordUpdate, - depFlagSpec' "RecordPuns" LangExt.RecordPuns + depFlagSpec' "RecordPuns" LangExt.NamedFieldPuns (deprecatedForExtension "NamedFieldPuns"), flagSpec "RecordWildCards" LangExt.RecordWildCards, flagSpec "RecursiveDo" LangExt.RecursiveDo, 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 diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs index 0ef1d48ac5..97d0a40413 100644 --- a/compiler/GHC/Tc/Errors/Ppr.hs +++ b/compiler/GHC/Tc/Errors/Ppr.hs @@ -171,7 +171,7 @@ instance Diagnostic TcRnMessage where TcRnEmptyRecordUpdate{} -> noHints TcRnIllegalFieldPunning{} - -> [SuggestExtension LangExt.RecordPuns] + -> [SuggestExtension LangExt.NamedFieldPuns] TcRnIllegalWildcardsInRecord{} -> [SuggestExtension LangExt.RecordWildCards] TcRnDuplicateFieldName{} diff --git a/compiler/GHC/Types/Hint/Ppr.hs b/compiler/GHC/Types/Hint/Ppr.hs index 56d105dd53..24e0da427d 100644 --- a/compiler/GHC/Types/Hint/Ppr.hs +++ b/compiler/GHC/Types/Hint/Ppr.hs @@ -25,10 +25,6 @@ instance Outputable GhcHint where -> case ext of LangExt.NegativeLiterals -> text "If you are trying to write a large negative literal, use NegativeLiterals" - -- RecordPuns is now effectively 'NamedFieldPuns', so we have to pretty-print the - -- hint to yield the correct suggestion in terms of extension to enable. - LangExt.RecordPuns - -> text "Perhaps you intended to use NamedFieldPuns" _ -> text "Perhaps you intended to use" <+> ppr ext SuggestMissingDo -> text "Possibly caused by a missing 'do'?" diff --git a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs index 8dc2b67a36..ce07116a1e 100644 --- a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs +++ b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs @@ -61,7 +61,7 @@ data Extension | NumDecimals | DisambiguateRecordFields | RecordWildCards - | RecordPuns + | NamedFieldPuns | ViewPatterns | GADTs | GADTSyntax |