[Git][ghc/ghc][wip/aforemny/ast] 2 commits: AST: remove occurrences of GHC.Unit.Module.Warnings

Alexander Foremny (@aforemny) gitlab at gitlab.haskell.org
Sun Jun 9 08:41:29 UTC 2024



Alexander Foremny pushed to branch wip/aforemny/ast at Glasgow Haskell Compiler / GHC


Commits:
1faf8105 by Alexander Foremny at 2024-06-09T10:21:03+02:00
AST: remove occurrences of GHC.Unit.Module.Warnings

There are a bunch of warning related functions still left in
`GHC.Unit.Module.Warnings`, which we may or may not want to move to the
module `Language.Haskell.Syntax.Decls`, which is now defining the data
types.

- - - - -
523dd664 by Alexander Foremny at 2024-06-09T10:21:38+02:00
AST: remove `EpToken` from `InWarningCategory`

Since `EpToken` is specific to GHC passes, we use an extension field
`XInWarningCategoryIn` to abstract over it from
`Language.Haskell.Syntax.Decls.WarningCategory`.

- - - - -


14 changed files:

- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Parser.y
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Deriv/Utils.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Instantiate.hs
- compiler/GHC/Unit/Module/Warnings.hs
- compiler/Language/Haskell/Syntax/Decls.hs


Changes:

=====================================
compiler/GHC/Core/InstEnv.hs
=====================================
@@ -55,7 +55,6 @@ import GHC.Types.Name.Set
 import GHC.Types.Basic
 import GHC.Types.Id
 import GHC.Generics (Generic)
-import Data.Data        ( Data )
 import Data.List.NonEmpty ( NonEmpty (..), nonEmpty )
 import qualified Data.List.NonEmpty as NE
 import Data.Maybe       ( isJust )
@@ -114,7 +113,6 @@ data ClsInst
                 -- See Note [Implementation of deprecated instances]
                 -- in GHC.Tc.Solver.Dict
     }
-  deriving Data
 
 -- | A fuzzy comparison function for class instances, intended for sorting
 -- instances before displaying them to the user.


=====================================
compiler/GHC/Hs/Decls.hs
=====================================
@@ -1402,3 +1402,5 @@ type instance Anno (Maybe Role) = EpAnnCO
 type instance Anno CCallConv   = EpaLocation
 type instance Anno Safety      = EpaLocation
 type instance Anno CExportSpec = EpaLocation
+
+type instance XInWarningCategoryIn (GhcPass _) = EpToken "in"


=====================================
compiler/GHC/Hs/Instances.hs
=====================================
@@ -23,6 +23,8 @@ module GHC.Hs.Instances where
 
 import Data.Data hiding ( Fixity )
 
+import Language.Haskell.Syntax.Decls (WarningTxt(..))
+
 import GHC.Prelude
 import GHC.Hs.Extension
 import GHC.Hs.Binds
@@ -34,6 +36,8 @@ import GHC.Hs.Pat
 import GHC.Hs.ImpExp
 import GHC.Parser.Annotation
 
+import GHC.Core.InstEnv (ClsInst(..))
+
 -- ---------------------------------------------------------------------
 -- Data derivations from GHC.Hs-----------------------------------------
 
@@ -578,3 +582,11 @@ deriving instance Data XXPatGhcTc
 deriving instance Data XViaStrategyPs
 
 -- ---------------------------------------------------------------------
+
+deriving instance Data ClsInst
+
+-- ---------------------------------------------------------------------
+
+deriving instance Data (WarningTxt GhcPs)
+deriving instance Data (WarningTxt GhcRn)
+deriving instance Data (WarningTxt GhcTc)


=====================================
compiler/GHC/Iface/Syntax.hs
=====================================
@@ -81,7 +81,7 @@ import GHC.Core.TyCon ( Role (..), Injectivity(..), tyConBndrVisForAllTyFlag )
 import GHC.Core.DataCon (SrcStrictness(..), SrcUnpackedness(..))
 import GHC.Builtin.Types ( constraintKindTyConName )
 import GHC.Stg.InferTags.TagSig
-import GHC.Parser.Annotation (noLocA)
+import GHC.Parser.Annotation (NoAnn, noLocA)
 import GHC.Hs.Extension ( GhcRn )
 import GHC.Hs.Doc ( WithHsDocIdentifiers(..) )
 
@@ -94,6 +94,8 @@ import GHC.Utils.Panic
 import GHC.Utils.Misc( dropList, filterByList, notNull, unzipWith,
                        seqList, zipWithEqual )
 
+import Language.Haskell.Syntax.Decls (XInWarningCategoryIn)
+
 import Control.Monad
 import System.IO.Unsafe
 import Control.DeepSeq
@@ -597,13 +599,17 @@ ifaceDeclFingerprints hash decl
        unsafeDupablePerformIO
         . computeFingerprint (panic "ifaceDeclFingerprints")
 
-fromIfaceWarnings :: IfaceWarnings -> Warnings GhcRn
+fromIfaceWarnings
+  :: (NoAnn (XInWarningCategoryIn GhcRn))
+  => IfaceWarnings -> Warnings GhcRn
 fromIfaceWarnings = \case
     IfWarnAll txt -> WarnAll (fromIfaceWarningTxt txt)
     IfWarnSome vs ds -> WarnSome [(occ, fromIfaceWarningTxt txt) | (occ, txt) <- vs]
                                  [(occ, fromIfaceWarningTxt txt) | (occ, txt) <- ds]
 
-fromIfaceWarningTxt :: IfaceWarningTxt -> WarningTxt GhcRn
+fromIfaceWarningTxt
+  :: (NoAnn (XInWarningCategoryIn GhcRn))
+  => IfaceWarningTxt -> WarningTxt GhcRn
 fromIfaceWarningTxt = \case
     IfWarningTxt mb_cat src strs -> WarningTxt (noLocA . fromWarningCategory <$> mb_cat) src (noLocA <$> map fromIfaceStringLiteralWithNames strs)
     IfDeprecatedTxt src strs -> DeprecatedTxt src (noLocA <$> map fromIfaceStringLiteralWithNames strs)


=====================================
compiler/GHC/Parser.y
=====================================
@@ -1994,7 +1994,7 @@ maybe_warning_pragma :: { Maybe (LWarningTxt GhcPs) }
                                 (AnnPragma (mo $1) (mc $4) (fst $ unLoc $3))}
         |  {- empty -}      { Nothing }
 
-warning_category :: { Maybe (LocatedE InWarningCategory) }
+warning_category :: { Maybe (LocatedE (InWarningCategory GhcPs)) }
         : 'in' STRING                  { Just (reLoc $ sLL $1 $> $ InWarningCategory (epTok $1) (getSTRINGs $2)
                                                                     (reLoc $ sL1 $2 $ mkWarningCategory (getSTRING $2))) }
         | {- empty -}                  { Nothing }


=====================================
compiler/GHC/Rename/Module.hs
=====================================
@@ -312,11 +312,15 @@ rnWarningTxt (WarningTxt mb_cat st wst) = do
     unless (validWarningCategory cat) $
       addErrAt (locA loc) (TcRnInvalidWarningCategory cat)
   wst' <- traverse (traverse rnHsDoc) wst
-  pure (WarningTxt mb_cat st wst')
+  pure (WarningTxt (fmap rnInWarningCategory <$> mb_cat) st wst')
 rnWarningTxt (DeprecatedTxt st wst) = do
   wst' <- traverse (traverse rnHsDoc) wst
   pure (DeprecatedTxt st wst')
 
+rnInWarningCategory :: InWarningCategory GhcPs -> InWarningCategory GhcRn
+rnInWarningCategory (InWarningCategory {iwc_in, iwc_st, iwc_wc}) =
+  InWarningCategory iwc_in iwc_st iwc_wc
+
 rnLWarningTxt :: LWarningTxt GhcPs -> RnM (LWarningTxt GhcRn)
 rnLWarningTxt (L loc warn) = L loc <$> rnWarningTxt warn
 


=====================================
compiler/GHC/Rename/Utils.hs
=====================================
@@ -73,7 +73,6 @@ import GHC.Data.Bag ( mapBagM, headMaybe )
 import Control.Monad
 import GHC.Settings.Constants ( mAX_TUPLE_SIZE, mAX_CTUPLE_SIZE )
 import GHC.Unit.Module
-import GHC.Unit.Module.Warnings  ( WarningTxt(..) )
 import GHC.Iface.Load
 import qualified GHC.LanguageExtensions as LangExt
 


=====================================
compiler/GHC/Tc/Deriv.hs
=====================================
@@ -35,7 +35,6 @@ import GHC.Core.FamInstEnv
 import GHC.Tc.Gen.HsType
 import GHC.Core.TyCo.Rep
 import GHC.Core.TyCo.Ppr ( pprTyVars )
-import GHC.Unit.Module.Warnings
 
 import GHC.Rename.Bind
 import GHC.Rename.Env


=====================================
compiler/GHC/Tc/Deriv/Utils.hs
=====================================
@@ -52,7 +52,6 @@ import GHC.Core.Type
 import GHC.Hs
 import GHC.Driver.Session
 import GHC.Unit.Module (getModule)
-import GHC.Unit.Module.Warnings
 import GHC.Unit.Module.ModIface (mi_fix)
 
 import GHC.Types.Fixity.Env (lookupFixity)


=====================================
compiler/GHC/Tc/Errors/Types.hs
=====================================
@@ -217,7 +217,6 @@ import Language.Haskell.Syntax.Basic (FieldLabelString(..))
 
 import qualified Data.List.NonEmpty as NE
 import           Data.Typeable (Typeable)
-import GHC.Unit.Module.Warnings (WarningCategory, WarningTxt)
 import qualified GHC.Internal.TH.Syntax as TH
 
 import GHC.Generics ( Generic )


=====================================
compiler/GHC/Tc/Types/Origin.hs
=====================================
@@ -64,7 +64,6 @@ import GHC.Core.PatSyn
 import GHC.Core.Multiplicity ( scaledThing )
 
 import GHC.Unit.Module
-import GHC.Unit.Module.Warnings
 import GHC.Types.Id
 import GHC.Types.Name
 import GHC.Types.Name.Reader


=====================================
compiler/GHC/Tc/Utils/Instantiate.hs
=====================================
@@ -93,7 +93,6 @@ import GHC.Utils.Unique (sameUnique)
 
 import GHC.Unit.State
 import GHC.Unit.External
-import GHC.Unit.Module.Warnings
 
 import Data.List ( mapAccumL )
 import qualified Data.List.NonEmpty as NE


=====================================
compiler/GHC/Unit/Module/Warnings.hs
=====================================
@@ -16,7 +16,6 @@ module GHC.Unit.Module.Warnings
    , mkWarningCategory
    , defaultWarningCategory
    , validWarningCategory
-   , InWarningCategory(..)
    , fromWarningCategory
 
    , WarningCategorySet
@@ -60,78 +59,20 @@ import GHC.Hs.Extension
 import GHC.Parser.Annotation
 
 import GHC.Utils.Outputable
-import GHC.Utils.Binary
 import GHC.Unicode
 
 import Language.Haskell.Syntax.Extension
+import Language.Haskell.Syntax.Decls (WarningTxt(..), InWarningCategory(..), XInWarningCategoryIn(), WarningCategory(..))
 
-import Data.Data
 import Data.List (isPrefixOf)
-import GHC.Generics ( Generic )
-import Control.DeepSeq
 
 
-{-
-Note [Warning categories]
-~~~~~~~~~~~~~~~~~~~~~~~~~
-See GHC Proposal 541 for the design of the warning categories feature:
-https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0541-warning-pragmas-with-categories.rst
 
-A WARNING pragma may be annotated with a category such as "x-partial" written
-after the 'in' keyword, like this:
-
-    {-# WARNING in "x-partial" head "This function is partial..." #-}
-
-This is represented by the 'Maybe (Located WarningCategory)' field in
-'WarningTxt'.  The parser will accept an arbitrary string as the category name,
-then the renamer (in 'rnWarningTxt') will check it contains only valid
-characters, so we can generate a nicer error message than a parse error.
-
-The corresponding warnings can then be controlled with the -Wx-partial,
--Wno-x-partial, -Werror=x-partial and -Wwarn=x-partial flags.  Such a flag is
-distinguished from an 'unrecognisedWarning' by the flag parser testing
-'validWarningCategory'.  The 'x-' prefix means we can still usually report an
-unrecognised warning where the user has made a mistake.
-
-A DEPRECATED pragma may not have a user-defined category, and is always treated
-as belonging to the special category 'deprecations'.  Similarly, a WARNING
-pragma without a category belongs to the 'deprecations' category.
-Thus the '-Wdeprecations' flag will enable all of the following:
-
-    {-# WARNING in "deprecations" foo "This function is deprecated..." #-}
-    {-# WARNING foo "This function is deprecated..." #-}
-    {-# DEPRECATED foo "This function is deprecated..." #-}
-
-The '-Wwarnings-deprecations' flag is supported for backwards compatibility
-purposes as being equivalent to '-Wdeprecations'.
-
-The '-Wextended-warnings' warning group collects together all warnings with
-user-defined categories, so they can be enabled or disabled
-collectively. Moreover they are treated as being part of other warning groups
-such as '-Wdefault' (see 'warningGroupIncludesExtendedWarnings').
-
-'DynFlags' and 'DiagOpts' each contain a set of enabled and a set of fatal
-warning categories, just as they do for the finite enumeration of 'WarningFlag's
-built in to GHC.  These are represented as 'WarningCategorySet's to allow for
-the possibility of them being infinite.
-
--}
-
-data InWarningCategory
-  = InWarningCategory
-    { iwc_in :: !(EpToken "in"),
-      iwc_st :: !SourceText,
-      iwc_wc :: (LocatedE WarningCategory)
-    } deriving Data
-
-fromWarningCategory :: WarningCategory -> InWarningCategory
+fromWarningCategory
+  :: NoAnn (XInWarningCategoryIn (GhcPass pass))
+  => WarningCategory -> InWarningCategory (GhcPass pass)
 fromWarningCategory wc = InWarningCategory noAnn NoSourceText (noLocA wc)
 
-
--- See Note [Warning categories]
-newtype WarningCategory = WarningCategory FastString
-  deriving (Binary, Data, Eq, Outputable, Show, Uniquable, NFData)
-
 mkWarningCategory :: FastString -> WarningCategory
 mkWarningCategory = WarningCategory
 
@@ -184,6 +125,9 @@ elemWarningCategorySet :: WarningCategory -> WarningCategorySet -> Bool
 elemWarningCategorySet c (FiniteWarningCategorySet   s) =      c `elementOfUniqSet` s
 elemWarningCategorySet c (CofiniteWarningCategorySet s) = not (c `elementOfUniqSet` s)
 
+-- TODO(orphans) This can eventually be moved into `Ghc.Types.Unique`
+deriving instance Uniquable WarningCategory
+
 -- | Insert an element into a warning category set.
 insertWarningCategorySet :: WarningCategory -> WarningCategorySet -> WarningCategorySet
 insertWarningCategorySet c (FiniteWarningCategorySet   s) = FiniteWarningCategorySet   (addOneToUniqSet   s c)
@@ -196,57 +140,43 @@ deleteWarningCategorySet c (CofiniteWarningCategorySet s) = CofiniteWarningCateg
 
 type LWarningTxt pass = XRec pass (WarningTxt pass)
 
--- | Warning Text
---
--- reason/explanation from a WARNING or DEPRECATED pragma
-data WarningTxt pass
-   = WarningTxt
-      (Maybe (LocatedE InWarningCategory))
-        -- ^ Warning category attached to this WARNING pragma, if any;
-        -- see Note [Warning categories]
-      SourceText
-      [LocatedE (WithHsDocIdentifiers StringLiteral pass)]
-   | DeprecatedTxt
-      SourceText
-      [LocatedE (WithHsDocIdentifiers StringLiteral pass)]
-  deriving Generic
-
 -- | To which warning category does this WARNING or DEPRECATED pragma belong?
 -- See Note [Warning categories].
-warningTxtCategory :: WarningTxt pass -> WarningCategory
+warningTxtCategory :: WarningTxt (GhcPass pass) -> WarningCategory
 warningTxtCategory (WarningTxt (Just (L _ (InWarningCategory _  _ (L _ cat)))) _ _) = cat
 warningTxtCategory _ = defaultWarningCategory
 
 -- | The message that the WarningTxt was specified to output
-warningTxtMessage :: WarningTxt p -> [LocatedE (WithHsDocIdentifiers StringLiteral p)]
+warningTxtMessage :: WarningTxt (GhcPass p) -> [LocatedE (WithHsDocIdentifiers StringLiteral (GhcPass p))]
 warningTxtMessage (WarningTxt _ _ m) = m
 warningTxtMessage (DeprecatedTxt _ m) = m
 
 -- | True if the 2 WarningTxts have the same category and messages
-warningTxtSame :: WarningTxt p1 -> WarningTxt p2 -> Bool
+warningTxtSame :: WarningTxt (GhcPass p1) -> WarningTxt (GhcPass p2) -> Bool
 warningTxtSame w1 w2
   = warningTxtCategory w1 == warningTxtCategory w2
   && literal_message w1 == literal_message w2
   && same_type
   where
-    literal_message :: WarningTxt p -> [StringLiteral]
+    literal_message :: WarningTxt (GhcPass p) -> [StringLiteral]
     literal_message = map (hsDocString . unLoc) . warningTxtMessage
     same_type | DeprecatedTxt {} <- w1, DeprecatedTxt {} <- w2 = True
               | WarningTxt {} <- w1, WarningTxt {} <- w2       = True
               | otherwise                                      = False
 
-deriving instance Eq InWarningCategory
-
-deriving instance (Eq (IdP pass)) => Eq (WarningTxt pass)
-deriving instance (Data pass, Data (IdP pass)) => Data (WarningTxt pass)
-
 type instance Anno (WarningTxt (GhcPass pass)) = SrcSpanAnnP
 
-instance Outputable InWarningCategory where
+-- TODO(orphans) This can eventually be moved to `GHC.Utils.Outputable`
+instance Outputable (InWarningCategory (GhcPass p)) where
   ppr (InWarningCategory _ _ wt) = text "in" <+> doubleQuotes (ppr wt)
 
+type instance Anno WarningCategory = EpaLocation
+
+-- TODO(orphans) This can eventually be moved to `GHC.Utils.Outputable`
+deriving instance Outputable WarningCategory
+
 
-instance Outputable (WarningTxt pass) where
+instance Outputable (WarningTxt (GhcPass p)) where
     ppr (WarningTxt mcat lsrc ws)
       = case lsrc of
             NoSourceText   -> pp_ws ws
@@ -267,8 +197,10 @@ pp_ws ws
     <+> vcat (punctuate comma (map (ppr . unLoc) ws))
     <+> text "]"
 
+type instance Anno (InWarningCategory p) = EpaLocation
+type instance Anno (WithHsDocIdentifiers StringLiteral p) = EpaLocation
 
-pprWarningTxtForMsg :: WarningTxt p -> SDoc
+pprWarningTxtForMsg :: WarningTxt (GhcPass p) -> SDoc
 pprWarningTxtForMsg (WarningTxt _ _ ws)
                      = doubleQuotes (vcat (map (ftext . sl_fs . hsDocString . unLoc) ws))
 pprWarningTxtForMsg (DeprecatedTxt _ ds)
@@ -314,7 +246,10 @@ type DeclWarnOccNames pass = [(OccName, WarningTxt pass)]
 -- | Names that are deprecated as exports
 type ExportWarnNames pass = [(Name, WarningTxt pass)]
 
-deriving instance Eq (IdP pass) => Eq (Warnings pass)
+deriving instance
+  ( Eq (IdP (GhcPass p)),
+    Eq (XInWarningCategoryIn (GhcPass p))
+  ) => Eq (Warnings (GhcPass p))
 
 emptyWarn :: Warnings p
 emptyWarn = WarnSome [] []


=====================================
compiler/Language/Haskell/Syntax/Decls.hs
=====================================
@@ -1,4 +1,3 @@
-
 {-# LANGUAGE ConstraintKinds #-}
 {-# LANGUAGE DataKinds #-}
 {-# LANGUAGE DeriveDataTypeable #-}
@@ -87,6 +86,9 @@ module Language.Haskell.Syntax.Decls (
 
   -- * Grouping
   HsGroup(..), hsGroupInstDecls,
+  -- * Warnings
+  WarningTxt(..), InWarningCategory(..), WarningCategory(..),
+  XInWarningCategoryIn,
     ) where
 
 -- friends:
@@ -105,10 +107,10 @@ import GHC.Types.ForeignCall (CType, CCallConv, Safety, Header, CLabelString, CC
 import GHC.Types.Fixity (LexicalFixity)
 
 import GHC.Core.Type (Specificity)
-import GHC.Unit.Module.Warnings (WarningTxt)
 import GHC.Utils.Panic.Plain ( assert )
 
-import GHC.Hs.Doc (LHsDoc) -- ROMES:TODO Discuss in #21592 whether this is parsed AST or base AST
+import GHC.Hs.Doc (LHsDoc, WithHsDocIdentifiers) -- ROMES:TODO Discuss in #21592 whether this is parsed AST or base AST
+import GHC.Types.SourceText (StringLiteral, SourceText)
 
 import Control.Monad
 import Data.Data        hiding (TyCon, Fixity, Infix)
@@ -124,6 +126,12 @@ import qualified Data.List
 import Data.Foldable
 import Data.Traversable
 import Data.List.NonEmpty (NonEmpty (..))
+import GHC.Data.FastString (FastString)
+-- TODO(no-ghc-import) OK
+import GHC.Generics (Generic)
+import Control.DeepSeq (NFData)
+-- TODO(ghc-import) This can eventually be defined in `GHC.Utils.Binary`
+import GHC.Utils.Binary (Binary)
 
 {-
 ************************************************************************
@@ -1783,3 +1791,100 @@ data RoleAnnotDecl pass
 
       -- For details on above see Note [exact print annotations] in GHC.Parser.Annotation
   | XRoleAnnotDecl !(XXRoleAnnotDecl pass)
+
+-- | Warning Text
+--
+-- reason/explanation from a WARNING or DEPRECATED pragma
+data WarningTxt pass
+   = WarningTxt
+      (Maybe (XRec pass (InWarningCategory pass)))
+        -- ^ Warning category attached to this WARNING pragma, if any;
+        -- see Note [Warning categories]
+      SourceText
+      [XRec pass (WithHsDocIdentifiers StringLiteral pass)]
+   | DeprecatedTxt
+      SourceText
+      [XRec pass (WithHsDocIdentifiers StringLiteral pass)]
+  deriving (Generic)
+
+deriving instance
+  ( Eq (XRec pass (InWarningCategory pass)),
+    Eq (XRec pass (WithHsDocIdentifiers StringLiteral pass))
+  ) => Eq (WarningTxt pass)
+
+{-
+Note [Warning categories]
+~~~~~~~~~~~~~~~~~~~~~~~~~
+See GHC Proposal 541 for the design of the warning categories feature:
+https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0541-warning-pragmas-with-categories.rst
+
+A WARNING pragma may be annotated with a category such as "x-partial" written
+after the 'in' keyword, like this:
+
+    {-# WARNING in "x-partial" head "This function is partial..." #-}
+
+This is represented by the 'Maybe (Located WarningCategory)' field in
+'WarningTxt'.  The parser will accept an arbitrary string as the category name,
+then the renamer (in 'rnWarningTxt') will check it contains only valid
+characters, so we can generate a nicer error message than a parse error.
+
+The corresponding warnings can then be controlled with the -Wx-partial,
+-Wno-x-partial, -Werror=x-partial and -Wwarn=x-partial flags.  Such a flag is
+distinguished from an 'unrecognisedWarning' by the flag parser testing
+'validWarningCategory'.  The 'x-' prefix means we can still usually report an
+unrecognised warning where the user has made a mistake.
+
+A DEPRECATED pragma may not have a user-defined category, and is always treated
+as belonging to the special category 'deprecations'.  Similarly, a WARNING
+pragma without a category belongs to the 'deprecations' category.
+Thus the '-Wdeprecations' flag will enable all of the following:
+
+    {-# WARNING in "deprecations" foo "This function is deprecated..." #-}
+    {-# WARNING foo "This function is deprecated..." #-}
+    {-# DEPRECATED foo "This function is deprecated..." #-}
+
+The '-Wwarnings-deprecations' flag is supported for backwards compatibility
+purposes as being equivalent to '-Wdeprecations'.
+
+The '-Wextended-warnings' warning group collects together all warnings with
+user-defined categories, so they can be enabled or disabled
+collectively. Moreover they are treated as being part of other warning groups
+such as '-Wdefault' (see 'warningGroupIncludesExtendedWarnings').
+
+'DynFlags' and 'DiagOpts' each contain a set of enabled and a set of fatal
+warning categories, just as they do for the finite enumeration of 'WarningFlag's
+built in to GHC.  These are represented as 'WarningCategorySet's to allow for
+the possibility of them being infinite.
+
+-}
+
+data InWarningCategory pass
+  = InWarningCategory
+    { iwc_in :: !(XInWarningCategoryIn pass),
+      iwc_st :: !SourceText,
+      iwc_wc :: (XRec pass WarningCategory)
+    }
+
+
+type family XInWarningCategoryIn p
+
+deriving instance
+  (
+    Eq (XInWarningCategoryIn pass),
+    Eq (XRec pass WarningCategory)
+  )
+  => Eq (InWarningCategory pass)
+
+deriving instance Typeable (InWarningCategory pass)
+
+deriving instance
+  ( Data pass,
+    Data (XInWarningCategoryIn pass),
+    Data (XRec pass WarningCategory)
+  )
+  => Data (InWarningCategory pass)
+
+
+-- See Note [Warning categories]
+newtype WarningCategory = WarningCategory FastString
+  deriving (Binary, Data, Eq, Show, NFData)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/575ddac47f7f499a0817b51709c5f5c716d36598...523dd6642535c234d0bfd40fe80c679db281779b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/575ddac47f7f499a0817b51709c5f5c716d36598...523dd6642535c234d0bfd40fe80c679db281779b
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240609/d39d5405/attachment-0001.html>


More information about the ghc-commits mailing list