Commit c8c15e0d authored by Ben Gamari's avatar Ben Gamari 🐢

testsuite: Fix -Wcompat-unqualified-imports issues

parent 2626debc
import System.IO
import GHC.IO.Handle
import Control.Monad
import Data.List
import Data.List (intercalate)
newlines = ["\n","\r","\r\n","\n\r","\n\n","\r\r"]
......
......@@ -12,7 +12,7 @@ import Control.Exception
import Data.STRef
import Data.IORef
import Control.Concurrent.MVar
import Data.List
import Data.List (foldl')
-- evil ST action that tries to synchronize (by busy waiting on the
-- shared STRef) with a concurrent evaluation
......
import Data.List
import Data.List (iterate')
-- this should evaluate in constant space
main :: IO ()
......
{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
module XPrelude (module X) where
import Control.Monad as X
......
-- Test for https://gitlab.haskell.org/ghc/ghc/issues/2533
import System.Environment
import Data.List
import qualified Data.List as L
main = do
(n:_) <- getArgs
print (genericTake (read n) "none taken")
print (genericDrop (read n) "none dropped")
print (genericSplitAt (read n) "none split")
print (L.genericTake (read n) "none taken")
print (L.genericDrop (read n) "none dropped")
print (L.genericSplitAt (read n) "none split")
{-# LANGUAGE RankNTypes #-}
module Main (main) where
import Data.List
import Data.List (reverse, scanl, inits)
-- A simple implementation of inits that should be obviously correct.
{-# NOINLINE initsR #-}
......
module Main (main) where
import Data.List
import Data.List (isSuffixOf)
needles = ["","1","2","12","123","1234"]
haystacks = ["","a","ab","abc","1","2","3","a1","1a",
......
module Main (main) where
import Data.List
import Data.List (genericLength)
main :: IO ()
main = do print (genericLength [1..10000000] :: Int)
......
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
module Main where
import Data.List
......
-- !!! Test that List.sortBy is stable.
import Data.List
import Data.List (sortBy)
main = print (sortBy (\(a,b) (a',b')->compare a a')
([1,1,1,1,1,1,1,1,1,1]`zip`[1..10]))
import Control.Concurrent
import Control.Exception
import Control.Monad
import Data.List
import Data.List (sort)
new = newQSemN
wait = waitQSemN
......
import Control.Exception
import Data.List
import Data.List (isPrefixOf, isSuffixOf)
import System.FilePath
import System.Directory
import System.IO
......
......@@ -14,7 +14,7 @@ import Config
import Annrun01_Help
import qualified Language.Haskell.TH as TH
import Data.List
import Data.List (sortBy)
import Data.Function
main :: IO ()
......
{-# OPTIONS_GHC -funbox-strict-fields #-}
import Data.List
data Vec4 = Vec4 !Float !Float !Float !Float
......
......@@ -6,7 +6,7 @@ module Main where
-- specified. Through a process of elimination I've managed to reproduce
-- the problemin the following (much simpler) piece of code:
import Data.List
import Data.List (groupBy)
test es =
concat (groupBy eq (zip [0..(length es) - 1] es))
......
......@@ -8,7 +8,7 @@ module Main (main) where
import Control.Monad
import Control.Monad.ST
import Data.List
import Data.List (sort, intercalate)
import GHC.Exts (Int (..))
import GHC.Prim
import GHC.ST (ST (ST))
......
import Control.Concurrent
import Control.Exception
import Data.List
import System.Mem
-- !!! test that a child thread waiting on its own MVar will get killed by
......
import Control.Concurrent
import GHC.Conc
import Data.List
import Data.Maybe
main = do
......
......@@ -7,7 +7,7 @@
module Main (main) where
import Control.Monad
import Data.List
import Data.List ( (\\) )
import DynFlags
import Language.Haskell.Extension
......
......@@ -5,7 +5,6 @@ import Foreign.Concurrent as Conc
import Foreign
import GHC.TopHandler
import Control.Concurrent
import Data.List
import System.Mem
-- This finalizer calls back into Haskell, so we can't use
......
......@@ -3,7 +3,7 @@ module Main where
import DynFlags
import Control.Monad
import Data.List
import Data.List (isPrefixOf)
-- Verify bogus flags aren't printed on flagsForCompletion and
-- allNonDeprecatedFlags:
......
......@@ -4,7 +4,7 @@ module Main where
-- import Data.Generics
import Data.Data
import Data.List
import Data.List (intercalate)
import System.IO
import GHC
import DynFlags
......
......@@ -5,7 +5,7 @@ module Main where
import BasicTypes
import Data.Data
import Data.List
import Data.List (intercalate)
import System.IO
import GHC
import DynFlags
......
......@@ -4,7 +4,7 @@
module Test10313 where
import "b\x61se" Data.List
import "b\x61se" Data.List ()
{-# WARNING Logic
, solverCheckAndGetModel
......
......@@ -6,7 +6,7 @@ module Main where
-- import Data.Generics
import Data.Data
import Data.List
import Data.List (intercalate)
import System.IO
import GHC
import DynFlags
......
......@@ -6,7 +6,7 @@ module Main where
-- import Data.Generics
import Data.Data
import Data.List
import Data.List (intercalate)
import System.IO
import GHC
import DynFlags
......
......@@ -6,7 +6,7 @@ module Main where
-- import Data.Generics
import Data.Data
import Data.List
import Data.List (intercalate)
import System.IO
import GHC
import BasicTypes
......
......@@ -6,7 +6,7 @@ module Main where
-- import Data.Generics
import Data.Data
import Data.List
import Data.List (intercalate)
import System.IO
import GHC
import BasicTypes
......
......@@ -8,7 +8,7 @@ module Main where
-- import Data.Generics
import Data.Data
import Data.List
import Data.List (intercalate)
import System.IO
import GHC
import BasicTypes
......
......@@ -8,7 +8,7 @@ module Main where
-- import Data.Generics
import Data.Data hiding (Fixity)
import Data.List
import Data.List (intercalate)
import System.IO
import GHC
import BasicTypes
......
......@@ -6,7 +6,7 @@ import DynFlags
import Finder
import Control.Monad.IO.Class (liftIO)
import Data.List
import Data.List (sort, stripPrefix)
import Data.Either
import System.Environment
......
......@@ -14,7 +14,7 @@ import Control.Monad
import Control.Monad.IO.Class (liftIO)
import Control.Exception
import Data.IORef
import Data.List
import Data.List (sort, find, stripPrefix, isPrefixOf, isSuffixOf)
import Data.Either
import System.Environment
......
......@@ -7,7 +7,7 @@ import GHC
import Control.Monad
import Control.Monad.IO.Class (liftIO)
import Data.List
import Data.List (intercalate)
import Data.Maybe
import Data.Time.Calendar
import Data.Time.Clock
......
......@@ -37,7 +37,7 @@ T9086:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":main" T9086.hs
T9905:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Data.List" -e "sort [2,1]"
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Data.List (sort)" -e "sort [2,1]"
T9905b:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import qualified Data.List as L" -e "L.sort [2,1]"
......
:! cp A1.hs A.hs
import Data.List
import Data.List (nub)
:load A
-- Data.List should still be in scope:
:t nub
......
......@@ -4,4 +4,4 @@ module B
) where
import A
import Data.List
import Data.Tuple
......@@ -11,9 +11,9 @@ A.hs:8:15: warning: [-Wunused-matches (in -Wextra)]
Defined but not used: ‘x’
B.hs:7:1: warning: [-Wunused-imports (in -Wextra)]
The import of ‘Data.List’ is redundant
except perhaps to import instances from ‘Data.List
To import instances alone, use: import Data.List()
The import of ‘Data.Tuple’ is redundant
except perhaps to import instances from ‘Data.Tuple
To import instances alone, use: import Data.Tuple()
C.hs:6:7: error: Variable not in scope: variableNotInScope :: ()
Failed, two modules loaded.
......
......@@ -14,6 +14,7 @@
:p mempty
:p mappend
:set -Wno-compat-unqualified-imports
:m + Data.List
:p foldl'
......
data A = X
data A = Y
:i A
:m Data.List
:m Data.Tuple
:i A
......@@ -17,6 +17,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is not enabled
options currently set: none.
base language is: Haskell2010
......@@ -40,6 +41,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should work, GADTs is in force from :set
options currently set: none.
base language is: Haskell2010
......@@ -62,6 +64,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is now disabled
base language is: Haskell2010
with the following modifiers:
......@@ -86,5 +89,6 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is only enabled at the prompt
C :: T Int
......@@ -16,6 +16,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is not enabled
options currently set: none.
base language is: Haskell2010
......@@ -38,6 +39,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should work, GADTs is in force from :set
options currently set: none.
base language is: Haskell2010
......@@ -59,6 +61,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is now disabled
base language is: Haskell2010
with the following modifiers:
......@@ -82,5 +85,6 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is only enabled at the prompt
C :: T Int
import Data.List
import Data.List (sort)
main = print (sort [100,99..1])
......@@ -18,6 +18,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
~~~~~~~~~~ Testing :set -a
options currently set: none.
base language is: Haskell2010
......
......@@ -17,6 +17,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
~~~~~~~~~~ Testing :set -a
options currently set: none.
base language is: Haskell2010
......
:set -Wno-compat-unqualified-imports
import Data.List (nub)
:t nubBy
import Data.List (nubBy)
......@@ -16,4 +17,4 @@ import qualified Data.List as L
:m -Data.List
:t L.nub
:m Prelude
:t nub
\ No newline at end of file
:t nub
module Foo where
import Data.List
import Data.List (map)
x = map
......@@ -38,9 +38,9 @@ import Prelude ()
import Prelude
:show imports
import Data.List hiding (nub)
import Data.Tuple hiding (swap)
:show imports
import qualified Data.List as Q
import qualified Data.Tuple as Q
:show imports
:m -Data.List
:m -Data.Tuple
:show imports
......@@ -22,10 +22,10 @@ x :: (a -> b) -> [a] -> [b]
import Prelude
:module +*Foo
import Prelude
import Data.List hiding ( nub )
import Data.Tuple hiding ( swap )
:module +*Foo
import Prelude
import Data.List hiding ( nub )
import qualified Data.List as Q
import Data.Tuple hiding ( swap )
import qualified Data.Tuple as Q
:module +*Foo
import Prelude
......@@ -17,6 +17,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is not enabled
options currently set: none.
base language is: Haskell2010
......@@ -40,6 +41,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should work, GADTs is in force from :set
options currently set: none.
base language is: Haskell2010
......@@ -62,6 +64,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is now disabled
base language is: Haskell2010
with the following modifiers:
......@@ -86,5 +89,6 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is only enabled at the prompt
C :: T Int
......@@ -16,6 +16,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is not enabled
options currently set: none.
base language is: Haskell2010
......@@ -38,6 +39,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should work, GADTs is in force from :set
options currently set: none.
base language is: Haskell2010
......@@ -59,6 +61,7 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is now disabled
base language is: Haskell2010
with the following modifiers:
......@@ -82,5 +85,6 @@ warning settings:
-Wsemigroup
-Wnoncanonical-monoid-instances
-Wstar-is-type
-Wcompat-unqualified-imports
Should fail, GADTs is only enabled at the prompt
C :: T Int
import Data.Maybe
import Data.List
import Data.List (intersperse)
data Dir = R | D | L | U deriving (Show, Eq, Enum)
type Spiral = ([[Int]], Int, Dir) -- (rows, current row, next direction)
......
{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
module Mod137_A (module Data.Char) where
import Data.Char
......
{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
module Mod138_A (module Data.Char) where
import qualified Data.Char
......
{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
module Mod141_A (partition, module Data.List) where
import Data.List hiding (partition)
......
{-# 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'.
......
......@@ -6,7 +6,7 @@ import GHC.Exts
import Control.Monad
import Data.Bits
import Data.List
import Data.List (sort, group)
import System.Exit
allEqual :: Eq a => [a] -> Bool
......
import Control.Monad
import Data.Bits
import Data.List
import Data.List (sortBy)
import Data.Ord
-- | test-values to use as numerator/denominator
......
{-# OPTIONS_GHC -Wno-compat-unqualified-imports #-}
{-# LANGUAGE OverloadedLists, TypeFamilies, RebindableSyntax #-}
import Prelude
import Data.List
main = do print []
print [0,3..20]
print [3]
main = do print []
print [0,3..20]
print [3]
print [2..7]
print [20,2]
print [1,2,37]
fromListN _ = length
fromListN _ = length
fromList = length
......@@ -2,7 +2,7 @@
module Foo where
import Data.List
import Data.List (inits)
import GHC.Exts
foo = [ ()
......
......@@ -2,8 +2,8 @@
-- !!! be empty.
module ShouldCompile where
import Data.List ()
import Data.List hiding ()
import Data.Tuple ()
import Data.Tuple hiding ()
x :: Int
x = 1
......
......@@ -2,7 +2,7 @@
module Foo where
import Data.List
import Data.List (inits)
import GHC.Exts
foo = [ ()
......
......@@ -17,7 +17,6 @@ import HscMain
import GHC
import Util
import Data.Maybe
import Data.List
import Control.Monad
import Control.Monad.IO.Class
import System.Environment
......
module Main where
import Data.List
import Data.List (find)
-- These four functions should all wind up the same; they represent successive
-- simplifications that should happen. (Actual details may vary, since find
......
......@@ -12,7 +12,7 @@ module Main (
main
) where
import Data.List
import Data.List (find)
divides :: Int -> Int -> Bool
p `divides` n = n `mod` p == 0
......
module Main where
import Data.List
import qualified Data.List as L
expensive :: [Word]
expensive = [1 .. 10000]
......@@ -10,13 +10,13 @@ cheap = repeat 2
test_zipWith :: IO ()
test_zipWith = do
let zw3 = sum $ zipWith3 (\a b c -> a*b*c) expensive cheap cheap
zw4 = sum $ zipWith4 (\a b c d -> a*b*c*d) expensive cheap cheap cheap