[Git][ghc/ghc][wip/sand-witch/warning-depracated-flag] Fix phrasing

Andrei Borzenkov (@sand-witch) gitlab at gitlab.haskell.org
Mon Feb 5 15:41:43 UTC 2024



Andrei Borzenkov pushed to branch wip/sand-witch/warning-depracated-flag at Glasgow Haskell Compiler / GHC


Commits:
2cfcfa5c by Andrei Borzenkov at 2024-02-05T19:41:29+04:00
Fix phrasing

- - - - -


6 changed files:

- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- docs/users_guide/9.10.1-notes.rst
- docs/users_guide/exts/pragmas.rst
- libraries/ghc-prim/GHC/Tuple.hs
- testsuite/tests/warnings/should_fail/T24396c.stderr


Changes:

=====================================
compiler/GHC/Tc/Errors/Ppr.hs
=====================================
@@ -1889,15 +1889,15 @@ instance Diagnostic TcRnMessage where
             | otherwise
             = text "they are not unfilled metavariables"
 
-    TcRnNamespacedWarningPragmaWithoutFlag warning -> mkSimpleDecorated $
-      vcat [ text "Syntax error on:"
+    TcRnNamespacedWarningPragmaWithoutFlag warning@(Warning (kw, _) _ txt) -> mkSimpleDecorated $
+      vcat [ text "Illegal use of the" <+> quotes (ppr kw) <+> text "keyword:"
            , nest 2 (ppr warning)
            , text "in a" <+> pragma_type <+> text "pragma"
            ]
       where
-        pragma_type = case warning of
-          Warning _ _ WarningTxt{} -> text "warning"
-          Warning _ _ DeprecatedTxt{} -> text "deprecation"
+        pragma_type = case txt of
+          WarningTxt{} -> text "WARNING"
+          DeprecatedTxt{} -> text "DEPRECATED"
 
   diagnosticReason :: TcRnMessage -> DiagnosticReason
   diagnosticReason = \case


=====================================
compiler/GHC/Tc/Errors/Types.hs
=====================================
@@ -4205,9 +4205,9 @@ data TcRnMessage where
       -> NE.NonEmpty TcTyVar  -- ^ The invalid type variables of the proposal
       -> TcRnMessage
 
-  {-| TcRnNamespacedWarningPragmaWithoutFlagis an error that occurs when
+  {-| TcRnNamespacedWarningPragmaWithoutFlag is an error that occurs when
       a namespace specifier is used in {-# WARNING ... #-} or {-# DEPRECATED ... #-}
-      pragmas without -XExplicitNamespaces extension enabled
+      pragmas without the -XExplicitNamespaces extension enabled
 
   -}
   TcRnNamespacedWarningPragmaWithoutFlag :: WarnDecl GhcPs -> TcRnMessage


=====================================
docs/users_guide/9.10.1-notes.rst
=====================================
@@ -75,10 +75,10 @@ Language
 
 - GHC Proposal `#65 <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0065-type-infix.rst>`_
   "Require namespacing fixity declarations for type names and WARNING/DEPRECATED pragmas" has been partially implemented.
-  Now, with the :extension:`ExplicitNamespaces` enabled, you can specify
+  Now, with :extension:`ExplicitNamespaces` enabled, you can specify the
   namespace of a name that you want to warn about or deprecate: ::
 
-    {-# DEPRACATED type D "Use `()` instead" #-} -- this will deprecate type D, but will not touch pattern synonym
+    {-# DEPRECATED type D "Use `()` instead" #-} -- this will deprecate type D, but will not touch pattern synonym
     data D = MkD
 
     {-# DEPRECATED data D "Use `MkD` instead" #-} -- this will deprecate pattern synonym only


=====================================
docs/users_guide/exts/pragmas.rst
=====================================
@@ -252,7 +252,7 @@ When a deprecated name appears in both value and type namespaces (i.e. punning o
 
 It is possible to specify the namespace of the name to be warned about
 or deprecated using ``type`` and ``data`` specifiers, but this feature
-requires the enabling of the :extension:`ExplicitNamespaces`: ::
+requires enabling :extension:`ExplicitNamespaces`: ::
 
     {-# LANGUAGE PatternSynonyms #-}
 


=====================================
libraries/ghc-prim/GHC/Tuple.hs
=====================================
@@ -1,5 +1,5 @@
 {-# LANGUAGE Trustworthy #-}
-{-# LANGUAGE NoImplicitPrelude, PatternSynonyms #-}
+{-# LANGUAGE NoImplicitPrelude, PatternSynonyms, ExplicitNamespaces #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  GHC.Tuple


=====================================
testsuite/tests/warnings/should_fail/T24396c.stderr
=====================================
@@ -1,24 +1,24 @@
 
 T24396c.hs:7:13: error: [GHC-14995]
-    Syntax error on:
+    Illegal use of the ‘data’ keyword:
       data f "warning on data level"
-    in a warning pragma
+    in a WARNING pragma
     Suggested fix: Perhaps you intended to use ExplicitNamespaces
 
 T24396c.hs:11:13: error: [GHC-14995]
-    Syntax error on:
+    Illegal use of the ‘type’ keyword:
       type F "warning on type level"
-    in a warning pragma
+    in a WARNING pragma
     Suggested fix: Perhaps you intended to use ExplicitNamespaces
 
 T24396c.hs:16:16: error: [GHC-14995]
-    Syntax error on:
+    Illegal use of the ‘data’ keyword:
       data g "deprecation on data level"
-    in a deprecation pragma
+    in a DEPRECATED pragma
     Suggested fix: Perhaps you intended to use ExplicitNamespaces
 
 T24396c.hs:20:16: error: [GHC-14995]
-    Syntax error on:
+    Illegal use of the ‘type’ keyword:
       type G "deprecation on type level"
-    in a deprecation pragma
+    in a DEPRECATED pragma
     Suggested fix: Perhaps you intended to use ExplicitNamespaces



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2cfcfa5c9b0836de62c8a8130cd4942a2a1d6b98

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2cfcfa5c9b0836de62c8a8130cd4942a2a1d6b98
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/20240205/ea08f27e/attachment-0001.html>


More information about the ghc-commits mailing list