[Git][ghc/ghc][wip/romes/25330] Deprecation for WarnCompatUnqualifiedImports

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Thu Oct 3 13:22:25 UTC 2024



Rodrigo Mesquita pushed to branch wip/romes/25330 at Glasgow Haskell Compiler / GHC


Commits:
69fae256 by Rodrigo Mesquita at 2024-10-03T14:22:14+01:00
Deprecation for WarnCompatUnqualifiedImports

Fixes #25330

- - - - -


30 changed files:

- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- docs/users_guide/using-warnings.rst
- libraries/base/tests/T9586.hs
- libraries/base/tests/list001.hs
- testsuite/tests/ghci/scripts/T14828.script
- testsuite/tests/ghci/scripts/ghci024.stdout
- testsuite/tests/ghci/scripts/ghci024.stdout-mingw32
- testsuite/tests/ghci/scripts/ghci036.script
- testsuite/tests/module/Mod137_A.hs
- testsuite/tests/module/Mod138_A.hs
- testsuite/tests/module/Mod141_A.hs
- testsuite/tests/module/mod154.hs
- testsuite/tests/overloadedlists/should_run/overloadedlistsrun05.hs
- testsuite/tests/perf/compiler/T16875.hs
- testsuite/tests/rename/prog001/rn037.hs
- testsuite/tests/rename/should_compile/T17244A.hs
- + testsuite/tests/rename/should_compile/T17244A.stderr
- testsuite/tests/rename/should_compile/T17244B.hs
- testsuite/tests/rename/should_compile/T17244B.stderr
- testsuite/tests/rename/should_compile/T17244C.hs
- testsuite/tests/rename/should_compile/T17244C.stderr
- testsuite/tests/rename/should_compile/T4478.hs
- testsuite/tests/rename/should_compile/T7167.hs
- testsuite/tests/rename/should_compile/rn025.hs
- testsuite/tests/rename/should_compile/rn027.hs
- testsuite/tests/rename/should_compile/rn031.hs
- testsuite/tests/rename/should_compile/rn060.hs
- testsuite/tests/safeHaskell/unsafeLibs/GoodImport03.hs
- testsuite/tests/warnings/should_compile/T11077.hs


Changes:

=====================================
compiler/GHC/Driver/Flags.hs
=====================================
@@ -1370,8 +1370,7 @@ minusWeverythingOpts = [ toEnum 0 .. ]
 -- code future compatible to fix issues before they even generate warnings.
 minusWcompatOpts :: [WarningFlag]
 minusWcompatOpts
-    = [ Opt_WarnCompatUnqualifiedImports
-      , Opt_WarnImplicitRhsQuantification
+    = [ Opt_WarnImplicitRhsQuantification
       , Opt_WarnDeprecatedTypeAbstractions
       ]
 


=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -2328,7 +2328,8 @@ wWarningFlagsDeps = [minBound..maxBound] >>= \x -> case x of
   Opt_WarnPartialFields -> warnSpec x
   Opt_WarnPrepositiveQualifiedModule -> warnSpec x
   Opt_WarnUnusedPackages -> warnSpec x
-  Opt_WarnCompatUnqualifiedImports -> warnSpec x
+  Opt_WarnCompatUnqualifiedImports ->
+    depWarnSpec x "This warning no longer does anything; see GHC #24904"
   Opt_WarnInvalidHaddock -> warnSpec x
   Opt_WarnOperatorWhitespaceExtConflict -> warnSpec x
   Opt_WarnOperatorWhitespace -> warnSpec x


=====================================
docs/users_guide/using-warnings.rst
=====================================
@@ -169,7 +169,6 @@ as ``-Wno-...`` for every individual warning in the group.
     .. hlist::
         :columns: 3
 
-        * :ghc-flag:`-Wcompat-unqualified-imports`
         * :ghc-flag:`-Wimplicit-rhs-quantification`
         * :ghc-flag:`-Wdeprecated-type-abstractions`
 
@@ -296,25 +295,16 @@ of ``-W(no-)*``.
     recognised.
 
 .. ghc-flag:: -Wcompat-unqualified-imports
-    :shortdesc: Report unqualified imports of core libraries which are expected
-      to cause compatibility problems in future releases.
+    :shortdesc: *(deprecated)*
+        Report unqualified imports of core libraries which are expected
+        to cause compatibility problems in future releases.
     :type: dynamic
     :reverse: -Wno-compat-unqualified-imports
     :category:
 
     :since: 8.10
 
-    Warns on unqualified imports of core library modules which are subject to
-    change in future GHC releases. Currently the following modules are covered
-    by this warning:
-
-     - ``Data.List`` due to the future addition of ``Data.List.singleton`` and
-       specialisation of exports to the ``[]`` type. See the
-       `mailing list <https://groups.google.com/forum/#!topic/haskell-core-libraries/q3zHLmzBa5E>`_
-       for details.
-
-    This warning can be addressed by either adding an explicit import list or
-    using a ``qualified`` import.
+    This warning is deprecated. It no longer has any effect since GHC 9.12.
 
 .. ghc-flag:: -Wprepositive-qualified-module
     :shortdesc: Report imports with a leading/prepositive "qualified"


=====================================
libraries/base/tests/T9586.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 module XPrelude (module X) where
 
 import Control.Monad    as X


=====================================
libraries/base/tests/list001.hs
=====================================
@@ -1,5 +1,4 @@
 {-# LANGUAGE CPP #-}
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
 module Main where
 
 import Data.List


=====================================
testsuite/tests/ghci/scripts/T14828.script
=====================================
@@ -14,7 +14,6 @@
 :p mempty
 :p mappend
 
-:set -Wno-compat-unqualified-imports
 :m + Data.List
 :p foldl'
 


=====================================
testsuite/tests/ghci/scripts/ghci024.stdout
=====================================
@@ -16,9 +16,9 @@ other dynamic, non-language, flag settings:
   -fprefer-byte-code
   -fbreak-points
 warning settings:
-  -Wcompat-unqualified-imports
   -Wimplicit-rhs-quantification
   -Wdeprecated-type-abstractions
+  -Wcompat-unqualified-imports
 ~~~~~~~~~~ Testing :set -a
 options currently set: none.
 base language is: GHC2021


=====================================
testsuite/tests/ghci/scripts/ghci024.stdout-mingw32
=====================================
@@ -15,9 +15,9 @@ other dynamic, non-language, flag settings:
   -fprefer-byte-code
   -fbreak-points
 warning settings:
-  -Wcompat-unqualified-imports
   -Wimplicit-rhs-quantification
   -Wdeprecated-type-abstractions
+  -Wcompat-unqualified-imports
 ~~~~~~~~~~ Testing :set -a
 options currently set: none.
 base language is: GHC2021


=====================================
testsuite/tests/ghci/scripts/ghci036.script
=====================================
@@ -1,4 +1,3 @@
-:set -Wno-compat-unqualified-imports
 import Data.List (nub)
 :t nubBy
 import Data.List (nubBy)


=====================================
testsuite/tests/module/Mod137_A.hs
=====================================
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
 module Mod137_A (module Data.Char) where
 
 import Data.Char


=====================================
testsuite/tests/module/Mod138_A.hs
=====================================
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
 module Mod138_A (module Data.Char) where
 
 import qualified Data.Char


=====================================
testsuite/tests/module/Mod141_A.hs
=====================================
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
 module Mod141_A (partition, module Data.List) where
 
 import Data.List hiding (partition)


=====================================
testsuite/tests/module/mod154.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 -- !!! Default export list isn't the same as (module M)
 -- This should succeed, exporting only the local 'sort',
 -- and not being confused by the 'sort' from 'List'.


=====================================
testsuite/tests/overloadedlists/should_run/overloadedlistsrun05.hs
=====================================
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
 {-# LANGUAGE OverloadedLists, TypeFamilies, RebindableSyntax #-}
 
 import Prelude


=====================================
testsuite/tests/perf/compiler/T16875.hs
=====================================
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
 module T16875 where
 
 import Control.Applicative


=====================================
testsuite/tests/rename/prog001/rn037.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 -- !!! Checking that you can hide a constructor
 module ShouldCompile where
 


=====================================
testsuite/tests/rename/should_compile/T17244A.hs
=====================================
@@ -2,7 +2,8 @@
 
 module T17244A (hello) where
 
--- This should warn with -Wcompat-unqualified-imports.
+-- This used to warn with -Wcompat-unqualified-imports.
+-- Now it shows the flag is deprecated.
 import Data.List
 
 hello :: [Int] -> Int


=====================================
testsuite/tests/rename/should_compile/T17244A.stderr
=====================================
@@ -0,0 +1,6 @@
+on the commandline: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
+    -Wno-error=compat-unqualified-imports is deprecated: This warning no longer does anything; see GHC #24904
+
+T17244A.hs:1:17: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
+    -Wcompat-unqualified-imports is deprecated: This warning no longer does anything; see GHC #24904
+


=====================================
testsuite/tests/rename/should_compile/T17244B.hs
=====================================
@@ -2,7 +2,8 @@
 
 module T17244B (hello) where
 
--- This should not warn with -Wcompat-unqualified-imports.
+-- This wouldn't warn with -Wcompat-unqualified-imports.
+-- The flag is deprecated now.
 import qualified Data.List as List
 
 hello :: [Int] -> Int


=====================================
testsuite/tests/rename/should_compile/T17244B.stderr
=====================================
@@ -0,0 +1,3 @@
+T17244B.hs:1:17: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
+    -Wcompat-unqualified-imports is deprecated: This warning no longer does anything; see GHC #24904
+


=====================================
testsuite/tests/rename/should_compile/T17244C.hs
=====================================
@@ -2,7 +2,8 @@
 
 module T17244C (hello) where
 
--- This should not warn with -Wcompat-unqualified-imports.
+-- This would not warn with -Wcompat-unqualified-imports.
+-- The flag is deprecated now.
 import Data.List (sum)
 
 hello :: [Int] -> Int


=====================================
testsuite/tests/rename/should_compile/T17244C.stderr
=====================================
@@ -0,0 +1,3 @@
+T17244C.hs:1:17: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
+    -Wcompat-unqualified-imports is deprecated: This warning no longer does anything; see GHC #24904
+


=====================================
testsuite/tests/rename/should_compile/T4478.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 -- We don't want to warn about duplicate exports for things exported
 -- by both "module" exports
 module T4478 (module Prelude, module Data.List) where


=====================================
testsuite/tests/rename/should_compile/T7167.hs
=====================================
@@ -1,4 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
 {-# OPTIONS_GHC -fwarn-dodgy-imports #-}
 
 module T7167 where


=====================================
testsuite/tests/rename/should_compile/rn025.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 -- !!! Re-exporting a module whose contents is partially hidden.
 module ShouldCompile ( module Data.List ) where
 


=====================================
testsuite/tests/rename/should_compile/rn027.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 -- !!! Checking that an imported module may still have
 -- !!! a local alias without having used 'qualified'.
 module ShouldCompile where


=====================================
testsuite/tests/rename/should_compile/rn031.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 -- !!! Checking that an imported module may still have
 -- !!! a local alias without having used 'qualified'.
 module ShouldCompile where


=====================================
testsuite/tests/rename/should_compile/rn060.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 module Foo (module Data.List) where
 
 import Data.List


=====================================
testsuite/tests/safeHaskell/unsafeLibs/GoodImport03.hs
=====================================
@@ -47,7 +47,7 @@ import Data.Functor
 import Data.IORef
 import Data.Int
 import Data.Ix
-import Data.List ()  -- -Wno-compat-unqualified-imports
+import Data.List
 import Data.Maybe
 import Data.Monoid
 import Data.Ord


=====================================
testsuite/tests/warnings/should_compile/T11077.hs
=====================================
@@ -1,5 +1,3 @@
-{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
-
 module T11077 (module X, foo) where
 import Data.List as X
 foo = undefined



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/69fae2568ea30da25d91d8e423cef68cd18a0df5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/69fae2568ea30da25d91d8e423cef68cd18a0df5
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/20241003/7e5294d8/attachment-0001.html>


More information about the ghc-commits mailing list