summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruhbif19 <uhbif19@gmail.com>2022-05-31 01:17:18 +0300
committeruhbif19 <uhbif19@gmail.com>2022-06-09 20:24:40 +0300
commit46d2fc65fd1eaf3284dc01a2fcebcef2cce4bee3 (patch)
tree5fefbde39ff11c463c068ac7ed060e23dc1c7035
parent7eab75bb2d176ea09de535be17130dc9dae42a02 (diff)
downloadhaskell-46d2fc65fd1eaf3284dc01a2fcebcef2cce4bee3.tar.gz
Fix TcRnPragmaWarning meaning
-rw-r--r--compiler/GHC/Rename/Env.hs10
-rw-r--r--compiler/GHC/Tc/Errors/Ppr.hs24
-rw-r--r--compiler/GHC/Tc/Errors/Types.hs16
3 files changed, 25 insertions, 25 deletions
diff --git a/compiler/GHC/Rename/Env.hs b/compiler/GHC/Rename/Env.hs
index 13343135ab..14916fb9f6 100644
--- a/compiler/GHC/Rename/Env.hs
+++ b/compiler/GHC/Rename/Env.hs
@@ -1554,11 +1554,11 @@ warnIfDeprecated gre@(GRE { gre_imp = iss })
do { iface <- loadInterfaceForName doc name
; case lookupImpDeprec iface gre of
Just deprText -> addDiagnostic $
- TcRnDeprecated {
- depr_occ = occ,
- depr_msg = deprText,
- depr_import_mod = importSpecModule imp_spec,
- depr_defined_mod = definedMod
+ TcRnPragmaWarning {
+ pragma_warning_occ = occ,
+ pragma_warning_msg = deprText,
+ pragma_warning_import_mod = importSpecModule imp_spec,
+ pragma_warning_defined_mod = definedMod
}
Nothing -> return () } }
| otherwise
diff --git a/compiler/GHC/Tc/Errors/Ppr.hs b/compiler/GHC/Tc/Errors/Ppr.hs
index 3ab4fc2927..35bfea6ae1 100644
--- a/compiler/GHC/Tc/Errors/Ppr.hs
+++ b/compiler/GHC/Tc/Errors/Ppr.hs
@@ -946,17 +946,17 @@ instance Diagnostic TcRnMessage where
text "Cannot redefine a Name retrieved by a Template Haskell quote:" <+> ppr name
TcRnIllegalBindingOfBuiltIn name -> mkSimpleDecorated $
text "Illegal binding of built-in syntax:" <+> ppr name
- TcRnDeprecated {depr_occ, depr_msg, depr_import_mod, depr_defined_mod} -> mkSimpleDecorated $
- sep [ sep [ text "In the use of"
- <+> pprNonVarNameSpace (occNameSpace depr_occ)
- <+> quotes (ppr depr_occ)
+ TcRnPragmaWarning {pragma_warning_occ, pragma_warning_msg, pragma_warning_import_mod, pragma_warning_defined_mod}
+ -> mkSimpleDecorated $
+ sep [ sep [ text "In the use of"
+ <+> pprNonVarNameSpace (occNameSpace pragma_warning_occ)
+ <+> quotes (ppr pragma_warning_occ)
, parens impMsg <> colon ]
- , pprWarningTxtForMsg depr_msg ]
- where
- impMsg = text "imported from" <+> ppr depr_import_mod <> extra
- extra | depr_import_mod == depr_defined_mod = empty
- | otherwise = text ", but defined in" <+> ppr depr_defined_mod
-
+ , pprWarningTxtForMsg pragma_warning_msg ]
+ where
+ impMsg = text "imported from" <+> ppr pragma_warning_import_mod <> extra
+ extra | pragma_warning_import_mod == pragma_warning_defined_mod = empty
+ | otherwise = text ", but defined in" <+> ppr pragma_warning_defined_mod
diagnosticReason = \case
TcRnUnknownMessage m
-> diagnosticReason m
@@ -1268,7 +1268,7 @@ instance Diagnostic TcRnMessage where
-> ErrorWithoutFlag
TcRnIllegalBindingOfBuiltIn{}
-> ErrorWithoutFlag
- TcRnDeprecated{}
+ TcRnPragmaWarning{}
-> WarningWithFlag Opt_WarnWarningsDeprecations
diagnosticHints = \case
@@ -1582,7 +1582,7 @@ instance Diagnostic TcRnMessage where
-> [SuggestSpecialiseVisibilityHints name]
TcRnNameByTemplateHaskellQuote{} -> noHints
TcRnIllegalBindingOfBuiltIn{} -> noHints
- TcRnDeprecated{} -> noHints
+ TcRnPragmaWarning{} -> noHints
-- | Change [x] to "x", [x, y] to "x and y", [x, y, z] to "x, y, and z",
diff --git a/compiler/GHC/Tc/Errors/Types.hs b/compiler/GHC/Tc/Errors/Types.hs
index fff6ff7dc9..62732ed8dd 100644
--- a/compiler/GHC/Tc/Errors/Types.hs
+++ b/compiler/GHC/Tc/Errors/Types.hs
@@ -2158,22 +2158,22 @@ data TcRnMessage where
-}
TcRnIllegalBindingOfBuiltIn :: !OccName -> TcRnMessage
- {- TcRnDeprecated is a warning that can happen when usage of something
- is deprecated.
+ {- TcRnPragmaWarning is a warning that can happen when usage of something
+ is warned or deprecated by pragma.
Test cases:
DeprU
T5281
T5867
rn050
- rn066
+ rn066 (here is a warning, not deprecation)
T3303
-}
- TcRnDeprecated :: {
- depr_occ :: OccName,
- depr_msg :: WarningTxt GhcRn,
- depr_import_mod :: ModuleName,
- depr_defined_mod :: ModuleName
+ TcRnPragmaWarning :: {
+ pragma_warning_occ :: OccName,
+ pragma_warning_msg :: WarningTxt GhcRn,
+ pragma_warning_import_mod :: ModuleName,
+ pragma_warning_defined_mod :: ModuleName
} -> TcRnMessage
-- | Specifies which back ends can handle a requested foreign import or export