diff options
Diffstat (limited to 'testsuite/tests/module')
474 files changed, 2493 insertions, 0 deletions
diff --git a/testsuite/tests/module/Makefile b/testsuite/tests/module/Makefile new file mode 100644 index 0000000000..aa235327a4 --- /dev/null +++ b/testsuite/tests/module/Makefile @@ -0,0 +1,70 @@ +TOP=../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +# We don't want make to fail here, because it emits an unpredictable +# error message. Instead we really want to test the exit code of GHC, +# hence the +# echo "exit($$?)" 1>&2 +# which emits GHC's exit code to stderr so the test driver can compare it. + +mod144:: + rm -f Mod144_A.o Mod144_A.hi mod144.o mod144.hi mod144 + '$(TEST_HC)' $(TEST_HC_OPTS) -c Mod144_A.hs + '$(TEST_HC)' $(TEST_HC_OPTS) -c mod144.hs || echo "exit($$?)" 1>&2 + +# These tests share some source files, so to avoid clashing when +# using multiple threads we direct the outputs to different files +# depending on the test name. +AUX_O = $@_o +AUX_HI = $@_hi +AUX_OPTS = -osuf $(AUX_O) -hisuf $(AUX_HI) + +mod146:: + rm -f Mod145_A.$(AUX_O) Mod145_A.$(AUX_HI) mod146.$(AUX_O) mod146.$(AUX_HI) mod146 + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod145_A.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c mod146.hs || echo "exit($$?)" 1>&2 + +mod158:: + rm -f Mod157_*.$(AUX_O) Mod157_*.$(AUX_HI) + rm -f mod158.$(AUX_O) mod158.$(AUX_HI) mod158 + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod157_A.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod157_B.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod157_C.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod157_D.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c mod158.hs || echo "exit($$?)" 1>&2 + +mod160:: + rm -f Mod159_*.$(AUX_O) + rm -f Mod159_*.$(AUX_HI) + rm -f mod160.$(AUX_O) mod160.$(AUX_HI) mod160 + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod159_A.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod159_B.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod159_C.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod159_D.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c mod160.hs || echo "exit($$?)" 1>&2 + +mod165:: + rm -f Mod164_*.$(AUX_O) + rm -f Mod164_*.$(AUX_HI) + rm -f mod165.$(AUX_O) mod165.$(AUX_HI) mod165 + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod164_A.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod164_B.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c mod165.hs || echo "exit($$?)" 1>&2 + +mod166:: + rm -f Mod164_*.$(AUX_O) + rm -f Mod164_*.$(AUX_HI) + rm -f mod166.$(AUX_O) mod166.$(AUX_HI) mod166 + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod164_A.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod164_B.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c mod166.hs || echo "exit($$?)" 1>&2 + +mod167:: + rm -f Mod164_*.$(AUX_O) + rm -f Mod164_*.$(AUX_HI) + rm -f mod167.$(AUX_O) mod167.$(AUX_HI) mod167 + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod164_A.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c Mod164_B.hs + '$(TEST_HC)' $(TEST_HC_OPTS) $(AUX_OPTS) -c mod167.hs || echo "exit($$?)" 1>&2 + diff --git a/testsuite/tests/module/Mod101_AuxA.hs b/testsuite/tests/module/Mod101_AuxA.hs new file mode 100644 index 0000000000..39ff86868d --- /dev/null +++ b/testsuite/tests/module/Mod101_AuxA.hs @@ -0,0 +1,5 @@ +-- +-- Helper module for mod101.hs +module Mod101_AuxA where + +data DataA = ConA Int | ConB Bool diff --git a/testsuite/tests/module/Mod101_AuxB.hs b/testsuite/tests/module/Mod101_AuxB.hs new file mode 100644 index 0000000000..af05c72510 --- /dev/null +++ b/testsuite/tests/module/Mod101_AuxB.hs @@ -0,0 +1,6 @@ +-- +-- Helper module for mod101.hs +-- +module Mod101_AuxB ( DataA(..) ) where + +import Mod101_AuxA ( DataA(ConA) ) diff --git a/testsuite/tests/module/Mod102_AuxA.hs b/testsuite/tests/module/Mod102_AuxA.hs new file mode 100644 index 0000000000..dfa478e542 --- /dev/null +++ b/testsuite/tests/module/Mod102_AuxA.hs @@ -0,0 +1,9 @@ +-- +-- Helper module for mod102.hs +-- +module Mod102_AuxA where + +class ClassA a where + methA :: Int -> a + methB :: Bool -> a + diff --git a/testsuite/tests/module/Mod102_AuxB.hs b/testsuite/tests/module/Mod102_AuxB.hs new file mode 100644 index 0000000000..71fc071e78 --- /dev/null +++ b/testsuite/tests/module/Mod102_AuxB.hs @@ -0,0 +1,6 @@ +-- +-- Helper module for mod102.hs +-- +module Mod102_AuxB ( ClassA(..) ) where + +import Mod102_AuxA ( ClassA(methA) ) diff --git a/testsuite/tests/module/Mod114_Help.hs b/testsuite/tests/module/Mod114_Help.hs new file mode 100644 index 0000000000..46e8fc53ea --- /dev/null +++ b/testsuite/tests/module/Mod114_Help.hs @@ -0,0 +1 @@ +module Mod114_Help(Stuff(Foo, Bar)) where data Stuff = Foo | Bar diff --git a/testsuite/tests/module/Mod115_A.hs b/testsuite/tests/module/Mod115_A.hs new file mode 100644 index 0000000000..77430951c1 --- /dev/null +++ b/testsuite/tests/module/Mod115_A.hs @@ -0,0 +1,11 @@ +-- re-exporting m2 outside of C(..) +module Mod115_A( C(m1), m2) where + +class C a where + m1 :: a -> Int + m2 :: a -> Bool + +instance C Int where + m1 _ = 1 + m2 _ = True + diff --git a/testsuite/tests/module/Mod115_B.hs b/testsuite/tests/module/Mod115_B.hs new file mode 100644 index 0000000000..d344c442b6 --- /dev/null +++ b/testsuite/tests/module/Mod115_B.hs @@ -0,0 +1,4 @@ +-- re-export all of C +module Mod115_B (C(..)) where + +import Mod115_A (C(m1), m2) diff --git a/testsuite/tests/module/Mod117_A.hs b/testsuite/tests/module/Mod117_A.hs new file mode 100644 index 0000000000..259bb76681 --- /dev/null +++ b/testsuite/tests/module/Mod117_A.hs @@ -0,0 +1,5 @@ +-- re-exporting m2 outside of T(..) +module Mod117_A( T(T,m1), m2) where + +data T = T { m1 :: Int, m2 :: Int} + diff --git a/testsuite/tests/module/Mod117_B.hs b/testsuite/tests/module/Mod117_B.hs new file mode 100644 index 0000000000..d1711b1d89 --- /dev/null +++ b/testsuite/tests/module/Mod117_B.hs @@ -0,0 +1,4 @@ +-- re-export all of T +module Mod117_B (T(..)) where + +import Mod117_A ( T(T,m1),m2 ) diff --git a/testsuite/tests/module/Mod118_A.hs b/testsuite/tests/module/Mod118_A.hs new file mode 100644 index 0000000000..b52fbfa7df --- /dev/null +++ b/testsuite/tests/module/Mod118_A.hs @@ -0,0 +1,11 @@ +-- re-exporting m2 outside of C(..) +module Mod118_A( C(m1), m2) where + +class C a where + m1 :: a -> Int + m2 :: a -> Bool + +instance C Int where + m1 _ = 1 + m2 _ = True + diff --git a/testsuite/tests/module/Mod118_B.hs b/testsuite/tests/module/Mod118_B.hs new file mode 100644 index 0000000000..21852215da --- /dev/null +++ b/testsuite/tests/module/Mod118_B.hs @@ -0,0 +1,5 @@ +-- re-export all of C +module Mod118_B (C(..)) where + +import Mod118_A hiding (C(m1)) +import Mod118_A (C) diff --git a/testsuite/tests/module/Mod119_A.hs b/testsuite/tests/module/Mod119_A.hs new file mode 100644 index 0000000000..b07646cee0 --- /dev/null +++ b/testsuite/tests/module/Mod119_A.hs @@ -0,0 +1,2 @@ +module Mod119_A(f) where +f = id diff --git a/testsuite/tests/module/Mod119_B.hs b/testsuite/tests/module/Mod119_B.hs new file mode 100644 index 0000000000..79f1dfb732 --- /dev/null +++ b/testsuite/tests/module/Mod119_B.hs @@ -0,0 +1,2 @@ +module Mod119_B (module Mod119_A) where +import Mod119_A diff --git a/testsuite/tests/module/Mod120_A.hs b/testsuite/tests/module/Mod120_A.hs new file mode 100644 index 0000000000..2ec3c2be55 --- /dev/null +++ b/testsuite/tests/module/Mod120_A.hs @@ -0,0 +1,3 @@ +module Mod120_A(T) where + +data T = Foo diff --git a/testsuite/tests/module/Mod121_A.hs b/testsuite/tests/module/Mod121_A.hs new file mode 100644 index 0000000000..4648f3da08 --- /dev/null +++ b/testsuite/tests/module/Mod121_A.hs @@ -0,0 +1,5 @@ +module Mod121_A(C(m1)) where + +class C a where + m1 :: a -> Int + m2 :: a -> Bool diff --git a/testsuite/tests/module/Mod122_A.hs b/testsuite/tests/module/Mod122_A.hs new file mode 100644 index 0000000000..93b7076551 --- /dev/null +++ b/testsuite/tests/module/Mod122_A.hs @@ -0,0 +1,3 @@ +module Mod122_A (m1) where + +class C a where m1 :: a -> a diff --git a/testsuite/tests/module/Mod123_A.hs b/testsuite/tests/module/Mod123_A.hs new file mode 100644 index 0000000000..7ec23e6172 --- /dev/null +++ b/testsuite/tests/module/Mod123_A.hs @@ -0,0 +1,3 @@ +module Mod123_A (f1) where + +data T = MkT { f1 :: Int } diff --git a/testsuite/tests/module/Mod124_A.hs b/testsuite/tests/module/Mod124_A.hs new file mode 100644 index 0000000000..8e9310bb32 --- /dev/null +++ b/testsuite/tests/module/Mod124_A.hs @@ -0,0 +1,3 @@ +module Mod124_A where + +data T = T diff --git a/testsuite/tests/module/Mod125_A.hs b/testsuite/tests/module/Mod125_A.hs new file mode 100644 index 0000000000..be190cf188 --- /dev/null +++ b/testsuite/tests/module/Mod125_A.hs @@ -0,0 +1,3 @@ +module Mod125_A where + +data T = T diff --git a/testsuite/tests/module/Mod126_A.hs b/testsuite/tests/module/Mod126_A.hs new file mode 100644 index 0000000000..8c2d36491c --- /dev/null +++ b/testsuite/tests/module/Mod126_A.hs @@ -0,0 +1,6 @@ +module Mod126_A where + +class T a where m1 :: a -> a + +data T1 = T + diff --git a/testsuite/tests/module/Mod127_A.hs b/testsuite/tests/module/Mod127_A.hs new file mode 100644 index 0000000000..605952de63 --- /dev/null +++ b/testsuite/tests/module/Mod127_A.hs @@ -0,0 +1,6 @@ +module Mod127_A where + +class T a where m1 :: a -> a + +data T1 = T + diff --git a/testsuite/tests/module/Mod128_A.hs b/testsuite/tests/module/Mod128_A.hs new file mode 100644 index 0000000000..e2df4aca73 --- /dev/null +++ b/testsuite/tests/module/Mod128_A.hs @@ -0,0 +1,5 @@ +-- repeated exports of a type/class accumulate. +module Mod128_A(T,T(Con)) where + +data T = Con + diff --git a/testsuite/tests/module/Mod131_A.hs b/testsuite/tests/module/Mod131_A.hs new file mode 100644 index 0000000000..5206ee4a23 --- /dev/null +++ b/testsuite/tests/module/Mod131_A.hs @@ -0,0 +1,4 @@ +module Mod131_A (f) where + +f x = x + diff --git a/testsuite/tests/module/Mod131_B.hs b/testsuite/tests/module/Mod131_B.hs new file mode 100644 index 0000000000..ff7f83e76c --- /dev/null +++ b/testsuite/tests/module/Mod131_B.hs @@ -0,0 +1,6 @@ +module Mod131_B(f) where + +f = 'a' + + + diff --git a/testsuite/tests/module/Mod132_A.hs b/testsuite/tests/module/Mod132_A.hs new file mode 100644 index 0000000000..178eef49ce --- /dev/null +++ b/testsuite/tests/module/Mod132_A.hs @@ -0,0 +1,3 @@ +module Mod132_A where + +data Foo = Foo diff --git a/testsuite/tests/module/Mod132_B.hs b/testsuite/tests/module/Mod132_B.hs new file mode 100644 index 0000000000..e7c33b0d51 --- /dev/null +++ b/testsuite/tests/module/Mod132_B.hs @@ -0,0 +1,5 @@ +-- exporting everything but the Foo dcon. +module Mod132_B (module Mod132_A) where + +import Mod132_A hiding (Foo) +import Mod132_A (Foo) diff --git a/testsuite/tests/module/Mod136_A.hs b/testsuite/tests/module/Mod136_A.hs new file mode 100644 index 0000000000..a69d8ee1a3 --- /dev/null +++ b/testsuite/tests/module/Mod136_A.hs @@ -0,0 +1,3 @@ +module Mod136_A (module Data.List) where + +import qualified Data.List diff --git a/testsuite/tests/module/Mod137_A.hs b/testsuite/tests/module/Mod137_A.hs new file mode 100644 index 0000000000..ba71afce39 --- /dev/null +++ b/testsuite/tests/module/Mod137_A.hs @@ -0,0 +1,6 @@ +module Mod137_A (module Data.Char) where + +import Data.Char +import Data.List as Data.Char + + diff --git a/testsuite/tests/module/Mod138_A.hs b/testsuite/tests/module/Mod138_A.hs new file mode 100644 index 0000000000..44f6645d1b --- /dev/null +++ b/testsuite/tests/module/Mod138_A.hs @@ -0,0 +1,6 @@ +module Mod138_A (module Data.Char) where + +import qualified Data.Char +import Data.List as Data.Char + + diff --git a/testsuite/tests/module/Mod139_A.hs b/testsuite/tests/module/Mod139_A.hs new file mode 100644 index 0000000000..9114c897ad --- /dev/null +++ b/testsuite/tests/module/Mod139_A.hs @@ -0,0 +1,14 @@ +module Mod139_A where + +data Foo = Bar + +class C a where + m1 :: a -> Int + +instance C Int where + m1 _ = 2 + +x = 'x' + + + diff --git a/testsuite/tests/module/Mod139_B.hs b/testsuite/tests/module/Mod139_B.hs new file mode 100644 index 0000000000..064a3e3034 --- /dev/null +++ b/testsuite/tests/module/Mod139_B.hs @@ -0,0 +1,5 @@ +module Mod139_B ( module A ) where + +import Mod139_A as A hiding (C,Foo) + + diff --git a/testsuite/tests/module/Mod140_A.hs b/testsuite/tests/module/Mod140_A.hs new file mode 100644 index 0000000000..8dfd113b04 --- /dev/null +++ b/testsuite/tests/module/Mod140_A.hs @@ -0,0 +1,3 @@ +module Mod140_A where + +data Foo = Bar diff --git a/testsuite/tests/module/Mod141_A.hs b/testsuite/tests/module/Mod141_A.hs new file mode 100644 index 0000000000..fc6c1da430 --- /dev/null +++ b/testsuite/tests/module/Mod141_A.hs @@ -0,0 +1,7 @@ +module Mod141_A (partition, module Data.List) where + +import Data.List hiding (partition) + +partition :: String +partition = "partition" + diff --git a/testsuite/tests/module/Mod142_A.hs b/testsuite/tests/module/Mod142_A.hs new file mode 100644 index 0000000000..a153f35f80 --- /dev/null +++ b/testsuite/tests/module/Mod142_A.hs @@ -0,0 +1,3 @@ +module Mod142_A where + +x = 'y' diff --git a/testsuite/tests/module/Mod143_A.hs b/testsuite/tests/module/Mod143_A.hs new file mode 100644 index 0000000000..37a50468d2 --- /dev/null +++ b/testsuite/tests/module/Mod143_A.hs @@ -0,0 +1,4 @@ +module Mod143_A where + +data Foo = Bar + diff --git a/testsuite/tests/module/Mod144_A.hs b/testsuite/tests/module/Mod144_A.hs new file mode 100644 index 0000000000..9818cccc64 --- /dev/null +++ b/testsuite/tests/module/Mod144_A.hs @@ -0,0 +1,4 @@ +module Mod144_A where + +data Foo = Bar + diff --git a/testsuite/tests/module/Mod145_A.hs b/testsuite/tests/module/Mod145_A.hs new file mode 100644 index 0000000000..7f935aa5ea --- /dev/null +++ b/testsuite/tests/module/Mod145_A.hs @@ -0,0 +1,4 @@ +module Mod145_A where + +class C2 a where + m1 :: (a,a) -> Int diff --git a/testsuite/tests/module/Mod147_A.hs b/testsuite/tests/module/Mod147_A.hs new file mode 100644 index 0000000000..5262ca5ebc --- /dev/null +++ b/testsuite/tests/module/Mod147_A.hs @@ -0,0 +1,3 @@ +module Mod147_A(D) where + +data D = D Int diff --git a/testsuite/tests/module/Mod157_A.hs b/testsuite/tests/module/Mod157_A.hs new file mode 100644 index 0000000000..7e79595e30 --- /dev/null +++ b/testsuite/tests/module/Mod157_A.hs @@ -0,0 +1,4 @@ +module Mod157_A (T(..)) where + +data T = A | B | C + diff --git a/testsuite/tests/module/Mod157_B.hs b/testsuite/tests/module/Mod157_B.hs new file mode 100644 index 0000000000..4ef8d2c0c2 --- /dev/null +++ b/testsuite/tests/module/Mod157_B.hs @@ -0,0 +1,3 @@ +module Mod157_B (T(..)) where + +import Mod157_A(T(A)) diff --git a/testsuite/tests/module/Mod157_C.hs b/testsuite/tests/module/Mod157_C.hs new file mode 100644 index 0000000000..b770018e21 --- /dev/null +++ b/testsuite/tests/module/Mod157_C.hs @@ -0,0 +1,3 @@ +module Mod157_C(T(..)) where + +import Mod157_A(T(B)) diff --git a/testsuite/tests/module/Mod157_D.hs b/testsuite/tests/module/Mod157_D.hs new file mode 100644 index 0000000000..1bab0e8ba3 --- /dev/null +++ b/testsuite/tests/module/Mod157_D.hs @@ -0,0 +1,5 @@ +module Mod157_D(T(..)) where + +import Mod157_B(T(..)) +import Mod157_C(T(..)) + diff --git a/testsuite/tests/module/Mod159_A.hs b/testsuite/tests/module/Mod159_A.hs new file mode 100644 index 0000000000..396fcd8252 --- /dev/null +++ b/testsuite/tests/module/Mod159_A.hs @@ -0,0 +1,13 @@ +module Mod159_A (C(..)) where + +class C a where + m1 :: a -> Int + m2 :: a -> Int + m3 :: a -> Int + +instance C Char where + m1 _ = 1 + m2 _ = 2 + m3 _ = 3 + + diff --git a/testsuite/tests/module/Mod159_B.hs b/testsuite/tests/module/Mod159_B.hs new file mode 100644 index 0000000000..35bfe9a2b8 --- /dev/null +++ b/testsuite/tests/module/Mod159_B.hs @@ -0,0 +1,3 @@ +module Mod159_B (C(..)) where + +import Mod159_A(C(m1)) diff --git a/testsuite/tests/module/Mod159_C.hs b/testsuite/tests/module/Mod159_C.hs new file mode 100644 index 0000000000..ba48933f42 --- /dev/null +++ b/testsuite/tests/module/Mod159_C.hs @@ -0,0 +1,3 @@ +module Mod159_C(C(..)) where + +import Mod159_A(C(m2)) diff --git a/testsuite/tests/module/Mod159_D.hs b/testsuite/tests/module/Mod159_D.hs new file mode 100644 index 0000000000..8731430ea6 --- /dev/null +++ b/testsuite/tests/module/Mod159_D.hs @@ -0,0 +1,4 @@ +module Mod159_D(C(..)) where + +import Mod159_B(C(..)) +import Mod159_C(C(..)) diff --git a/testsuite/tests/module/Mod162_A.hs b/testsuite/tests/module/Mod162_A.hs new file mode 100644 index 0000000000..68a753ba65 --- /dev/null +++ b/testsuite/tests/module/Mod162_A.hs @@ -0,0 +1,3 @@ +module Mod162_A where + +data T = T diff --git a/testsuite/tests/module/Mod163_A.hs b/testsuite/tests/module/Mod163_A.hs new file mode 100644 index 0000000000..cd5c3da328 --- /dev/null +++ b/testsuite/tests/module/Mod163_A.hs @@ -0,0 +1,3 @@ +module Mod163_A where + +data C = MkC { f :: Char } diff --git a/testsuite/tests/module/Mod164_A.hs b/testsuite/tests/module/Mod164_A.hs new file mode 100644 index 0000000000..e2f3d8c27b --- /dev/null +++ b/testsuite/tests/module/Mod164_A.hs @@ -0,0 +1,3 @@ +module Mod164_A where + +data T = D1 | D2 diff --git a/testsuite/tests/module/Mod164_B.hs b/testsuite/tests/module/Mod164_B.hs new file mode 100644 index 0000000000..c26e387ed8 --- /dev/null +++ b/testsuite/tests/module/Mod164_B.hs @@ -0,0 +1,3 @@ +module Mod164_B where + +data S = D1 | D3 diff --git a/testsuite/tests/module/Mod170_A.hs b/testsuite/tests/module/Mod170_A.hs new file mode 100644 index 0000000000..3a5fb66891 --- /dev/null +++ b/testsuite/tests/module/Mod170_A.hs @@ -0,0 +1,3 @@ +module Mod170_A (Type(..)) where + +data Type = Constr { field :: Int } diff --git a/testsuite/tests/module/Mod171_A.hs b/testsuite/tests/module/Mod171_A.hs new file mode 100644 index 0000000000..27d296670c --- /dev/null +++ b/testsuite/tests/module/Mod171_A.hs @@ -0,0 +1,4 @@ +module Mod171_A where + +f :: Int -> Int +f x = x diff --git a/testsuite/tests/module/Mod171_B.hs b/testsuite/tests/module/Mod171_B.hs new file mode 100644 index 0000000000..57e611a95b --- /dev/null +++ b/testsuite/tests/module/Mod171_B.hs @@ -0,0 +1,5 @@ +module Mod171_B (g, module Mod171_A) where +import Mod171_A + +g :: Int -> Int +g = f diff --git a/testsuite/tests/module/Mod172_B.hs b/testsuite/tests/module/Mod172_B.hs new file mode 100644 index 0000000000..863208f50e --- /dev/null +++ b/testsuite/tests/module/Mod172_B.hs @@ -0,0 +1,3 @@ +module Mod172_B( module Mod172_C ) where + +import Mod172_C diff --git a/testsuite/tests/module/Mod172_C.hs b/testsuite/tests/module/Mod172_C.hs new file mode 100644 index 0000000000..36f086c8ac --- /dev/null +++ b/testsuite/tests/module/Mod172_C.hs @@ -0,0 +1,4 @@ +module Mod172_C( f,g ) where + +class A a where f :: a +data R = R { g :: Int } diff --git a/testsuite/tests/module/Mod173_Aux.hs b/testsuite/tests/module/Mod173_Aux.hs new file mode 100644 index 0000000000..1c947914e1 --- /dev/null +++ b/testsuite/tests/module/Mod173_Aux.hs @@ -0,0 +1,9 @@ +module Mod173_Aux( module Mod173_Aux ) where + +import qualified Data.List as Mod173_Aux( nub ) + -- This should not be exported + +import Data.List as Mod173_Aux( partition ) + -- This one should be exported + +frob x = Mod173_Aux.nub (x::[Int]) -- This one should diff --git a/testsuite/tests/module/Mod178_2.hs b/testsuite/tests/module/Mod178_2.hs new file mode 100644 index 0000000000..818095da0f --- /dev/null +++ b/testsuite/tests/module/Mod178_2.hs @@ -0,0 +1,5 @@ + +mmmodule Foo where + +foo = 'c' + diff --git a/testsuite/tests/module/Mod179_A.hs b/testsuite/tests/module/Mod179_A.hs new file mode 100644 index 0000000000..3291e72a89 --- /dev/null +++ b/testsuite/tests/module/Mod179_A.hs @@ -0,0 +1,5 @@ + +module Mod179_A where + +x = True + diff --git a/testsuite/tests/module/Mod180_A.hs b/testsuite/tests/module/Mod180_A.hs new file mode 100644 index 0000000000..5e11bdb116 --- /dev/null +++ b/testsuite/tests/module/Mod180_A.hs @@ -0,0 +1,4 @@ +module Mod180_A where + +data T = T +x = T diff --git a/testsuite/tests/module/Mod180_B.hs b/testsuite/tests/module/Mod180_B.hs new file mode 100644 index 0000000000..e3f29fc37e --- /dev/null +++ b/testsuite/tests/module/Mod180_B.hs @@ -0,0 +1,5 @@ +module Mod180_B where + +data T = U +x = U + diff --git a/testsuite/tests/module/T1074.hs b/testsuite/tests/module/T1074.hs new file mode 100644 index 0000000000..6cd647ba6d --- /dev/null +++ b/testsuite/tests/module/T1074.hs @@ -0,0 +1,8 @@ +{-# OPTIONS_GHC -fwarn-unused-imports #-}
+module Test where
+
+import qualified Control.Monad (ap)
+import qualified Control.Monad.Reader
+
+foo :: IO ()
+foo = return id `Control.Monad.ap` return ()
diff --git a/testsuite/tests/module/T1074.stderr b/testsuite/tests/module/T1074.stderr new file mode 100644 index 0000000000..b368ca119e --- /dev/null +++ b/testsuite/tests/module/T1074.stderr @@ -0,0 +1,5 @@ + +T1074.hs:5:1: + Warning: The import of `Control.Monad.Reader' is redundant + except perhaps to import instances from `Control.Monad.Reader' + To import instances alone, use: import Control.Monad.Reader() diff --git a/testsuite/tests/module/T1074a.hs b/testsuite/tests/module/T1074a.hs new file mode 100644 index 0000000000..0fcbdf600f --- /dev/null +++ b/testsuite/tests/module/T1074a.hs @@ -0,0 +1,28 @@ +{-# OPTIONS_GHC -fwarn-unused-imports #-}
+
+module Test where
+
+import qualified System.FilePath as FilePath.Native
+ ( joinPath )
+import qualified System.FilePath.Posix as FilePath.Posix
+ ( joinPath, splitDirectories )
+import qualified System.FilePath.Windows as FilePath.Windows
+ ( joinPath )
+
+data TarPath = TarPath FilePath -- path name, 100 characters max.
+ FilePath -- path prefix, 155 characters max.
+
+fromTarPath, fromTarPathToPosixPath
+ , fromTarPathToWindowsPath :: TarPath -> FilePath
+
+fromTarPath (TarPath name prefix) =
+ FilePath.Native.joinPath $ FilePath.Posix.splitDirectories prefix
+ ++ FilePath.Posix.splitDirectories name
+
+fromTarPathToPosixPath (TarPath name prefix) =
+ FilePath.Posix.joinPath $ FilePath.Posix.splitDirectories prefix
+ ++ FilePath.Posix.splitDirectories name
+
+fromTarPathToWindowsPath (TarPath name prefix) =
+ FilePath.Windows.joinPath $ FilePath.Posix.splitDirectories prefix
+ ++ FilePath.Posix.splitDirectories name
diff --git a/testsuite/tests/module/T1148.hs b/testsuite/tests/module/T1148.hs new file mode 100644 index 0000000000..c6758e580b --- /dev/null +++ b/testsuite/tests/module/T1148.hs @@ -0,0 +1,19 @@ +{-# OPTIONS_GHC -XFlexibleContexts -fwarn-unused-imports #-}
+
+module ArrayBoundedU
+ ( T
+ , create
+ , at
+ ) where
+
+import Data.Ix
+import qualified Data.Array.Unboxed as Array
+import Data.Array.Base (unsafeAt)
+
+newtype T i e = T (Array.UArray i e)
+
+create :: (Ix i, Bounded i, Array.IArray Array.UArray e) => [(i,e)] -> T i e
+create ies = T (Array.array (minBound, maxBound) ies)
+
+at :: (Ix i, Bounded i, Array.IArray Array.UArray e) => T i e -> i -> e
+at (T a) i = unsafeAt a (index (minBound, maxBound) i)
diff --git a/testsuite/tests/module/T2267.hs b/testsuite/tests/module/T2267.hs new file mode 100644 index 0000000000..851997cd9d --- /dev/null +++ b/testsuite/tests/module/T2267.hs @@ -0,0 +1,12 @@ +{-# OPTIONS_GHC -fwarn-unused-imports -Werror #-}
+
+module T2267 where
+
+import qualified Data.ByteString as B
+import qualified Data.ByteString.UTF8 as BU
+
+toString :: B.ByteString -> String
+toString = BU.toString
+
+fromString :: String -> B.ByteString
+fromString = BU.fromString
diff --git a/testsuite/tests/module/T3776.hs b/testsuite/tests/module/T3776.hs new file mode 100644 index 0000000000..b522cfe0e0 --- /dev/null +++ b/testsuite/tests/module/T3776.hs @@ -0,0 +1,12 @@ +{-# OPTIONS_GHC -fwarn-unused-imports -fno-warn-missing-methods #-} + +-- Check that although 'index' is apparently only used +-- unqualified, we nevertheless do not get a redundant-import warning +-- Trac #3776 + +module T3776 where + +import qualified Data.Ix( Ix(index) ) + +instance Data.Ix.Ix Float where + index = error "urk" diff --git a/testsuite/tests/module/T414.hs b/testsuite/tests/module/T414.hs new file mode 100644 index 0000000000..5f2d49b315 --- /dev/null +++ b/testsuite/tests/module/T414.hs @@ -0,0 +1,3 @@ +-- should fail, Main must *export* main (#414) +module Main () where +main = return () diff --git a/testsuite/tests/module/T414.stderr b/testsuite/tests/module/T414.stderr new file mode 100644 index 0000000000..a5052fb76d --- /dev/null +++ b/testsuite/tests/module/T414.stderr @@ -0,0 +1,3 @@ + +T414.hs:1:1: + The main function `main' is not exported by module `Main' diff --git a/testsuite/tests/module/T414a.hs b/testsuite/tests/module/T414a.hs new file mode 100644 index 0000000000..25f5c49d57 --- /dev/null +++ b/testsuite/tests/module/T414a.hs @@ -0,0 +1,2 @@ +module Main where +main = return () diff --git a/testsuite/tests/module/T414b.hs b/testsuite/tests/module/T414b.hs new file mode 100644 index 0000000000..29425570e8 --- /dev/null +++ b/testsuite/tests/module/T414b.hs @@ -0,0 +1,2 @@ +module Main (module Main) where +main = return () diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T new file mode 100644 index 0000000000..b8a5355a97 --- /dev/null +++ b/testsuite/tests/module/all.T @@ -0,0 +1,336 @@ +# These tests were swiped from the hugs98 source tree, in hugs98/tests/static, +# on 16/10/2002. +# +# I used something like this to partly-automate the transition: +# +# for i in mod*.hs; do +# if ! test -f ${i%.hs}.output; then +# echo "test('${i%.hs}', normal, compile, [''])" +# else if grep error ${i%.hs}.output >/dev/null; then +# echo "test('${i%.hs}', normal, compile_fail, [''])" +# else +# echo "test('${i%.hs}', normal, compile, [''])" +# fi fi +# done +# +# A few of the tests use Hugs-specific extensions, and have been +# commented out. + +# No point in doing anything except the normal way for renamer tests +setTestOpts(only_ways(['normal'])); + +test('mod1', normal, compile_fail, ['']) +test('mod2', normal, compile_fail, ['']) +test('mod3', normal, compile_fail, ['']) +test('mod4', normal, compile_fail, ['']) +test('mod5', normal, compile, ['']) +test('mod6', normal, compile, ['']) +test('mod7', normal, compile_fail, ['']) +test('mod8', normal, compile_fail, ['']) +test('mod9', normal, compile_fail, ['']) +test('mod10', normal, compile_fail, ['']) +test('mod11', normal, compile, ['']) +test('mod12', normal, compile, ['']) +test('mod13', normal, compile, ['']) +test('mod14', normal, compile, ['']) +test('mod15', normal, compile, ['']) +test('mod16', normal, compile, ['']) +test('mod17', normal, compile_fail, ['']) +test('mod18', normal, compile_fail, ['']) +test('mod19', normal, compile_fail, ['']) +test('mod20', normal, compile_fail, ['']) +test('mod21', normal, compile_fail, ['']) +test('mod22', normal, compile_fail, ['']) +test('mod23', normal, compile_fail, ['']) +test('mod24', normal, compile_fail, ['']) +test('mod25', normal, compile_fail, ['']) +test('mod26', normal, compile_fail, ['']) +test('mod27', normal, compile_fail, ['']) +#test('mod28', normal, compile_fail, ['']) +test('mod29', normal, compile_fail, ['']) +test('mod30', normal, compile, ['']) +test('mod31', normal, compile, ['']) +test('mod32', normal, compile, ['']) +test('mod33', normal, compile, ['']) +test('mod34', normal, compile, ['']) +test('mod35', normal, compile, ['']) +test('mod36', normal, compile_fail, ['']) +test('mod37', normal, compile, ['']) +test('mod38', normal, compile_fail, ['']) +test('mod39', normal, compile, ['']) +test('mod40', normal, compile_fail, ['']) +test('mod41', normal, compile_fail, ['']) +test('mod42', normal, compile_fail, ['']) +test('mod43', normal, compile_fail, ['']) +test('mod44', normal, compile_fail, ['']) +test('mod45', normal, compile_fail, ['']) +test('mod46', normal, compile_fail, ['']) +test('mod47', normal, compile_fail, ['']) +test('mod48', normal, compile_fail, ['']) +test('mod49', normal, compile_fail, ['']) +test('mod50', normal, compile_fail, ['']) +test('mod51', normal, compile_fail, ['']) +test('mod52', normal, compile_fail, ['']) +test('mod53', normal, compile_fail, ['']) +test('mod54', normal, compile_fail, ['']) +test('mod55', normal, compile_fail, ['']) +test('mod56', normal, compile_fail, ['']) +#test('mod57', normal, compile_fail, ['']) +test('mod58', normal, compile_fail, ['']) +test('mod59', normal, compile_fail, ['']) +test('mod60', normal, compile_fail, ['']) +test('mod61', normal, compile_fail, ['']) +test('mod62', normal, compile_fail, ['']) +test('mod63', normal, compile_fail, ['']) +test('mod64', normal, compile, ['']) +test('mod65', normal, compile, ['']) +test('mod66', normal, compile_fail, ['']) +test('mod67', normal, compile_fail, ['']) +test('mod68', normal, compile_fail, ['']) +test('mod69', normal, compile_fail, ['']) +test('mod70', normal, compile_fail, ['']) +test('mod71', normal, compile_fail, ['']) +test('mod72', normal, compile_fail, ['']) +test('mod73', normal, compile_fail, ['']) +test('mod74', normal, compile_fail, ['']) +test('mod75', normal, compile, ['']) +test('mod76', normal, compile_fail, ['']) +test('mod77', normal, compile_fail, ['']) +#test('mod78', normal, compile_fail, ['']) +test('mod79', normal, compile_fail, ['']) +test('mod80', normal, compile_fail, ['']) +test('mod81', normal, compile_fail, ['']) +test('mod82', normal, compile, ['']) +test('mod83', normal, compile, ['']) +test('mod84', normal, compile, ['']) +test('mod85', normal, compile, ['']) +test('mod86', normal, compile, ['']) +test('mod87', normal, compile_fail, ['']) +test('mod88', normal, compile_fail, ['']) +test('mod89', normal, compile_fail, ['']) +test('mod90', normal, compile_fail, ['']) +test('mod91', normal, compile_fail, ['']) +test('mod92', normal, compile, ['']) +test('mod93', normal, compile, ['']) +test('mod94', normal, compile, ['']) +test('mod95', normal, compile, ['']) +test('mod96', normal, compile, ['']) +test('mod97', normal, compile_fail, ['']) +test('mod98', normal, compile_fail, ['']) +test('mod99', normal, compile, ['']) +test('mod100', normal, compile, ['']) + +test('mod101', + extra_clean(['Mod101_AuxA.hi', 'Mod101_AuxA.o', 'Mod101_AuxB.hi', 'Mod101_AuxB.o']), + multimod_compile_fail, ['mod101', '-v0']) + +test('mod102', + extra_clean(['Mod102_AuxA.hi', 'Mod102_AuxA.o', 'Mod102_AuxB.hi', 'Mod102_AuxB.o']), + multimod_compile_fail, ['mod102', '-v0']) + +test('mod103', normal, compile, ['']) +test('mod104', normal, compile, ['']) +test('mod105', normal, compile, ['']) +test('mod106', normal, compile, ['']) +test('mod107', normal, compile, ['']) +test('mod108', normal, compile, ['']) +test('mod109', normal, compile, ['']) +test('mod110', normal, compile_fail, ['']) +test('mod111', normal, compile, ['']) +test('mod112', normal, compile, ['']) +test('mod113', normal, compile, ['']) +test('mod114', extra_clean(['Mod114_Help.hi', 'Mod114_Help.o']), + multimod_compile_fail, ['mod114', '-v0']) + +test('mod115', + extra_clean(['Mod115_A.hi', 'Mod115_A.o', 'Mod115_B.hi', 'Mod115_B.o']), + multimod_compile, ['mod115', '-v0']) + +test('mod116', normal, compile_fail, ['']) +test('mod117', + extra_clean(['Mod117_A.hi', 'Mod117_A.o', 'Mod117_B.hi', 'Mod117_B.o']), + multimod_compile, ['mod117', '-v0']) + +test('mod118', + extra_clean(['Mod118_A.hi', 'Mod118_A.o', 'Mod118_B.hi', 'Mod118_B.o']), + multimod_compile, ['mod118', '-v0']) + +test('mod119', + extra_clean(['Mod119_A.hi', 'Mod119_A.o', 'Mod119_B.hi', 'Mod119_B.o']), + multimod_compile, ['mod119', '-v0']) + +test('mod120', + extra_clean(['Mod120_A.hi', 'Mod120_A.o']), + multimod_compile_fail, ['mod120', '-v0']) + +test('mod121', + extra_clean(['Mod121_A.hi', 'Mod121_A.o']), + multimod_compile_fail, ['mod121', '-v0']) + +test('mod122', + extra_clean(['Mod122_A.hi', 'Mod122_A.o']), + multimod_compile_fail, ['mod122', '-v0']) + +test('mod123', + extra_clean(['Mod123_A.hi', 'Mod123_A.o']), + multimod_compile_fail, ['mod123', '-v0']) + +test('mod124', + extra_clean(['Mod124_A.hi', 'Mod124_A.o']), + multimod_compile_fail, ['mod124', '-v0']) + +test('mod125', + extra_clean(['Mod125_A.hi', 'Mod125_A.o']), + multimod_compile_fail, ['mod125', '-v0']) + +test('mod126', + extra_clean(['Mod126_A.hi', 'Mod126_A.o']), + multimod_compile_fail, ['mod126', '-v0']) + +test('mod127', + extra_clean(['Mod127_A.hi', 'Mod127_A.o']), + multimod_compile_fail, ['mod127', '-v0']) + +test('mod128', + extra_clean(['Mod128_A.hi', 'Mod128_A.o']) , + multimod_compile, ['mod128', '-v0']) + +test('mod129', normal, compile, ['']) +test('mod130', normal, compile_fail, ['']) +test('mod131', + extra_clean(['Mod131_A.hi', 'Mod131_A.o', 'Mod131_B.hi', 'Mod131_B.o']), + multimod_compile_fail, ['mod131', '-v0']) + +test('mod132', + extra_clean(['Mod132_A.hi', 'Mod132_A.o', 'Mod132_B.hi', 'Mod132_B.o']), + multimod_compile_fail, ['mod132', '-v0']) + +test('mod133', reqlib('mtl'), compile, ['']) +test('mod134', normal, compile_fail, ['']) +test('mod135', normal, compile_fail, ['']) +test('mod136', extra_clean(['Mod136_A.hi', 'Mod136_A.o']), + multimod_compile_fail, ['mod136', '-v0']) + +test('mod137', extra_clean(['Mod137_A.hi', 'Mod137_A.o']), + multimod_compile, ['mod137', '-v0']) + +test('mod138', extra_clean(['Mod138_A.hi', 'Mod138_A.o']), + multimod_compile_fail, ['mod138', '-v0']) + +test('mod139', extra_clean(['Mod139_A.hi', 'Mod139_A.o', 'Mod139_B.hi', 'Mod139_B.o']), + multimod_compile, ['mod139', '-v0']) + +test('mod140', extra_clean(['Mod140_A.hi', 'Mod140_A.o']), + multimod_compile, ['mod140', '-v0']) + +test('mod141', extra_clean(['Mod141_A.hi', 'Mod141_A.o']), + multimod_compile, ['mod141', '-v0']) + +test('mod142', extra_clean(['Mod142_A.hi', 'Mod142_A.o']), + multimod_compile_fail, ['mod142', '-v0']) + +test('mod143', extra_clean(['Mod143_A.hi', 'Mod143_A.o']), + multimod_compile_fail, ['mod143', '-v0']) + +test('mod144', extra_clean(['Mod144_A.hi', 'Mod144_A.o']), + run_command, ['$MAKE -s --no-print-directory mod144']) + +test('mod145', extra_clean(['Mod145_A.hi', 'Mod145_A.o']), + multimod_compile_fail, ['mod145', '-v0']) + +test('mod146', + extra_clean(['Mod145_A.mod146_hi', 'Mod145_A.mod146_o', 'mod146.mod146_o', 'mod146.mod146_hi']), + run_command, ['$MAKE -s --no-print-directory mod146']) + +test('mod147', extra_clean(['Mod147_A.hi', 'Mod147_A.o']), + multimod_compile_fail, ['mod147', '-v0']) + +test('mod148', normal, compile, ['']) +test('mod149', normal, compile, ['']) +test('mod150', normal, compile_fail, ['']) +test('mod151', normal, compile_fail, ['']) +test('mod152', normal, compile_fail, ['']) +test('mod153', normal, compile_fail, ['']) +test('mod154', if_compiler_type('hugs', expect_fail), compile, ['']) +test('mod155', normal, compile_fail, ['']) +test('mod156', normal, compile, ['']) +test('mod157', + extra_clean(['Mod157_A.hi', 'Mod157_A.o', 'Mod157_B.hi', 'Mod157_B.o', + 'Mod157_C.hi', 'Mod157_C.o', 'Mod157_D.hi', 'Mod157_D.o']), + multimod_compile, ['mod157', '-v0']) + +test('mod158', + extra_clean(['Mod157_A.mod158_hi', 'Mod157_A.mod158_o', 'Mod157_B.mod158_hi', 'Mod157_B.mod158_o', + 'Mod157_C.mod158_hi', 'Mod157_C.mod158_o', 'Mod157_D.mod158_hi', 'Mod157_D.mod158_o']), + run_command, ['$MAKE -s --no-print-directory mod158']) + +test('mod159', + extra_clean(['Mod159_A.hi', 'Mod159_A.o', 'Mod159_B.hi', 'Mod159_B.o', + 'Mod159_C.hi', 'Mod159_C.o', 'Mod159_D.hi', 'Mod159_D.o']), + multimod_compile, ['mod159', '-v0']) + +test('mod160', + extra_clean(['Mod159_A.mod160_hi', 'Mod159_A.mod160_o', 'Mod159_B.mod160_hi', 'Mod159_B.mod160_o', + 'Mod159_C.mod160_hi', 'Mod159_C.mod160_o', 'Mod159_D.mod160_hi', 'Mod159_D.mod160_o']), + run_command, ['$MAKE -s --no-print-directory mod160']) + +test('mod161', normal, compile_fail, ['']) +test('mod162', extra_clean(['Mod162_A.hi', 'Mod162_A.o']), + multimod_compile, ['mod162', '-v0']) + +test('mod163', extra_clean(['Mod163_A.hi', 'Mod163_A.o']), + multimod_compile, ['mod163', '-v0']) + +test('mod164', extra_clean(['Mod164_A.hi', 'Mod164_A.o', 'Mod164_B.hi', 'Mod164_B.o']), + multimod_compile_fail, ['mod164', '-v0']) + +test('mod165', extra_clean(['Mod164_A.mod165_hi', 'Mod164_A.mod165_o', 'Mod164_B.mod165_hi', 'Mod164_B.mod165_o']), + run_command, ['$MAKE -s --no-print-directory mod165']) + +test('mod166', extra_clean(['Mod164_A.mod166_hi', 'Mod164_A.mod166_o', 'Mod164_B.mod166_hi', 'Mod164_B.mod166_o', 'mod166.mod166_o', 'mod166.mod166_hi']), + run_command, ['$MAKE -s --no-print-directory mod166 MAKELEVEL=']) + +test('mod167', extra_clean(['Mod164_A.mod167_hi', 'Mod164_A.mod167_o', 'Mod164_B.mod167_hi', 'Mod164_B.mod167_o', 'mod167.mod167_o', 'mod167.mod167_hi']), + run_command, ['$MAKE -s --no-print-directory mod167 MAKELEVEL=']) + +test('mod168', normal, compile, ['']) +test('mod169', normal, compile, ['']) +test('mod170', extra_clean(['Mod170_A.hi', 'Mod170_A.o']), + multimod_compile, ['mod170', '-v0']) + + +test('mod171', extra_clean(['Mod171_A.hi', 'Mod171_A.o', 'Mod171_B.hi', 'Mod171_B.o']), + multimod_compile, ['mod171', '-v0 -Wall']) + + +test('mod172', extra_clean(['Mod172_B.hi', 'Mod172_B.o', 'Mod172_C.hi', 'Mod172_C.o']), + multimod_compile, ['mod172', '-v0']) + + +test('mod173', extra_clean(['Mod173_Aux.hi', 'Mod173_Aux.o']), + multimod_compile, ['mod173', '-v0']) + +test('mod174', normal, compile_fail, ['']) + +# mod175 is a sub-directory + +test('mod176', normal, compile, ['-fwarn-unused-imports']) +test('mod177', normal, compile, ['-fwarn-unused-imports']) +test('mod178', extra_clean(['Mod178_2.hi', 'Mod178_2.o']), + multimod_compile_fail, ['mod178', '-v0']) + +test('mod179', extra_clean(['Mod179_A.hi', 'Mod179_A.o']), + multimod_compile, ['mod179', '-v0']) + + +test('mod180', extra_clean(['Mod180_A.hi', 'Mod180_A.o', 'Mod180_B.hi', 'Mod180_B.o']), + multimod_compile_fail, ['mod180', '-v0']) + +test('T1148', normal, compile, ['']) +test('T1074', reqlib('mtl'), compile, ['']) +test('T1074a', normal, compile, ['']) +test('T2267', reqlib('utf8-string'), compile, ['']) +test('T414', normal, compile_fail, ['']) +test('T414a', normal, compile, ['']) +test('T414b', normal, compile, ['']) +test('T3776', normal, compile, ['']) diff --git a/testsuite/tests/module/base01/GHC/Base.hs b/testsuite/tests/module/base01/GHC/Base.hs new file mode 100644 index 0000000000..9149f8544b --- /dev/null +++ b/testsuite/tests/module/base01/GHC/Base.hs @@ -0,0 +1,25 @@ + +module GHC.Base (module GHC.Base, Bool(..)) where + +import GHC.Prim +import GHC.Types + +default () + +class Eq a where + (==), (/=) :: a -> a -> Bool + + x /= y = not (x == y) + x == y = not (x /= y) + +instance Eq Bool where + False == False = True + True == True = True + _ == _ = False + +not :: Bool -> Bool +not True = False +not False = True + +inline x = x + diff --git a/testsuite/tests/module/base01/GHC/Foo.hs b/testsuite/tests/module/base01/GHC/Foo.hs new file mode 100644 index 0000000000..c23ef0ceb3 --- /dev/null +++ b/testsuite/tests/module/base01/GHC/Foo.hs @@ -0,0 +1,7 @@ + +module GHC.Foo where + +import GHC.Base + +foo = True == True + diff --git a/testsuite/tests/module/base01/Makefile b/testsuite/tests/module/base01/Makefile new file mode 100644 index 0000000000..f88e8a3e4d --- /dev/null +++ b/testsuite/tests/module/base01/Makefile @@ -0,0 +1,14 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +clean: + rm -f GHC/*.o + rm -f GHC/*.hi + +base01: + rm -f GHC/*.o + rm -f GHC/*.hi + '$(TEST_HC)' $(TEST_HC_OPTS) -XNoImplicitPrelude -package-name base -c GHC/Base.hs + '$(TEST_HC)' $(TEST_HC_OPTS) -XNoImplicitPrelude -package-name base --make GHC.Foo + diff --git a/testsuite/tests/module/base01/all.T b/testsuite/tests/module/base01/all.T new file mode 100644 index 0000000000..d0dbb2960d --- /dev/null +++ b/testsuite/tests/module/base01/all.T @@ -0,0 +1,9 @@ +setTestOpts(only_compiler_types(['ghc'])) + +test('base01', + [if_compiler_lt('ghc', '7.1', expect_fail), + normalise_slashes, + clean_cmd('$MAKE -s clean')], + run_command, + ['$MAKE -s base01 --no-print-directory']) + diff --git a/testsuite/tests/module/base01/base01.stdout b/testsuite/tests/module/base01/base01.stdout new file mode 100644 index 0000000000..9ab7d2124e --- /dev/null +++ b/testsuite/tests/module/base01/base01.stdout @@ -0,0 +1 @@ +[2 of 2] Compiling GHC.Foo ( GHC/Foo.hs, GHC/Foo.o ) diff --git a/testsuite/tests/module/convert-tests.sh b/testsuite/tests/module/convert-tests.sh new file mode 100644 index 0000000000..d4053472ac --- /dev/null +++ b/testsuite/tests/module/convert-tests.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +# something like this... +for i in mod*.hs; do + if ! test -f ${i%.hs}.output; then + echo "test('${i%.hs}', normal, compile, [''])" + else if grep error ${i%.hs}.output >/dev/null; then + echo "test('${i%.hs}', normal, compile_fail, [''])" + else + echo "test('${i%.hs}', normal, compile, [''])" + fi fi +done diff --git a/testsuite/tests/module/mod1.hs b/testsuite/tests/module/mod1.hs new file mode 100644 index 0000000000..c8276cda87 --- /dev/null +++ b/testsuite/tests/module/mod1.hs @@ -0,0 +1,3 @@ +-- !!! Importing unknown module +module M where +import N diff --git a/testsuite/tests/module/mod1.stderr b/testsuite/tests/module/mod1.stderr new file mode 100644 index 0000000000..e665f8468e --- /dev/null +++ b/testsuite/tests/module/mod1.stderr @@ -0,0 +1,4 @@ + +mod1.hs:3:1: + Failed to load interface for `N' + Use -v to see a list of the files searched for. diff --git a/testsuite/tests/module/mod1.stderr-hugs b/testsuite/tests/module/mod1.stderr-hugs new file mode 100644 index 0000000000..0f432cd7d6 --- /dev/null +++ b/testsuite/tests/module/mod1.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod1.hs" - Can't find imported module "N" diff --git a/testsuite/tests/module/mod10.hs b/testsuite/tests/module/mod10.hs new file mode 100644 index 0000000000..1e8046f05e --- /dev/null +++ b/testsuite/tests/module/mod10.hs @@ -0,0 +1,3 @@ +-- !!! Exporting non-existent datatype transparently +module M(T(K1)) where +x = 'a' -- dummy definition to get round a separate bug diff --git a/testsuite/tests/module/mod10.stderr b/testsuite/tests/module/mod10.stderr new file mode 100644 index 0000000000..5369fa0f8b --- /dev/null +++ b/testsuite/tests/module/mod10.stderr @@ -0,0 +1,2 @@ + +mod10.hs:2:10: Not in scope: type constructor or class `T' diff --git a/testsuite/tests/module/mod10.stderr-hugs b/testsuite/tests/module/mod10.stderr-hugs new file mode 100644 index 0000000000..2020e4ceab --- /dev/null +++ b/testsuite/tests/module/mod10.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod10.hs" - Explicit export list given for non-class/datatype "T" in export list of module "M" diff --git a/testsuite/tests/module/mod100.hs b/testsuite/tests/module/mod100.hs new file mode 100644 index 0000000000..f370d09f87 --- /dev/null +++ b/testsuite/tests/module/mod100.hs @@ -0,0 +1,28 @@ +-- !!! Empty where declarations list +module Mod100 where + +y = 3 + +x = v where v = 2 where + +{- Example of a nested context not being further + indented than the enclosing - an error (from the + Sec B.2 of the H98 report). + +f x = let + h y = let + p z = z + in p + in h + +-} + +f e = let { x = e; y = x } in y + +z = 'a' where + +class A a where + +instance A Int where + +instance A Char diff --git a/testsuite/tests/module/mod101.hs b/testsuite/tests/module/mod101.hs new file mode 100644 index 0000000000..ffc393cbff --- /dev/null +++ b/testsuite/tests/module/mod101.hs @@ -0,0 +1,8 @@ +-- !!! Re-exporting a subset of a alg. data type's constructors +module Mod101 where + +import Mod101_AuxB + +-- ConB is not imported by Mod101_AuxB, hence not exported either. +x :: DataA +x = ConB False diff --git a/testsuite/tests/module/mod101.stderr b/testsuite/tests/module/mod101.stderr new file mode 100644 index 0000000000..662c38e89a --- /dev/null +++ b/testsuite/tests/module/mod101.stderr @@ -0,0 +1,4 @@ + +mod101.hs:8:5: + Not in scope: data constructor `ConB' + Perhaps you meant `ConA' (imported from Mod101_AuxB) diff --git a/testsuite/tests/module/mod101.stderr-hugs b/testsuite/tests/module/mod101.stderr-hugs new file mode 100644 index 0000000000..3902e9c3b5 --- /dev/null +++ b/testsuite/tests/module/mod101.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod101.hs":8 - Undefined data constructor "ConB" diff --git a/testsuite/tests/module/mod102.hs b/testsuite/tests/module/mod102.hs new file mode 100644 index 0000000000..945276937c --- /dev/null +++ b/testsuite/tests/module/mod102.hs @@ -0,0 +1,8 @@ +-- !!! Fixed bug: Re-exporting a subset of a class' methods +module Mod102 where + +import Mod102_AuxB + +-- methB is not imported by Mod102_AuxB, hence not exported either. +x :: Bool -> () +x = methB False diff --git a/testsuite/tests/module/mod102.stderr b/testsuite/tests/module/mod102.stderr new file mode 100644 index 0000000000..60f7b28ab2 --- /dev/null +++ b/testsuite/tests/module/mod102.stderr @@ -0,0 +1,4 @@ + +mod102.hs:8:5: + Not in scope: `methB' + Perhaps you meant `methA' (imported from Mod102_AuxB) diff --git a/testsuite/tests/module/mod102.stderr-hugs b/testsuite/tests/module/mod102.stderr-hugs new file mode 100644 index 0000000000..97d80614cf --- /dev/null +++ b/testsuite/tests/module/mod102.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod102.hs":8 - Undefined variable "methB" diff --git a/testsuite/tests/module/mod103.hs b/testsuite/tests/module/mod103.hs new file mode 100644 index 0000000000..ccd6ddfd0d --- /dev/null +++ b/testsuite/tests/module/mod103.hs @@ -0,0 +1,12 @@ +-- !!! Layout rule extension (restricting empty do's). +module Foo where + +g :: Int -> (Int -> IO a) -> IO a +g x cont = cont x + +f :: Int -> IO Int +f x = do + g x $ \ y -> do + f y + + diff --git a/testsuite/tests/module/mod104.hs b/testsuite/tests/module/mod104.hs new file mode 100644 index 0000000000..f44289971f --- /dev/null +++ b/testsuite/tests/module/mod104.hs @@ -0,0 +1,6 @@ +-- !!! Redefining imported Prelude entities +module A where +--import Prelude + +head = "head" + diff --git a/testsuite/tests/module/mod105.hs b/testsuite/tests/module/mod105.hs new file mode 100644 index 0000000000..2ae72ba491 --- /dev/null +++ b/testsuite/tests/module/mod105.hs @@ -0,0 +1,9 @@ +-- !!! Re-defining Prelude entities +module Ring where +import qualified Prelude +import Data.List ( nub ) + +l1 + l2 = l1 Prelude.++ l2 +l1 * l2 = nub (l1 + l2) + +succ = (Prelude.+ 1) diff --git a/testsuite/tests/module/mod106.hs b/testsuite/tests/module/mod106.hs new file mode 100644 index 0000000000..a871377d38 --- /dev/null +++ b/testsuite/tests/module/mod106.hs @@ -0,0 +1,8 @@ +-- !!! local aliases +module M where + +import qualified Data.List as M +import qualified Data.Maybe as M + +x = M.length +b = M.isJust diff --git a/testsuite/tests/module/mod107.hs b/testsuite/tests/module/mod107.hs new file mode 100644 index 0000000000..cd660d96af --- /dev/null +++ b/testsuite/tests/module/mod107.hs @@ -0,0 +1,6 @@ +-- !!! Redefining and using Prelude entities +module F where + +sin :: Float -> Float +sin x = (x::Float) +f x = Prelude.sin (F.sin x) diff --git a/testsuite/tests/module/mod108.hs b/testsuite/tests/module/mod108.hs new file mode 100644 index 0000000000..2a5ffa4934 --- /dev/null +++ b/testsuite/tests/module/mod108.hs @@ -0,0 +1,6 @@ +-- !!! Local alias same as module +module F where + +import Prelude as F + +x = 'a' diff --git a/testsuite/tests/module/mod109.hs b/testsuite/tests/module/mod109.hs new file mode 100644 index 0000000000..e9b6f29171 --- /dev/null +++ b/testsuite/tests/module/mod109.hs @@ -0,0 +1,7 @@ +-- !!! redefining and using Prelude entities +module A( null, nonNull ) where +import Prelude hiding( null ) +import qualified Prelude +null, nonNull :: Int -> Bool +null x = x == 0 +nonNull x = not (Prelude.null [x]) && not (null x) diff --git a/testsuite/tests/module/mod11.hs b/testsuite/tests/module/mod11.hs new file mode 100644 index 0000000000..84353668ba --- /dev/null +++ b/testsuite/tests/module/mod11.hs @@ -0,0 +1,2 @@ +-- !!! Empty module body +module M where diff --git a/testsuite/tests/module/mod110.hs b/testsuite/tests/module/mod110.hs new file mode 100644 index 0000000000..897dd12cdb --- /dev/null +++ b/testsuite/tests/module/mod110.hs @@ -0,0 +1,15 @@ +-- !!! Re-defining Prelude class +module M where + +import Prelude +--import qualified Prelude + +class Eq a where + equal :: a -> a -> Prelude.Bool + negate :: a -> a + +instance Eq Prelude.Int where + equal x y = x Prelude.== y + negate x = Prelude.negate x +x = M.negate (2 :: Prelude.Int) + diff --git a/testsuite/tests/module/mod110.stderr b/testsuite/tests/module/mod110.stderr new file mode 100644 index 0000000000..c371bc1bd7 --- /dev/null +++ b/testsuite/tests/module/mod110.stderr @@ -0,0 +1,5 @@ + +mod110.hs:11:10: + Ambiguous occurrence `Eq' + It could refer to either `M.Eq', defined at mod110.hs:7:7 + or `Prelude.Eq', imported from Prelude at mod110.hs:4:1-14 diff --git a/testsuite/tests/module/mod110.stderr-hugs b/testsuite/tests/module/mod110.stderr-hugs new file mode 100644 index 0000000000..ac19a7121a --- /dev/null +++ b/testsuite/tests/module/mod110.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod110.hs":11 - Ambiguous class occurrence "Eq" +*** Could refer to: M.Eq Hugs.Prelude.Eq diff --git a/testsuite/tests/module/mod111.hs b/testsuite/tests/module/mod111.hs new file mode 100644 index 0000000000..fbc8c0ec31 --- /dev/null +++ b/testsuite/tests/module/mod111.hs @@ -0,0 +1,12 @@ +-- !!! Hiding an abstract (Prelude) type +module M where + +import Prelude hiding ( Char ) +import Data.Char hiding ( ord, Char ) +import qualified Data.Char ( ord ) + +type Char = Int + +ord :: Char -> Int +ord x = Data.Char.ord (chr x) + 1 + diff --git a/testsuite/tests/module/mod112.hs b/testsuite/tests/module/mod112.hs new file mode 100644 index 0000000000..953d930603 --- /dev/null +++ b/testsuite/tests/module/mod112.hs @@ -0,0 +1,12 @@ +-- !!! Hiding an abstract (Prelude) class +module M where + +import Prelude hiding ( Eq ) + +class Eq a where + equ :: a -> Bool + +f :: Eq a => a -> Bool +f x = equ x + + diff --git a/testsuite/tests/module/mod113.hs b/testsuite/tests/module/mod113.hs new file mode 100644 index 0000000000..89f812f74f --- /dev/null +++ b/testsuite/tests/module/mod113.hs @@ -0,0 +1,7 @@ +-- !!! empty decls, alts and stmts +module M where { +;;;;;;;;import Data.Char;;x = 1;;y = 2; +v = do {;;;;;;;;;;;;;;;;;;;;;;;x <- [1];;return x;;}; +f x = case x of { ;;;;;;2 -> 'a';;;;;;3->'b';;;;;;;;;;;};;; +g x = case x of { ;;;;;;;;;; _ -> "aa"; } +} diff --git a/testsuite/tests/module/mod114.hs b/testsuite/tests/module/mod114.hs new file mode 100644 index 0000000000..b739c5d283 --- /dev/null +++ b/testsuite/tests/module/mod114.hs @@ -0,0 +1,4 @@ +-- !!! Type re-exportation test +-- (from bug reported by Ross Paterson.) +module Mod114 (Stuff) where +import Mod114_Help hiding(Stuff(..)) diff --git a/testsuite/tests/module/mod114.stderr b/testsuite/tests/module/mod114.stderr new file mode 100644 index 0000000000..be7202ce01 --- /dev/null +++ b/testsuite/tests/module/mod114.stderr @@ -0,0 +1,2 @@ + +mod114.hs:3:16: Not in scope: type constructor or class `Stuff' diff --git a/testsuite/tests/module/mod114.stderr-hugs b/testsuite/tests/module/mod114.stderr-hugs new file mode 100644 index 0000000000..d71b45dea4 --- /dev/null +++ b/testsuite/tests/module/mod114.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod114.hs" - Unknown entity "Stuff" exported from module "Mod114" diff --git a/testsuite/tests/module/mod115.hs b/testsuite/tests/module/mod115.hs new file mode 100644 index 0000000000..f0bf9439a2 --- /dev/null +++ b/testsuite/tests/module/mod115.hs @@ -0,0 +1,7 @@ +-- !!! class method (re-)exportation trickery +module M where + +import Mod115_B + +f = m1 (1::Int) +g = m2 (2::Int) diff --git a/testsuite/tests/module/mod116.hs b/testsuite/tests/module/mod116.hs new file mode 100644 index 0000000000..42d668c9c8 --- /dev/null +++ b/testsuite/tests/module/mod116.hs @@ -0,0 +1,5 @@ +-- !!! data ctor (re-)exportation +module M (T(M1), M2) where + +data T = M1 Int | M2 Int + diff --git a/testsuite/tests/module/mod116.stderr b/testsuite/tests/module/mod116.stderr new file mode 100644 index 0000000000..c9fb1ded5f --- /dev/null +++ b/testsuite/tests/module/mod116.stderr @@ -0,0 +1,2 @@ + +mod116.hs:2:18: Not in scope: type constructor or class `M2' diff --git a/testsuite/tests/module/mod116.stderr-hugs b/testsuite/tests/module/mod116.stderr-hugs new file mode 100644 index 0000000000..34cb5d7398 --- /dev/null +++ b/testsuite/tests/module/mod116.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod116.hs" - Illegal export of a lone data constructor "M2" diff --git a/testsuite/tests/module/mod117.hs b/testsuite/tests/module/mod117.hs new file mode 100644 index 0000000000..83dc056f9c --- /dev/null +++ b/testsuite/tests/module/mod117.hs @@ -0,0 +1,7 @@ +-- !!! field name (re-)exportation trickery +module M where + +import Mod117_B + +f = m1 undefined +g = m2 undefined diff --git a/testsuite/tests/module/mod118.hs b/testsuite/tests/module/mod118.hs new file mode 100644 index 0000000000..a443b6f123 --- /dev/null +++ b/testsuite/tests/module/mod118.hs @@ -0,0 +1,6 @@ +-- !!! more class method (re-)exportation trickery. +module M where + +import Mod118_B + +g = m2 (2::Int) diff --git a/testsuite/tests/module/mod119.hs b/testsuite/tests/module/mod119.hs new file mode 100644 index 0000000000..d51f5674d9 --- /dev/null +++ b/testsuite/tests/module/mod119.hs @@ -0,0 +1,3 @@ +-- !!! module re-exportation +module M where +import Mod119_B(f) diff --git a/testsuite/tests/module/mod12.hs b/testsuite/tests/module/mod12.hs new file mode 100644 index 0000000000..dcbacb6728 --- /dev/null +++ b/testsuite/tests/module/mod12.hs @@ -0,0 +1,5 @@ +-- !!! Correct class export +module M(C(m1,m2,m3)) where +class C a where + m1 :: a + m2, m3 :: a diff --git a/testsuite/tests/module/mod120.hs b/testsuite/tests/module/mod120.hs new file mode 100644 index 0000000000..04e5039463 --- /dev/null +++ b/testsuite/tests/module/mod120.hs @@ -0,0 +1,5 @@ +-- !!! (..) importation of partially exported types +-- (test / bug report due to Ross Paterson.) +module M where +import Mod120_A(T(..)) +f = Foo diff --git a/testsuite/tests/module/mod120.stderr b/testsuite/tests/module/mod120.stderr new file mode 100644 index 0000000000..0d6181e61a --- /dev/null +++ b/testsuite/tests/module/mod120.stderr @@ -0,0 +1,2 @@ + +mod120.hs:5:5: Not in scope: data constructor `Foo' diff --git a/testsuite/tests/module/mod120.stderr-hugs b/testsuite/tests/module/mod120.stderr-hugs new file mode 100644 index 0000000000..81d8072d77 --- /dev/null +++ b/testsuite/tests/module/mod120.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod120.hs":5 - Undefined data constructor "Foo" diff --git a/testsuite/tests/module/mod121.hs b/testsuite/tests/module/mod121.hs new file mode 100644 index 0000000000..f39427d623 --- /dev/null +++ b/testsuite/tests/module/mod121.hs @@ -0,0 +1,5 @@ +-- !!! (..) importation of partially exported class +-- (test / bug report due to Ross Paterson.) +module M where +import Mod121_A(C(..)) +f = m2 (1::Int) diff --git a/testsuite/tests/module/mod121.stderr b/testsuite/tests/module/mod121.stderr new file mode 100644 index 0000000000..7c2cf2cc9d --- /dev/null +++ b/testsuite/tests/module/mod121.stderr @@ -0,0 +1,4 @@ + +mod121.hs:5:5: + Not in scope: `m2' + Perhaps you meant `m1' (imported from Mod121_A) diff --git a/testsuite/tests/module/mod121.stderr-hugs b/testsuite/tests/module/mod121.stderr-hugs new file mode 100644 index 0000000000..9e77b4cb9f --- /dev/null +++ b/testsuite/tests/module/mod121.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod121.hs":5 - Undefined variable "m2" diff --git a/testsuite/tests/module/mod122.hs b/testsuite/tests/module/mod122.hs new file mode 100644 index 0000000000..84440d1668 --- /dev/null +++ b/testsuite/tests/module/mod122.hs @@ -0,0 +1,6 @@ +-- !!! exporting a method (but not its class) +module M where +import Mod122_A + +f :: C a => a -> a +f = m1 diff --git a/testsuite/tests/module/mod122.stderr b/testsuite/tests/module/mod122.stderr new file mode 100644 index 0000000000..b65f8e9964 --- /dev/null +++ b/testsuite/tests/module/mod122.stderr @@ -0,0 +1,2 @@ + +mod122.hs:5:6: Not in scope: type constructor or class `C' diff --git a/testsuite/tests/module/mod122.stderr-hugs b/testsuite/tests/module/mod122.stderr-hugs new file mode 100644 index 0000000000..569a2f50aa --- /dev/null +++ b/testsuite/tests/module/mod122.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod122.hs":5 - Undefined class "C" diff --git a/testsuite/tests/module/mod123.hs b/testsuite/tests/module/mod123.hs new file mode 100644 index 0000000000..cdf7402115 --- /dev/null +++ b/testsuite/tests/module/mod123.hs @@ -0,0 +1,6 @@ +-- !!! exporting a field name (but not its type) +module M where +import Mod123_A + +f :: T -> Int +f x = f1 x diff --git a/testsuite/tests/module/mod123.stderr b/testsuite/tests/module/mod123.stderr new file mode 100644 index 0000000000..91f75483d3 --- /dev/null +++ b/testsuite/tests/module/mod123.stderr @@ -0,0 +1,2 @@ + +mod123.hs:5:6: Not in scope: type constructor or class `T' diff --git a/testsuite/tests/module/mod123.stderr-hugs b/testsuite/tests/module/mod123.stderr-hugs new file mode 100644 index 0000000000..41f158e73c --- /dev/null +++ b/testsuite/tests/module/mod123.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod123.hs":5 - Undefined type constructor "T" diff --git a/testsuite/tests/module/mod124.hs b/testsuite/tests/module/mod124.hs new file mode 100644 index 0000000000..3fd26f0fb9 --- /dev/null +++ b/testsuite/tests/module/mod124.hs @@ -0,0 +1,7 @@ +-- !!! hiding an entity T (where T is both a type and a dcon.) +module M where + +import Mod124_A hiding (T) + +x :: T +x = undefined diff --git a/testsuite/tests/module/mod124.stderr b/testsuite/tests/module/mod124.stderr new file mode 100644 index 0000000000..22644aa07b --- /dev/null +++ b/testsuite/tests/module/mod124.stderr @@ -0,0 +1,2 @@ + +mod124.hs:6:6: Not in scope: type constructor or class `T' diff --git a/testsuite/tests/module/mod124.stderr-hugs b/testsuite/tests/module/mod124.stderr-hugs new file mode 100644 index 0000000000..b6fd8cbb70 --- /dev/null +++ b/testsuite/tests/module/mod124.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod124.hs":6 - Undefined type constructor "T" diff --git a/testsuite/tests/module/mod125.hs b/testsuite/tests/module/mod125.hs new file mode 100644 index 0000000000..1ee439ef2c --- /dev/null +++ b/testsuite/tests/module/mod125.hs @@ -0,0 +1,7 @@ +-- !!! hiding an entity T (where T is both a type and a dcon.) +module M where + +import Mod125_A hiding (T) + +--x :: T +x = T diff --git a/testsuite/tests/module/mod125.stderr b/testsuite/tests/module/mod125.stderr new file mode 100644 index 0000000000..b2f7fa4503 --- /dev/null +++ b/testsuite/tests/module/mod125.stderr @@ -0,0 +1,2 @@ + +mod125.hs:7:5: Not in scope: data constructor `T' diff --git a/testsuite/tests/module/mod125.stderr-hugs b/testsuite/tests/module/mod125.stderr-hugs new file mode 100644 index 0000000000..e13bdb1cbc --- /dev/null +++ b/testsuite/tests/module/mod125.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod125.hs":7 - Undefined data constructor "T" diff --git a/testsuite/tests/module/mod126.hs b/testsuite/tests/module/mod126.hs new file mode 100644 index 0000000000..b661d385c3 --- /dev/null +++ b/testsuite/tests/module/mod126.hs @@ -0,0 +1,7 @@ +-- !!! hiding an entity T (where T is both a class and a dcon.) +module M where + +import Mod126_A hiding (T) + +--x :: T +x = T diff --git a/testsuite/tests/module/mod126.stderr b/testsuite/tests/module/mod126.stderr new file mode 100644 index 0000000000..22243759ca --- /dev/null +++ b/testsuite/tests/module/mod126.stderr @@ -0,0 +1,2 @@ + +mod126.hs:7:5: Not in scope: data constructor `T' diff --git a/testsuite/tests/module/mod126.stderr-hugs b/testsuite/tests/module/mod126.stderr-hugs new file mode 100644 index 0000000000..e9ada3dac5 --- /dev/null +++ b/testsuite/tests/module/mod126.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod126.hs":7 - Undefined data constructor "T" diff --git a/testsuite/tests/module/mod127.hs b/testsuite/tests/module/mod127.hs new file mode 100644 index 0000000000..4b869f79fd --- /dev/null +++ b/testsuite/tests/module/mod127.hs @@ -0,0 +1,7 @@ +-- !!! hiding an entity T (where T is both a class and a dcon.) +module M where + +import Mod127_A hiding (T) + +x :: T a => a -> a +x = undefined diff --git a/testsuite/tests/module/mod127.stderr b/testsuite/tests/module/mod127.stderr new file mode 100644 index 0000000000..5ffb1b71b6 --- /dev/null +++ b/testsuite/tests/module/mod127.stderr @@ -0,0 +1,2 @@ + +mod127.hs:6:6: Not in scope: type constructor or class `T' diff --git a/testsuite/tests/module/mod127.stderr-hugs b/testsuite/tests/module/mod127.stderr-hugs new file mode 100644 index 0000000000..c2d17c3ee3 --- /dev/null +++ b/testsuite/tests/module/mod127.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod127.hs":6 - Undefined class "T" diff --git a/testsuite/tests/module/mod128.hs b/testsuite/tests/module/mod128.hs new file mode 100644 index 0000000000..5d96e0f464 --- /dev/null +++ b/testsuite/tests/module/mod128.hs @@ -0,0 +1,5 @@ +-- !!! Cumulative exportation +module M where +import Mod128_A(T(..)) + +f = Con diff --git a/testsuite/tests/module/mod128.stderr-ghc b/testsuite/tests/module/mod128.stderr-ghc new file mode 100644 index 0000000000..18c7864048 --- /dev/null +++ b/testsuite/tests/module/mod128.stderr-ghc @@ -0,0 +1,2 @@ + +Mod128_A.hs:2:19: Warning: `T' is exported by `T(Con)' and `T' diff --git a/testsuite/tests/module/mod129.hs b/testsuite/tests/module/mod129.hs new file mode 100644 index 0000000000..4229e9e88a --- /dev/null +++ b/testsuite/tests/module/mod129.hs @@ -0,0 +1,8 @@ +-- !!! hiding class members (but not class.) +module M where + +import Prelude hiding ( (<), (>)) + +x :: Ord a => a -> a +x = undefined + diff --git a/testsuite/tests/module/mod13.hs b/testsuite/tests/module/mod13.hs new file mode 100644 index 0000000000..d7aeb7db94 --- /dev/null +++ b/testsuite/tests/module/mod13.hs @@ -0,0 +1,5 @@ +-- !!! Omitted member from export list +module M(C(m1,m3)) where +class C a where + m1 :: a + m2, m3 :: a diff --git a/testsuite/tests/module/mod130.hs b/testsuite/tests/module/mod130.hs new file mode 100644 index 0000000000..97dbacbfd2 --- /dev/null +++ b/testsuite/tests/module/mod130.hs @@ -0,0 +1,7 @@ +-- !!! hiding class members. +module M where + +import Prelude hiding ( (<), (>)) + +x :: Int -> Int +x = (<) 2 diff --git a/testsuite/tests/module/mod130.stderr b/testsuite/tests/module/mod130.stderr new file mode 100644 index 0000000000..27d3f8470e --- /dev/null +++ b/testsuite/tests/module/mod130.stderr @@ -0,0 +1,2 @@ + +mod130.hs:7:5: Not in scope: `<' diff --git a/testsuite/tests/module/mod130.stderr-hugs b/testsuite/tests/module/mod130.stderr-hugs new file mode 100644 index 0000000000..fcaad49433 --- /dev/null +++ b/testsuite/tests/module/mod130.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod130.hs":7 - Undefined variable "<" diff --git a/testsuite/tests/module/mod131.hs b/testsuite/tests/module/mod131.hs new file mode 100644 index 0000000000..64f7dd1eac --- /dev/null +++ b/testsuite/tests/module/mod131.hs @@ -0,0 +1,5 @@ +-- !!! unqual name conflicts in export lists. Should fail +module C ( Mod131_A.f, g, module Mod131_B ) where +import Mod131_B(f) +import qualified Mod131_A(f) +g = f diff --git a/testsuite/tests/module/mod131.stderr b/testsuite/tests/module/mod131.stderr new file mode 100644 index 0000000000..5dcc5efab8 --- /dev/null +++ b/testsuite/tests/module/mod131.stderr @@ -0,0 +1,7 @@ + +mod131.hs:2:27: + Conflicting exports for `f': + `module Mod131_B' exports `f' imported from Mod131_B at mod131.hs:3:17 + (defined at Mod131_B.hs:3:1) + `Mod131_A.f' exports `Mod131_A.f' imported from Mod131_A at mod131.hs:4:27 + (defined at Mod131_A.hs:3:1) diff --git a/testsuite/tests/module/mod131.stderr-hugs b/testsuite/tests/module/mod131.stderr-hugs new file mode 100644 index 0000000000..c27a6e428f --- /dev/null +++ b/testsuite/tests/module/mod131.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod131.hs" - Conflicting exports of entity "f" +*** Could refer to Mod131_A.f or Mod131_B.f diff --git a/testsuite/tests/module/mod132.hs b/testsuite/tests/module/mod132.hs new file mode 100644 index 0000000000..cecbb9d684 --- /dev/null +++ b/testsuite/tests/module/mod132.hs @@ -0,0 +1,6 @@ +-- !!! dcon hiding (in the presence of identically named tycon.) +-- (test contributed by Ross Paterson.) +module M where +import Mod132_B + +foo = Foo diff --git a/testsuite/tests/module/mod132.stderr b/testsuite/tests/module/mod132.stderr new file mode 100644 index 0000000000..8dbf51014c --- /dev/null +++ b/testsuite/tests/module/mod132.stderr @@ -0,0 +1,2 @@ + +mod132.hs:6:7: Not in scope: data constructor `Foo' diff --git a/testsuite/tests/module/mod132.stderr-hugs b/testsuite/tests/module/mod132.stderr-hugs new file mode 100644 index 0000000000..0bf2ce0a96 --- /dev/null +++ b/testsuite/tests/module/mod132.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod132.hs":6 - Undefined data constructor "Foo" diff --git a/testsuite/tests/module/mod133.hs b/testsuite/tests/module/mod133.hs new file mode 100644 index 0000000000..be05057ac9 --- /dev/null +++ b/testsuite/tests/module/mod133.hs @@ -0,0 +1,17 @@ +-- Control.Monad.Error re-exports Control.Monad.Fix. +-- This test checks that the subordinate-name test +-- for a class operation (when renaming the instance decl) +-- works correctly. + +module ShouldCompile where + +import Control.Monad.Error + +data Foo a = Foo a + +instance Monad Foo where + return a = Foo a + (Foo a) >>= k = k a + +instance MonadFix Foo where + mfix = undefined diff --git a/testsuite/tests/module/mod134.hs b/testsuite/tests/module/mod134.hs new file mode 100644 index 0000000000..aae30f55e0 --- /dev/null +++ b/testsuite/tests/module/mod134.hs @@ -0,0 +1,9 @@ +-- Test that 'hiding' hides the qualified name too + +module Main where +import Prelude hiding (head) + +main = do print (Prelude.head [0..]) + head + +head = print "head" diff --git a/testsuite/tests/module/mod134.stderr b/testsuite/tests/module/mod134.stderr new file mode 100644 index 0000000000..ed8382db63 --- /dev/null +++ b/testsuite/tests/module/mod134.stderr @@ -0,0 +1,7 @@ + +mod134.hs:6:19: + Not in scope: `Prelude.head' + Perhaps you meant one of these: + `Prelude.read' (imported from Prelude), + `Prelude.reads' (imported from Prelude), + `Prelude.snd' (imported from Prelude) diff --git a/testsuite/tests/module/mod134.stderr-hugs b/testsuite/tests/module/mod134.stderr-hugs new file mode 100644 index 0000000000..b39457eedc --- /dev/null +++ b/testsuite/tests/module/mod134.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod134.hs":6 - Undefined qualified variable "Prelude.head" diff --git a/testsuite/tests/module/mod135.hs b/testsuite/tests/module/mod135.hs new file mode 100644 index 0000000000..3905274fec --- /dev/null +++ b/testsuite/tests/module/mod135.hs @@ -0,0 +1,6 @@ +-- !!! Re-exporting qualified import. +module M (module Data.List) where + +import Data.List as Data.Char + + diff --git a/testsuite/tests/module/mod135.stderr b/testsuite/tests/module/mod135.stderr new file mode 100644 index 0000000000..a08f93cb67 --- /dev/null +++ b/testsuite/tests/module/mod135.stderr @@ -0,0 +1,2 @@ + +mod135.hs:2:11: The export item `module Data.List' is not imported diff --git a/testsuite/tests/module/mod135.stderr-hugs b/testsuite/tests/module/mod135.stderr-hugs new file mode 100644 index 0000000000..334aa7bdcf --- /dev/null +++ b/testsuite/tests/module/mod135.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod135.hs" - Unknown module "List" exported from module "M" diff --git a/testsuite/tests/module/mod136.hs b/testsuite/tests/module/mod136.hs new file mode 100644 index 0000000000..1729eea789 --- /dev/null +++ b/testsuite/tests/module/mod136.hs @@ -0,0 +1,7 @@ +-- !!! Re-exporting qualified module. +module M where + +import Mod136_A + +x = zipWith5 + diff --git a/testsuite/tests/module/mod136.stderr b/testsuite/tests/module/mod136.stderr new file mode 100644 index 0000000000..242d20b3de --- /dev/null +++ b/testsuite/tests/module/mod136.stderr @@ -0,0 +1,6 @@ + +mod136.hs:6:5: + Not in scope: `zipWith5' + Perhaps you meant one of these: + `zipWith' (imported from Mod136_A), + `zipWith3' (imported from Mod136_A) diff --git a/testsuite/tests/module/mod136.stderr-hugs b/testsuite/tests/module/mod136.stderr-hugs new file mode 100644 index 0000000000..5333800eea --- /dev/null +++ b/testsuite/tests/module/mod136.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod136.hs":6 - Undefined variable "zipWith5" diff --git a/testsuite/tests/module/mod137.hs b/testsuite/tests/module/mod137.hs new file mode 100644 index 0000000000..0541e54509 --- /dev/null +++ b/testsuite/tests/module/mod137.hs @@ -0,0 +1,9 @@ +-- !!! Re-exporting alias which maps to multiple mods. +module M where + +import Mod137_A + +x = zipWith5 +y = isLatin1 + + diff --git a/testsuite/tests/module/mod138.hs b/testsuite/tests/module/mod138.hs new file mode 100644 index 0000000000..c10487d476 --- /dev/null +++ b/testsuite/tests/module/mod138.hs @@ -0,0 +1,9 @@ +-- !!! Re-exporting alias which maps to multiple mods; some qualified. +module M where + +import Mod138_A + +x = zipWith5 +y = isLatin1 + + diff --git a/testsuite/tests/module/mod138.stderr b/testsuite/tests/module/mod138.stderr new file mode 100644 index 0000000000..2e8a5190d6 --- /dev/null +++ b/testsuite/tests/module/mod138.stderr @@ -0,0 +1,2 @@ + +mod138.hs:7:5: Not in scope: `isLatin1' diff --git a/testsuite/tests/module/mod138.stderr-hugs b/testsuite/tests/module/mod138.stderr-hugs new file mode 100644 index 0000000000..7d1daa0d36 --- /dev/null +++ b/testsuite/tests/module/mod138.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod138.hs":7 - Undefined variable "isLatin1" diff --git a/testsuite/tests/module/mod139.hs b/testsuite/tests/module/mod139.hs new file mode 100644 index 0000000000..ae91e2b8ca --- /dev/null +++ b/testsuite/tests/module/mod139.hs @@ -0,0 +1,11 @@ +-- !!! re-exporting module alias, with hiding. +module M where + +import Mod139_B + +z = Bar +a = Mod139_B.x + +y = m1 (2::Int) + + diff --git a/testsuite/tests/module/mod14.hs b/testsuite/tests/module/mod14.hs new file mode 100644 index 0000000000..b88a4a6988 --- /dev/null +++ b/testsuite/tests/module/mod14.hs @@ -0,0 +1,5 @@ +-- !!! Duplicate member in export list +module M(C(m1,m2,m2,m3)) where +class C a where + m1 :: a + m2, m3 :: a diff --git a/testsuite/tests/module/mod14.stderr-ghc b/testsuite/tests/module/mod14.stderr-ghc new file mode 100644 index 0000000000..be838c3886 --- /dev/null +++ b/testsuite/tests/module/mod14.stderr-ghc @@ -0,0 +1,4 @@ + +mod14.hs:2:10: + Warning: `m2' is exported by `C(m1, m2, m2, m3)' and `C(m1, m2, m2, + m3)' diff --git a/testsuite/tests/module/mod140.hs b/testsuite/tests/module/mod140.hs new file mode 100644 index 0000000000..e40de96e39 --- /dev/null +++ b/testsuite/tests/module/mod140.hs @@ -0,0 +1,6 @@ +-- !!! hiding tycon _only_. +module M where + +import Mod140_A + +a = Bar diff --git a/testsuite/tests/module/mod141.hs b/testsuite/tests/module/mod141.hs new file mode 100644 index 0000000000..f8a65e5a8c --- /dev/null +++ b/testsuite/tests/module/mod141.hs @@ -0,0 +1,7 @@ +-- !!! re-exportation to override select entities. +module M where + +import Mod141_A + +a :: String +a = partition diff --git a/testsuite/tests/module/mod142.hs b/testsuite/tests/module/mod142.hs new file mode 100644 index 0000000000..3be36f3fd2 --- /dev/null +++ b/testsuite/tests/module/mod142.hs @@ -0,0 +1,6 @@ +-- !!! Conflicting re-exportation of var +module M (module M, module Mod142_A) where + +import Mod142_A + +x = 'x' diff --git a/testsuite/tests/module/mod142.stderr b/testsuite/tests/module/mod142.stderr new file mode 100644 index 0000000000..c1c4023e1e --- /dev/null +++ b/testsuite/tests/module/mod142.stderr @@ -0,0 +1,6 @@ + +mod142.hs:2:21: + Conflicting exports for `x': + `module Mod142_A' exports `Mod142_A.x' imported from Mod142_A at mod142.hs:4:1-15 + (defined at Mod142_A.hs:3:1) + `module M' exports `M.x' defined at mod142.hs:6:1 diff --git a/testsuite/tests/module/mod142.stderr-hugs b/testsuite/tests/module/mod142.stderr-hugs new file mode 100644 index 0000000000..1cedd94837 --- /dev/null +++ b/testsuite/tests/module/mod142.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod142.hs" - Conflicting exports of entity "x" +*** Could refer to M.x or Mod142_A.x diff --git a/testsuite/tests/module/mod143.hs b/testsuite/tests/module/mod143.hs new file mode 100644 index 0000000000..92c3d438d7 --- /dev/null +++ b/testsuite/tests/module/mod143.hs @@ -0,0 +1,7 @@ +-- !!! Conflicting re-exportation of tycon +module M (module M, module Mod143_A) where + +import Mod143_A + +data Foo = Baz + diff --git a/testsuite/tests/module/mod143.stderr b/testsuite/tests/module/mod143.stderr new file mode 100644 index 0000000000..e74bc238e1 --- /dev/null +++ b/testsuite/tests/module/mod143.stderr @@ -0,0 +1,6 @@ + +mod143.hs:2:21: + Conflicting exports for `Foo': + `module Mod143_A' exports `Mod143_A.Foo' imported from Mod143_A at mod143.hs:4:1-15 + (defined at Mod143_A.hs:3:6) + `module M' exports `M.Foo' defined at mod143.hs:6:6 diff --git a/testsuite/tests/module/mod143.stderr-hugs b/testsuite/tests/module/mod143.stderr-hugs new file mode 100644 index 0000000000..c728b9c04d --- /dev/null +++ b/testsuite/tests/module/mod143.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod143.hs" - Conflicting exports of entity "Foo" +*** Could refer to M.Foo or Mod143_A.Foo diff --git a/testsuite/tests/module/mod144.hs b/testsuite/tests/module/mod144.hs new file mode 100644 index 0000000000..d808f63f91 --- /dev/null +++ b/testsuite/tests/module/mod144.hs @@ -0,0 +1,7 @@ +-- !!! Conflicting re-exportation of dcon +module M (module Mod144_A,module M) where + +import Mod144_A + +data Foo1 = Bar + diff --git a/testsuite/tests/module/mod144.stderr b/testsuite/tests/module/mod144.stderr new file mode 100644 index 0000000000..e97acdc528 --- /dev/null +++ b/testsuite/tests/module/mod144.stderr @@ -0,0 +1,6 @@ + +mod144.hs:2:27: + Conflicting exports for `Bar': + `module Mod144_A' exports `Mod144_A.Bar' imported from Mod144_A at mod144.hs:4:1-15 + `module M' exports `M.Bar' defined at mod144.hs:6:13 +exit(1) diff --git a/testsuite/tests/module/mod144.stderr-hugs b/testsuite/tests/module/mod144.stderr-hugs new file mode 100644 index 0000000000..3b0c8240e1 --- /dev/null +++ b/testsuite/tests/module/mod144.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod144.hs" - Conflicting exports of entity "Bar" +*** Could refer to Mod143_A.Bar or M.Bar diff --git a/testsuite/tests/module/mod145.hs b/testsuite/tests/module/mod145.hs new file mode 100644 index 0000000000..63c5b72a73 --- /dev/null +++ b/testsuite/tests/module/mod145.hs @@ -0,0 +1,9 @@ +-- !!! Conflicting re-exportation of class methods +module Mod145(module Mod145, module Mod145_A) where + +import Mod145_A + +class C1 a where + m1 :: a -> Int + + diff --git a/testsuite/tests/module/mod145.stderr b/testsuite/tests/module/mod145.stderr new file mode 100644 index 0000000000..47cb0e61cb --- /dev/null +++ b/testsuite/tests/module/mod145.stderr @@ -0,0 +1,6 @@ + +mod145.hs:2:30: + Conflicting exports for `m1': + `module Mod145_A' exports `Mod145_A.m1' imported from Mod145_A at mod145.hs:4:1-15 + (defined at Mod145_A.hs:4:3) + `module Mod145' exports `Mod145.m1' defined at mod145.hs:7:3 diff --git a/testsuite/tests/module/mod145.stderr-hugs b/testsuite/tests/module/mod145.stderr-hugs new file mode 100644 index 0000000000..a00c9b605d --- /dev/null +++ b/testsuite/tests/module/mod145.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod145.hs" - Conflicting exports of entity "m1" +*** Could refer to Mod145.m1 or Mod145_A.m1 diff --git a/testsuite/tests/module/mod146.hs b/testsuite/tests/module/mod146.hs new file mode 100644 index 0000000000..b87f6d51cb --- /dev/null +++ b/testsuite/tests/module/mod146.hs @@ -0,0 +1,8 @@ +-- !!! Conflicting re-exportation of class methods +module Mod146(module Mod146, module Mod145_A) where + +import Mod145_A + +class C1 a where + m1 :: a -> Int + diff --git a/testsuite/tests/module/mod146.stderr b/testsuite/tests/module/mod146.stderr new file mode 100644 index 0000000000..d43f33feb3 --- /dev/null +++ b/testsuite/tests/module/mod146.stderr @@ -0,0 +1,6 @@ + +mod146.hs:2:30: + Conflicting exports for `m1': + `module Mod145_A' exports `Mod145_A.m1' imported from Mod145_A at mod146.hs:4:1-15 + `module Mod146' exports `Mod146.m1' defined at mod146.hs:7:3 +exit(1) diff --git a/testsuite/tests/module/mod146.stderr-hugs b/testsuite/tests/module/mod146.stderr-hugs new file mode 100644 index 0000000000..ba17693f61 --- /dev/null +++ b/testsuite/tests/module/mod146.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod146.hs" - Conflicting exports of entity "m1" +*** Could refer to Mod146.m1 or Mod145_A.m1 diff --git a/testsuite/tests/module/mod147.hs b/testsuite/tests/module/mod147.hs new file mode 100644 index 0000000000..0743c4cb51 --- /dev/null +++ b/testsuite/tests/module/mod147.hs @@ -0,0 +1,6 @@ +-- !!! exporting tycon (but not dcon with same name.) +module M where + +import Mod147_A + +x = D 4 diff --git a/testsuite/tests/module/mod147.stderr b/testsuite/tests/module/mod147.stderr new file mode 100644 index 0000000000..b3bbf76612 --- /dev/null +++ b/testsuite/tests/module/mod147.stderr @@ -0,0 +1,2 @@ + +mod147.hs:6:5: Not in scope: data constructor `D' diff --git a/testsuite/tests/module/mod147.stderr-hugs b/testsuite/tests/module/mod147.stderr-hugs new file mode 100644 index 0000000000..4a469a194f --- /dev/null +++ b/testsuite/tests/module/mod147.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod147.hs":6 - Undefined data constructor "D" diff --git a/testsuite/tests/module/mod148.hs b/testsuite/tests/module/mod148.hs new file mode 100644 index 0000000000..77ccfef6d1 --- /dev/null +++ b/testsuite/tests/module/mod148.hs @@ -0,0 +1,5 @@ +-- !!! re-exportation and ambiguity +-- should not fail as the absence of an export +-- list spec means "export all entities defined, +-- but none imported". +module M where id x = []; diff --git a/testsuite/tests/module/mod149.hs b/testsuite/tests/module/mod149.hs new file mode 100644 index 0000000000..e8187e1ae3 --- /dev/null +++ b/testsuite/tests/module/mod149.hs @@ -0,0 +1,4 @@ +-- !!! re-exportation and ambiguity again. +-- Exporting M (=> id) is not ambiguous, as +-- Prelude isn't also exported. +module M (module M) where id x = x; diff --git a/testsuite/tests/module/mod15.hs b/testsuite/tests/module/mod15.hs new file mode 100644 index 0000000000..c2de445c50 --- /dev/null +++ b/testsuite/tests/module/mod15.hs @@ -0,0 +1,5 @@ +-- !!! Correct class export +module M(C(..)) where +class C a where + m1 :: a + m2, m3 :: a diff --git a/testsuite/tests/module/mod150.hs b/testsuite/tests/module/mod150.hs new file mode 100644 index 0000000000..92bb4f1e67 --- /dev/null +++ b/testsuite/tests/module/mod150.hs @@ -0,0 +1,2 @@ +-- !!! ambiguous re-exportation. +module M (module M,module Prelude) where id x = x; diff --git a/testsuite/tests/module/mod150.stderr b/testsuite/tests/module/mod150.stderr new file mode 100644 index 0000000000..7c5fca1eb4 --- /dev/null +++ b/testsuite/tests/module/mod150.stderr @@ -0,0 +1,5 @@ + +mod150.hs:2:20: + Conflicting exports for `id': + `module M' exports `M.id' defined at mod150.hs:2:42 + `module Prelude' exports `Prelude.id' imported from Prelude diff --git a/testsuite/tests/module/mod150.stderr-hugs b/testsuite/tests/module/mod150.stderr-hugs new file mode 100644 index 0000000000..8693c13d38 --- /dev/null +++ b/testsuite/tests/module/mod150.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod150.hs" - Conflicting exports of entity "id" +*** Could refer to M.id or Hugs.Prelude.id diff --git a/testsuite/tests/module/mod151.hs b/testsuite/tests/module/mod151.hs new file mode 100644 index 0000000000..3bbeda508d --- /dev/null +++ b/testsuite/tests/module/mod151.hs @@ -0,0 +1,2 @@ +-- !!! ambiguous re-exportation. +module M (module M,id) where id x = x; diff --git a/testsuite/tests/module/mod151.stderr b/testsuite/tests/module/mod151.stderr new file mode 100644 index 0000000000..edcea97e44 --- /dev/null +++ b/testsuite/tests/module/mod151.stderr @@ -0,0 +1,5 @@ + +mod151.hs:2:20: + Ambiguous occurrence `id' + It could refer to either `M.id', defined at mod151.hs:2:30 + or `Prelude.id', imported from Prelude diff --git a/testsuite/tests/module/mod151.stderr-hugs b/testsuite/tests/module/mod151.stderr-hugs new file mode 100644 index 0000000000..93e6333df0 --- /dev/null +++ b/testsuite/tests/module/mod151.stderr-hugs @@ -0,0 +1,3 @@ +ERROR "mod151.hs" - Ambiguous export of entity "id" +*** Could refer to: M.id Hugs.Prelude.id + diff --git a/testsuite/tests/module/mod152.hs b/testsuite/tests/module/mod152.hs new file mode 100644 index 0000000000..8f9911b1e5 --- /dev/null +++ b/testsuite/tests/module/mod152.hs @@ -0,0 +1,2 @@ +-- !!! ambiguous re-exportation. +module M (module Prelude,id) where id x = x; diff --git a/testsuite/tests/module/mod152.stderr b/testsuite/tests/module/mod152.stderr new file mode 100644 index 0000000000..3d67ecbd62 --- /dev/null +++ b/testsuite/tests/module/mod152.stderr @@ -0,0 +1,10 @@ + +mod152.hs:2:26: + Ambiguous occurrence `id' + It could refer to either `M.id', defined at mod152.hs:2:36 + or `Prelude.id', imported from Prelude + +mod152.hs:2:26: + Conflicting exports for `id': + `id' exports `M.id' defined at mod152.hs:2:36 + `module Prelude' exports `Prelude.id' imported from Prelude diff --git a/testsuite/tests/module/mod152.stderr-hugs b/testsuite/tests/module/mod152.stderr-hugs new file mode 100644 index 0000000000..c0fa28bb27 --- /dev/null +++ b/testsuite/tests/module/mod152.stderr-hugs @@ -0,0 +1,3 @@ +ERROR "mod152.hs" - Ambiguous export of entity "id" +*** Could refer to: M.id Hugs.Prelude.id + diff --git a/testsuite/tests/module/mod153.hs b/testsuite/tests/module/mod153.hs new file mode 100644 index 0000000000..ee50c89bda --- /dev/null +++ b/testsuite/tests/module/mod153.hs @@ -0,0 +1,2 @@ +-- !!! ambiguous re-exportation. +module M (id) where id x = x; diff --git a/testsuite/tests/module/mod153.stderr b/testsuite/tests/module/mod153.stderr new file mode 100644 index 0000000000..5a35ceb51a --- /dev/null +++ b/testsuite/tests/module/mod153.stderr @@ -0,0 +1,5 @@ + +mod153.hs:2:11: + Ambiguous occurrence `id' + It could refer to either `M.id', defined at mod153.hs:2:21 + or `Prelude.id', imported from Prelude diff --git a/testsuite/tests/module/mod153.stderr-hugs b/testsuite/tests/module/mod153.stderr-hugs new file mode 100644 index 0000000000..7d07f0b360 --- /dev/null +++ b/testsuite/tests/module/mod153.stderr-hugs @@ -0,0 +1,3 @@ +ERROR "mod153.hs" - Ambiguous export of entity "id" +*** Could refer to: M.id Hugs.Prelude.id + diff --git a/testsuite/tests/module/mod154.hs b/testsuite/tests/module/mod154.hs new file mode 100644 index 0000000000..6155b830f0 --- /dev/null +++ b/testsuite/tests/module/mod154.hs @@ -0,0 +1,9 @@ +-- !!! 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'. +-- (Hugs gets this wrong) + +module M where + +import Data.List as M +sort = "foo" diff --git a/testsuite/tests/module/mod155.hs b/testsuite/tests/module/mod155.hs new file mode 100644 index 0000000000..4b94525439 --- /dev/null +++ b/testsuite/tests/module/mod155.hs @@ -0,0 +1,5 @@ +-- !!! ambiguous re-exportation. +module M(module M) where + +import Prelude as M +id x = x diff --git a/testsuite/tests/module/mod155.stderr b/testsuite/tests/module/mod155.stderr new file mode 100644 index 0000000000..a6a732c5b8 --- /dev/null +++ b/testsuite/tests/module/mod155.stderr @@ -0,0 +1,5 @@ + +mod155.hs:2:10: + Conflicting exports for `id': + `module M' exports `M.id' imported from Prelude at mod155.hs:4:1-19 + `module M' exports `M.id' defined at mod155.hs:5:1 diff --git a/testsuite/tests/module/mod155.stderr-hugs b/testsuite/tests/module/mod155.stderr-hugs new file mode 100644 index 0000000000..0f6025a369 --- /dev/null +++ b/testsuite/tests/module/mod155.stderr-hugs @@ -0,0 +1,2 @@ +ERROR "mod155.hs" - Conflicting exports of entity "id" +*** Could refer to Hugs.Prelude.id or M.id diff --git a/testsuite/tests/module/mod156.hs b/testsuite/tests/module/mod156.hs new file mode 100644 index 0000000000..20c2884425 --- /dev/null +++ b/testsuite/tests/module/mod156.hs @@ -0,0 +1,2 @@ +-- !!! non-ambiguous re-exportation. +module M (module Prelude) where id x = x; diff --git a/testsuite/tests/module/mod157.hs b/testsuite/tests/module/mod157.hs new file mode 100644 index 0000000000..582e1a708b --- /dev/null +++ b/testsuite/tests/module/mod157.hs @@ -0,0 +1,13 @@ +-- !!! cumulative re-exportation of data constructors +module M where + +import Mod157_D + +-- Mod157_D re-exports the type T using (..). T is defined +-- in Mod157_A, but (only) two of its constructors are visible +-- in Mod157_D, one via Mod157_B, the other via Mod157_C. +a = A +b = B + + + diff --git a/testsuite/tests/module/mod158.hs b/testsuite/tests/module/mod158.hs new file mode 100644 index 0000000000..611ec04f03 --- /dev/null +++ b/testsuite/tests/module/mod158.hs @@ -0,0 +1,14 @@ +-- !!! cumulative re-exportation of data constructors, pt 2. +module M where + +import Mod157_D + +-- Mod157_D re-exports the type T using (..). T is defined +-- in Mod157_A, but (only) two of its constructors is visible +-- in Mod157_D, one via Mod157_B, the other via Mod157_C. +a = A +b = B +-- C is out of scope. +c = C + + diff --git a/testsuite/tests/module/mod158.stderr b/testsuite/tests/module/mod158.stderr new file mode 100644 index 0000000000..7f6c7d7e85 --- /dev/null +++ b/testsuite/tests/module/mod158.stderr @@ -0,0 +1,3 @@ + +mod158.hs:12:5: Not in scope: data constructor `C' +exit(1) diff --git a/testsuite/tests/module/mod158.stderr-hugs b/testsuite/tests/module/mod158.stderr-hugs new file mode 100644 index 0000000000..d08ca3aa14 --- /dev/null +++ b/testsuite/tests/module/mod158.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod158.hs":12 - Undefined data constructor "C" diff --git a/testsuite/tests/module/mod159.hs b/testsuite/tests/module/mod159.hs new file mode 100644 index 0000000000..f858d03f30 --- /dev/null +++ b/testsuite/tests/module/mod159.hs @@ -0,0 +1,10 @@ +-- !!! cumulative re-exportation of class methods +module M where + +import Mod159_D + +-- Mod159_D re-exports the class C using (..). C is defined +-- in Mod159_A, but (only) two of its methods are visible +-- in Mod159_D, one via Mod159_B, the other via Mod159_C. +a = m1 'a' +b = m2 'b' diff --git a/testsuite/tests/module/mod16.hs b/testsuite/tests/module/mod16.hs new file mode 100644 index 0000000000..3b0e6d7bd9 --- /dev/null +++ b/testsuite/tests/module/mod16.hs @@ -0,0 +1,5 @@ +-- !!! Correct abstract class export +module M(C) where +class C a where + m1 :: a + m2, m3 :: a diff --git a/testsuite/tests/module/mod160.hs b/testsuite/tests/module/mod160.hs new file mode 100644 index 0000000000..a279471c11 --- /dev/null +++ b/testsuite/tests/module/mod160.hs @@ -0,0 +1,12 @@ +-- !!! cumulative re-exportation of class methods, pt 2. +module M where + +import Mod159_D + +-- Mod159_D re-exports the class C using (..). C is defined +-- in Mod159_A, but (only) two of its methods are visible +-- in Mod159_D, one via Mod159_B, the other via Mod159_C. +a = m1 'a' +b = m2 'b' +-- m3 isn't in scope +c = m3 'c' diff --git a/testsuite/tests/module/mod160.stderr b/testsuite/tests/module/mod160.stderr new file mode 100644 index 0000000000..c2dbd5647a --- /dev/null +++ b/testsuite/tests/module/mod160.stderr @@ -0,0 +1,6 @@ + +mod160.hs:12:5: + Not in scope: `m3' + Perhaps you meant one of these: + `m1' (imported from Mod159_D), `m2' (imported from Mod159_D) +exit(1) diff --git a/testsuite/tests/module/mod160.stderr-hugs b/testsuite/tests/module/mod160.stderr-hugs new file mode 100644 index 0000000000..5157fb6630 --- /dev/null +++ b/testsuite/tests/module/mod160.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod160.hs":12 - Undefined variable "m3" diff --git a/testsuite/tests/module/mod161.hs b/testsuite/tests/module/mod161.hs new file mode 100644 index 0000000000..8e900ad72b --- /dev/null +++ b/testsuite/tests/module/mod161.hs @@ -0,0 +1,3 @@ +-- !!! Testing export of unknown name +module Bar(bar) where +foo = foo
\ No newline at end of file diff --git a/testsuite/tests/module/mod161.stderr b/testsuite/tests/module/mod161.stderr new file mode 100644 index 0000000000..1272093eaa --- /dev/null +++ b/testsuite/tests/module/mod161.stderr @@ -0,0 +1,2 @@ + +mod161.hs:2:12: Not in scope: `bar' diff --git a/testsuite/tests/module/mod161.stderr-hugs b/testsuite/tests/module/mod161.stderr-hugs new file mode 100644 index 0000000000..0ea61db9c1 --- /dev/null +++ b/testsuite/tests/module/mod161.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod161.hs" - Unknown entity "bar" exported from module "Bar" diff --git a/testsuite/tests/module/mod162.hs b/testsuite/tests/module/mod162.hs new file mode 100644 index 0000000000..8164ac5354 --- /dev/null +++ b/testsuite/tests/module/mod162.hs @@ -0,0 +1,6 @@ +-- !!! hiding a type (but not dcon of same name) +module M where + +import Mod162_A hiding (T()) + +x = T diff --git a/testsuite/tests/module/mod163.hs b/testsuite/tests/module/mod163.hs new file mode 100644 index 0000000000..f095e1af0c --- /dev/null +++ b/testsuite/tests/module/mod163.hs @@ -0,0 +1,6 @@ +-- !!! lazy name conflict reporting for field labels/selectors. +module M where + +import Mod163_A + +data T = MkT { f :: Int } diff --git a/testsuite/tests/module/mod164.hs b/testsuite/tests/module/mod164.hs new file mode 100644 index 0000000000..f472bfdddc --- /dev/null +++ b/testsuite/tests/module/mod164.hs @@ -0,0 +1,10 @@ +-- !!! lazy name conflict reporting for data constructors +module M where + +import Mod164_A +import Mod164_B + +f x = + case x of + D1 -> 'a' + diff --git a/testsuite/tests/module/mod164.stderr b/testsuite/tests/module/mod164.stderr new file mode 100644 index 0000000000..7a014187ac --- /dev/null +++ b/testsuite/tests/module/mod164.stderr @@ -0,0 +1,7 @@ + +mod164.hs:9:5: + Ambiguous occurrence `D1' + It could refer to either `Mod164_A.D1', imported from Mod164_A at mod164.hs:4:1-15 + (defined at Mod164_A.hs:3:10) + or `Mod164_B.D1', imported from Mod164_B at mod164.hs:5:1-15 + (defined at Mod164_B.hs:3:10) diff --git a/testsuite/tests/module/mod164.stderr-hugs b/testsuite/tests/module/mod164.stderr-hugs new file mode 100644 index 0000000000..d219a28f02 --- /dev/null +++ b/testsuite/tests/module/mod164.stderr-hugs @@ -0,0 +1,3 @@ +ERROR "mod164.hs":7 - Ambiguous data constructor occurrence "D1" +*** Could refer to: Mod164_B.D1 Mod164_A.D1 + diff --git a/testsuite/tests/module/mod165.hs b/testsuite/tests/module/mod165.hs new file mode 100644 index 0000000000..847280ffaf --- /dev/null +++ b/testsuite/tests/module/mod165.hs @@ -0,0 +1,10 @@ +-- !!! lazy name conflict reporting for data constructors (pt.2) +module M where + +import Mod164_A as A +import Mod164_B as A + +f x = + case x of + A.D1 -> 'a' + diff --git a/testsuite/tests/module/mod165.stderr b/testsuite/tests/module/mod165.stderr new file mode 100644 index 0000000000..8a813594a9 --- /dev/null +++ b/testsuite/tests/module/mod165.stderr @@ -0,0 +1,7 @@ + +mod165.hs:9:5: + Ambiguous occurrence `A.D1' + It could refer to either `A.D1', + imported from Mod164_A at mod165.hs:4:1-20 + or `A.D1', imported from Mod164_B at mod165.hs:5:1-20 +exit(1) diff --git a/testsuite/tests/module/mod165.stderr-hugs b/testsuite/tests/module/mod165.stderr-hugs new file mode 100644 index 0000000000..c545d2501f --- /dev/null +++ b/testsuite/tests/module/mod165.stderr-hugs @@ -0,0 +1,3 @@ +ERROR "mod165.hs":7 - Ambiguous qualified data constructor occurrence "A.D1" +*** Could refer to: Mod164_B.D1 Mod164_A.D1 + diff --git a/testsuite/tests/module/mod166.hs b/testsuite/tests/module/mod166.hs new file mode 100644 index 0000000000..86e32cd489 --- /dev/null +++ b/testsuite/tests/module/mod166.hs @@ -0,0 +1,10 @@ +-- !!! lazy name conflict reporting for data constructors (pt.3) +module M where + +import Mod164_A as A +import Mod164_B + +f x = + case x of + A.D1 -> 'a' + diff --git a/testsuite/tests/module/mod167.hs b/testsuite/tests/module/mod167.hs new file mode 100644 index 0000000000..520d5b1383 --- /dev/null +++ b/testsuite/tests/module/mod167.hs @@ -0,0 +1,9 @@ +-- !!! qualified + hiding type constructors (or classes) +module M where + +import qualified Mod164_A hiding (T) + +data T = D1 | D3 + +f = D1 +g = Mod164_A.D1 diff --git a/testsuite/tests/module/mod168.hs b/testsuite/tests/module/mod168.hs new file mode 100644 index 0000000000..1c0deaa579 --- /dev/null +++ b/testsuite/tests/module/mod168.hs @@ -0,0 +1,20 @@ +-- !!! hiding Prelude method names +-- (based on bug report by Iavor Diatchi: +-- http://haskell.org/pipermail/hugs-bugs/2003-October/001369.html +-- ) +module M where + +import Prelude hiding ( negate, enumFrom, + enumFromThen, enumFromTo, + enumFromThenTo ) +import Data.Ix hiding ( rangeSize ) +negate = undefined +enumFrom = undefined +enumFromThen = undefined +enumFromTo = undefined +enumFromThenTo = undefined +rangeSize = undefined + +x = [negate,enumFrom, enumFromThen, enumFromTo, enumFromThenTo, rangeSize] + + diff --git a/testsuite/tests/module/mod169.hs b/testsuite/tests/module/mod169.hs new file mode 100644 index 0000000000..521da07a39 --- /dev/null +++ b/testsuite/tests/module/mod169.hs @@ -0,0 +1,5 @@ +-- !!! Non-clashing local binding and occurrence. +module M where + +m :: Int +m = let length _ = 5 in length [] diff --git a/testsuite/tests/module/mod17.hs b/testsuite/tests/module/mod17.hs new file mode 100644 index 0000000000..c3f219edde --- /dev/null +++ b/testsuite/tests/module/mod17.hs @@ -0,0 +1,5 @@ +-- !!! Testing non-member function in explicit class export list +module M(C(m1,m2,m3,Left)) where +class C a where + m1 :: a + m2, m3 :: a diff --git a/testsuite/tests/module/mod17.stderr b/testsuite/tests/module/mod17.stderr new file mode 100644 index 0000000000..1192637967 --- /dev/null +++ b/testsuite/tests/module/mod17.stderr @@ -0,0 +1,4 @@ + +mod17.hs:2:10: + The export item `C(m1, m2, m3, Left)' + attempts to export constructors or class methods that are not visible here diff --git a/testsuite/tests/module/mod17.stderr-hugs b/testsuite/tests/module/mod17.stderr-hugs new file mode 100644 index 0000000000..74ee84bb82 --- /dev/null +++ b/testsuite/tests/module/mod17.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod17.hs" - Entity "Left" is not a member of class "C" diff --git a/testsuite/tests/module/mod170.hs b/testsuite/tests/module/mod170.hs new file mode 100644 index 0000000000..2a53820645 --- /dev/null +++ b/testsuite/tests/module/mod170.hs @@ -0,0 +1,7 @@ +-- !! Lone import of field label +-- (contributed/reported by Ross Paterson.) +module M where + +import Mod170_A(field) + +x = field diff --git a/testsuite/tests/module/mod171.hs b/testsuite/tests/module/mod171.hs new file mode 100644 index 0000000000..a61e886784 --- /dev/null +++ b/testsuite/tests/module/mod171.hs @@ -0,0 +1,11 @@ +-- !! Test import-unused warnings on 'module M' exports +-- This one should not generate any warnings + +module M (module Mod171_A, h) where + +import Mod171_A -- This isn't unused... +import Mod171_B -- even though this imports all the same stuff + +h :: Int -> Int +h = g + diff --git a/testsuite/tests/module/mod172.hs b/testsuite/tests/module/mod172.hs new file mode 100644 index 0000000000..20af846d72 --- /dev/null +++ b/testsuite/tests/module/mod172.hs @@ -0,0 +1,5 @@ +-- Hugs failed this test Jan06 + +module Mod172 where + +import Mod172_B (f,g) diff --git a/testsuite/tests/module/mod173.hs b/testsuite/tests/module/mod173.hs new file mode 100644 index 0000000000..a7e185bcf6 --- /dev/null +++ b/testsuite/tests/module/mod173.hs @@ -0,0 +1,12 @@ +module ShouldCompile where + +import Mod173_Aux + +t1 = partition -- From the import + +nub = True +t2 = nub -- Unambiguous; nub should not have been exported + +t3 = frob + + diff --git a/testsuite/tests/module/mod174.hs b/testsuite/tests/module/mod174.hs new file mode 100644 index 0000000000..8e8149db7a --- /dev/null +++ b/testsuite/tests/module/mod174.hs @@ -0,0 +1,9 @@ + +-- Test for trac #414 +-- If main is not exported from Main then we should emit an error +-- instead of running it anyway + +module Main () where + +main = putStrLn "Hello, World" + diff --git a/testsuite/tests/module/mod174.stderr b/testsuite/tests/module/mod174.stderr new file mode 100644 index 0000000000..6ef2e753d0 --- /dev/null +++ b/testsuite/tests/module/mod174.stderr @@ -0,0 +1,3 @@ + +mod174.hs:1:1: + The main function `main' is not exported by module `Main' diff --git a/testsuite/tests/module/mod175/Makefile b/testsuite/tests/module/mod175/Makefile new file mode 100644 index 0000000000..65fb2758d8 --- /dev/null +++ b/testsuite/tests/module/mod175/Makefile @@ -0,0 +1,19 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +clean: + rm -f *.o + rm -f *.hi + rm -f test test2 + +# Test for trac bug #437 (Test2 needs to be recompiled in the second GHC +# invocation as the main-is flag now applies to it). + +mod175: + $(MAKE) clean + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make -main-is Test.main Test.hs -o test + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make -main-is Test2.main Test2.hs -o test2 + ./test + ./test2 + diff --git a/testsuite/tests/module/mod175/Test.hs b/testsuite/tests/module/mod175/Test.hs new file mode 100644 index 0000000000..bc280d86a6 --- /dev/null +++ b/testsuite/tests/module/mod175/Test.hs @@ -0,0 +1,7 @@ + +module Test where + +import Test2 hiding (main) + +main = doit + diff --git a/testsuite/tests/module/mod175/Test2.hs b/testsuite/tests/module/mod175/Test2.hs new file mode 100644 index 0000000000..08d75ddf6e --- /dev/null +++ b/testsuite/tests/module/mod175/Test2.hs @@ -0,0 +1,6 @@ + +module Test2 where + +doit = putStrLn "You have run Test2.doit" +main = putStrLn "You have run Test2.main" + diff --git a/testsuite/tests/module/mod175/all.T b/testsuite/tests/module/mod175/all.T new file mode 100644 index 0000000000..8edbf0ae0f --- /dev/null +++ b/testsuite/tests/module/mod175/all.T @@ -0,0 +1,8 @@ +setTestOpts(only_compiler_types(['ghc'])) + +test('mod175', + [expect_broken(437), + clean_cmd('$MAKE -s clean')], + run_command, + ['$MAKE -s mod175']) + diff --git a/testsuite/tests/module/mod175/mod175.stdout b/testsuite/tests/module/mod175/mod175.stdout new file mode 100644 index 0000000000..a69871173d --- /dev/null +++ b/testsuite/tests/module/mod175/mod175.stdout @@ -0,0 +1,2 @@ +You have run Test2.doit +You have run Test2.main diff --git a/testsuite/tests/module/mod176.hs b/testsuite/tests/module/mod176.hs new file mode 100644 index 0000000000..250711345c --- /dev/null +++ b/testsuite/tests/module/mod176.hs @@ -0,0 +1,10 @@ +module ShouldCompile where + +import Prelude () +import Control.Monad( Monad(return), mapM ) + -- Should report Monad and return as unused imports +import GHC.Base + -- But not their import from here + +x = True +y x = mapM diff --git a/testsuite/tests/module/mod176.stderr b/testsuite/tests/module/mod176.stderr new file mode 100644 index 0000000000..7301324a91 --- /dev/null +++ b/testsuite/tests/module/mod176.stderr @@ -0,0 +1,4 @@ + +mod176.hs:4:1: + Warning: The import of `return, Monad' + from module `Control.Monad' is redundant diff --git a/testsuite/tests/module/mod177.hs b/testsuite/tests/module/mod177.hs new file mode 100644 index 0000000000..23fdd73b45 --- /dev/null +++ b/testsuite/tests/module/mod177.hs @@ -0,0 +1,7 @@ +module ShouldCompile where + +import Prelude () +import Data.Maybe( Maybe(..) ) +import Data.Maybe + +f x = Just x diff --git a/testsuite/tests/module/mod177.stderr b/testsuite/tests/module/mod177.stderr new file mode 100644 index 0000000000..1dc7c5c6ae --- /dev/null +++ b/testsuite/tests/module/mod177.stderr @@ -0,0 +1,5 @@ + +mod177.hs:4:1: + Warning: The import of `Data.Maybe' is redundant + except perhaps to import instances from `Data.Maybe' + To import instances alone, use: import Data.Maybe() diff --git a/testsuite/tests/module/mod178.hs b/testsuite/tests/module/mod178.hs new file mode 100644 index 0000000000..00ec81d369 --- /dev/null +++ b/testsuite/tests/module/mod178.hs @@ -0,0 +1,8 @@ + +module Main where + +import Mod178_2 + +main :: IO () +main = print foo + diff --git a/testsuite/tests/module/mod178.stderr b/testsuite/tests/module/mod178.stderr new file mode 100644 index 0000000000..3edd9a4066 --- /dev/null +++ b/testsuite/tests/module/mod178.stderr @@ -0,0 +1,5 @@ + +Mod178_2.hs:1:1: + File name does not match module name: + Saw: `Main' + Expected: `Mod178_2' diff --git a/testsuite/tests/module/mod179.hs b/testsuite/tests/module/mod179.hs new file mode 100644 index 0000000000..3ff71a07a4 --- /dev/null +++ b/testsuite/tests/module/mod179.hs @@ -0,0 +1,5 @@ + +module Main(main) where +import qualified Mod179_A hiding () +main = print Mod179_A.x + diff --git a/testsuite/tests/module/mod179.stdout b/testsuite/tests/module/mod179.stdout new file mode 100644 index 0000000000..0ca95142bb --- /dev/null +++ b/testsuite/tests/module/mod179.stdout @@ -0,0 +1 @@ +True diff --git a/testsuite/tests/module/mod18.hs b/testsuite/tests/module/mod18.hs new file mode 100644 index 0000000000..cfbcdbf62a --- /dev/null +++ b/testsuite/tests/module/mod18.hs @@ -0,0 +1,3 @@ +-- !!! Testing duplicate type synonyms +type T = Int +type T = Float diff --git a/testsuite/tests/module/mod18.stderr b/testsuite/tests/module/mod18.stderr new file mode 100644 index 0000000000..2b9a800bc6 --- /dev/null +++ b/testsuite/tests/module/mod18.stderr @@ -0,0 +1,5 @@ + +mod18.hs:3:6: + Multiple declarations of `Main.T' + Declared at: mod18.hs:2:6 + mod18.hs:3:6 diff --git a/testsuite/tests/module/mod18.stderr-hugs b/testsuite/tests/module/mod18.stderr-hugs new file mode 100644 index 0000000000..50fff9d5e2 --- /dev/null +++ b/testsuite/tests/module/mod18.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod18.hs":3 - Multiple declarations of type constructor "T" diff --git a/testsuite/tests/module/mod180.hs b/testsuite/tests/module/mod180.hs new file mode 100644 index 0000000000..68e043bc50 --- /dev/null +++ b/testsuite/tests/module/mod180.hs @@ -0,0 +1,13 @@ +module ShouldFail where + +import qualified Mod180_B as Mod180_A +import Mod180_B (T) +import Mod180_A (x) + +z :: T +z = x + -- fiendishly, this error message must mention Mod180_A.T (the type + -- of x), but in the current scope, Mod180_A.T means something different: + -- due to the 'import .. as' above, Mod180_A.T actually refers to Mod180_B.T. + -- GHC should notice this and use a fully qualified name "main:Mod180_A.T" + -- in the error message. diff --git a/testsuite/tests/module/mod180.stderr b/testsuite/tests/module/mod180.stderr new file mode 100644 index 0000000000..2790d92a33 --- /dev/null +++ b/testsuite/tests/module/mod180.stderr @@ -0,0 +1,5 @@ + +mod180.hs:8:5: + Couldn't match expected type `T' with actual type `main:Mod180_A.T' + In the expression: x + In an equation for `z': z = x diff --git a/testsuite/tests/module/mod19.hs b/testsuite/tests/module/mod19.hs new file mode 100644 index 0000000000..9f8b49f2b2 --- /dev/null +++ b/testsuite/tests/module/mod19.hs @@ -0,0 +1,3 @@ +-- !!! Testing duplicate classes +class C a where m :: a +class C a where m :: a diff --git a/testsuite/tests/module/mod19.stderr b/testsuite/tests/module/mod19.stderr new file mode 100644 index 0000000000..a988040291 --- /dev/null +++ b/testsuite/tests/module/mod19.stderr @@ -0,0 +1,10 @@ + +mod19.hs:3:7: + Multiple declarations of `Main.C' + Declared at: mod19.hs:2:7 + mod19.hs:3:7 + +mod19.hs:3:17: + Multiple declarations of `Main.m' + Declared at: mod19.hs:2:17 + mod19.hs:3:17 diff --git a/testsuite/tests/module/mod19.stderr-hugs b/testsuite/tests/module/mod19.stderr-hugs new file mode 100644 index 0000000000..c38263918b --- /dev/null +++ b/testsuite/tests/module/mod19.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod19.hs":3 - Multiple declarations of class "C" diff --git a/testsuite/tests/module/mod2.hs b/testsuite/tests/module/mod2.hs new file mode 100644 index 0000000000..d0821071b6 --- /dev/null +++ b/testsuite/tests/module/mod2.hs @@ -0,0 +1,3 @@ +-- !!! Qualified import of unknown module +module M where +import qualified N diff --git a/testsuite/tests/module/mod2.stderr b/testsuite/tests/module/mod2.stderr new file mode 100644 index 0000000000..e928ab3b19 --- /dev/null +++ b/testsuite/tests/module/mod2.stderr @@ -0,0 +1,4 @@ + +mod2.hs:3:1: + Failed to load interface for `N' + Use -v to see a list of the files searched for. diff --git a/testsuite/tests/module/mod2.stderr-hugs b/testsuite/tests/module/mod2.stderr-hugs new file mode 100644 index 0000000000..ee12e8e265 --- /dev/null +++ b/testsuite/tests/module/mod2.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod2.hs" - Can't find imported module "N" diff --git a/testsuite/tests/module/mod20.hs b/testsuite/tests/module/mod20.hs new file mode 100644 index 0000000000..68d6ede9d0 --- /dev/null +++ b/testsuite/tests/module/mod20.hs @@ -0,0 +1,3 @@ +-- !!! Testing duplicate members +class C1 a where m :: a +class C2 a where m :: a
\ No newline at end of file diff --git a/testsuite/tests/module/mod20.stderr b/testsuite/tests/module/mod20.stderr new file mode 100644 index 0000000000..355fe1c038 --- /dev/null +++ b/testsuite/tests/module/mod20.stderr @@ -0,0 +1,5 @@ + +mod20.hs:3:18: + Multiple declarations of `Main.m' + Declared at: mod20.hs:2:18 + mod20.hs:3:18 diff --git a/testsuite/tests/module/mod20.stderr-hugs b/testsuite/tests/module/mod20.stderr-hugs new file mode 100644 index 0000000000..c8951af078 --- /dev/null +++ b/testsuite/tests/module/mod20.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod20.hs":2 - Multiple declarations for member function "m" diff --git a/testsuite/tests/module/mod21.hs b/testsuite/tests/module/mod21.hs new file mode 100644 index 0000000000..7d24286464 --- /dev/null +++ b/testsuite/tests/module/mod21.hs @@ -0,0 +1,3 @@ +-- !!! Testing duplicate type constructors +data T = K1 +data T = K2 diff --git a/testsuite/tests/module/mod21.stderr b/testsuite/tests/module/mod21.stderr new file mode 100644 index 0000000000..4a6a8edec7 --- /dev/null +++ b/testsuite/tests/module/mod21.stderr @@ -0,0 +1,5 @@ + +mod21.hs:3:6: + Multiple declarations of `Main.T' + Declared at: mod21.hs:2:6 + mod21.hs:3:6 diff --git a/testsuite/tests/module/mod21.stderr-hugs b/testsuite/tests/module/mod21.stderr-hugs new file mode 100644 index 0000000000..bdf6f93413 --- /dev/null +++ b/testsuite/tests/module/mod21.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod21.hs":3 - Multiple declarations of type constructor "T" diff --git a/testsuite/tests/module/mod22.hs b/testsuite/tests/module/mod22.hs new file mode 100644 index 0000000000..69cc870720 --- /dev/null +++ b/testsuite/tests/module/mod22.hs @@ -0,0 +1,3 @@ +-- !!! Testing duplicate data constructors +data T1 = K +data T2 = K diff --git a/testsuite/tests/module/mod22.stderr b/testsuite/tests/module/mod22.stderr new file mode 100644 index 0000000000..9cf3f768d2 --- /dev/null +++ b/testsuite/tests/module/mod22.stderr @@ -0,0 +1,5 @@ + +mod22.hs:3:11: + Multiple declarations of `Main.K' + Declared at: mod22.hs:2:11 + mod22.hs:3:11 diff --git a/testsuite/tests/module/mod22.stderr-hugs b/testsuite/tests/module/mod22.stderr-hugs new file mode 100644 index 0000000000..734348f1cb --- /dev/null +++ b/testsuite/tests/module/mod22.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod22.hs":2 - Multiple declarations for data constructor "K" diff --git a/testsuite/tests/module/mod23.hs b/testsuite/tests/module/mod23.hs new file mode 100644 index 0000000000..84753b4189 --- /dev/null +++ b/testsuite/tests/module/mod23.hs @@ -0,0 +1,3 @@ +module ShouldFail where +-- !!! Testing duplicate type variables +type T a a = Either a a diff --git a/testsuite/tests/module/mod23.stderr b/testsuite/tests/module/mod23.stderr new file mode 100644 index 0000000000..3085cfff37 --- /dev/null +++ b/testsuite/tests/module/mod23.stderr @@ -0,0 +1,5 @@ + +mod23.hs:3:8: + Conflicting definitions for `a' + Bound at: mod23.hs:3:8 + mod23.hs:3:10 diff --git a/testsuite/tests/module/mod23.stderr-hugs b/testsuite/tests/module/mod23.stderr-hugs new file mode 100644 index 0000000000..71f47b8e3c --- /dev/null +++ b/testsuite/tests/module/mod23.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod23.hs":3 - Repeated type variable "a" on left hand side diff --git a/testsuite/tests/module/mod24.hs b/testsuite/tests/module/mod24.hs new file mode 100644 index 0000000000..6e1654b4f9 --- /dev/null +++ b/testsuite/tests/module/mod24.hs @@ -0,0 +1,3 @@ +module ShouldFail where +-- !!! Testing duplicate type variables +data T a a = K a a diff --git a/testsuite/tests/module/mod24.stderr b/testsuite/tests/module/mod24.stderr new file mode 100644 index 0000000000..12ed89e59a --- /dev/null +++ b/testsuite/tests/module/mod24.stderr @@ -0,0 +1,5 @@ + +mod24.hs:3:8: + Conflicting definitions for `a' + Bound at: mod24.hs:3:8 + mod24.hs:3:10 diff --git a/testsuite/tests/module/mod24.stderr-hugs b/testsuite/tests/module/mod24.stderr-hugs new file mode 100644 index 0000000000..60ffcc5f90 --- /dev/null +++ b/testsuite/tests/module/mod24.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod24.hs":3 - Repeated type variable "a" on left hand side diff --git a/testsuite/tests/module/mod25.hs b/testsuite/tests/module/mod25.hs new file mode 100644 index 0000000000..e1f5087379 --- /dev/null +++ b/testsuite/tests/module/mod25.hs @@ -0,0 +1,3 @@ +module ShouldFail where +-- !!! Testing bogus (or existential) type variables +data T a = K a b diff --git a/testsuite/tests/module/mod25.stderr b/testsuite/tests/module/mod25.stderr new file mode 100644 index 0000000000..49a15454aa --- /dev/null +++ b/testsuite/tests/module/mod25.stderr @@ -0,0 +1,2 @@ + +mod25.hs:3:16: Not in scope: type variable `b' diff --git a/testsuite/tests/module/mod25.stderr-hugs b/testsuite/tests/module/mod25.stderr-hugs new file mode 100644 index 0000000000..e5fa83448b --- /dev/null +++ b/testsuite/tests/module/mod25.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod25.hs":3 - Undefined type variable "b" diff --git a/testsuite/tests/module/mod26.hs b/testsuite/tests/module/mod26.hs new file mode 100644 index 0000000000..d58b1de1d0 --- /dev/null +++ b/testsuite/tests/module/mod26.hs @@ -0,0 +1,3 @@ +module ShouldFail where +-- !!! Testing bogus (or existential) type variables +type T a = Either a b diff --git a/testsuite/tests/module/mod26.stderr b/testsuite/tests/module/mod26.stderr new file mode 100644 index 0000000000..914f879d61 --- /dev/null +++ b/testsuite/tests/module/mod26.stderr @@ -0,0 +1,2 @@ + +mod26.hs:3:21: Not in scope: type variable `b' diff --git a/testsuite/tests/module/mod26.stderr-hugs b/testsuite/tests/module/mod26.stderr-hugs new file mode 100644 index 0000000000..2f279dfcdc --- /dev/null +++ b/testsuite/tests/module/mod26.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod26.hs":3 - Undefined type variable "b" diff --git a/testsuite/tests/module/mod27.hs b/testsuite/tests/module/mod27.hs new file mode 100644 index 0000000000..394fa2341d --- /dev/null +++ b/testsuite/tests/module/mod27.hs @@ -0,0 +1,4 @@ +module ShouldFail where +-- !!! Testing recursive type synonyms +type T1 = (Int,T2) +type T2 = (Int,T1) diff --git a/testsuite/tests/module/mod27.stderr b/testsuite/tests/module/mod27.stderr new file mode 100644 index 0000000000..85848345d5 --- /dev/null +++ b/testsuite/tests/module/mod27.stderr @@ -0,0 +1,5 @@ + +mod27.hs:3:1: + Cycle in type synonym declarations: + mod27.hs:3:1-18: type T1 = (Int, T2) + mod27.hs:4:1-18: type T2 = (Int, T1) diff --git a/testsuite/tests/module/mod27.stderr-hugs b/testsuite/tests/module/mod27.stderr-hugs new file mode 100644 index 0000000000..0590e990da --- /dev/null +++ b/testsuite/tests/module/mod27.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod27.hs":3 - Type synonyms "T1" and "T2" are mutually recursive diff --git a/testsuite/tests/module/mod29.hs b/testsuite/tests/module/mod29.hs new file mode 100644 index 0000000000..cce8eb5f5b --- /dev/null +++ b/testsuite/tests/module/mod29.hs @@ -0,0 +1,6 @@ +-- !!! Testing for out of scope Prelude types. +-- was: Imported tycon clashes with local definition +-- (but that's OK, as long as the type isn't _used_.) +module M where +import Prelude(Int) +type Int = Char diff --git a/testsuite/tests/module/mod29.stderr b/testsuite/tests/module/mod29.stderr new file mode 100644 index 0000000000..ba62a734f0 --- /dev/null +++ b/testsuite/tests/module/mod29.stderr @@ -0,0 +1,2 @@ + +mod29.hs:6:12: Not in scope: type constructor or class `Char' diff --git a/testsuite/tests/module/mod29.stderr-hugs b/testsuite/tests/module/mod29.stderr-hugs new file mode 100644 index 0000000000..ce2a23bf0f --- /dev/null +++ b/testsuite/tests/module/mod29.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod29.hs":6 - Undefined type constructor "Char" diff --git a/testsuite/tests/module/mod3.hs b/testsuite/tests/module/mod3.hs new file mode 100644 index 0000000000..ec31b6e480 --- /dev/null +++ b/testsuite/tests/module/mod3.hs @@ -0,0 +1,4 @@ +-- !!! Exporting "constructor" of a type synonym +module M(T(K1)) where +type T = T' +data T' = K1
\ No newline at end of file diff --git a/testsuite/tests/module/mod3.stderr b/testsuite/tests/module/mod3.stderr new file mode 100644 index 0000000000..2b0cae95fa --- /dev/null +++ b/testsuite/tests/module/mod3.stderr @@ -0,0 +1,4 @@ + +mod3.hs:2:10: + The export item `T(K1)' + attempts to export constructors or class methods that are not visible here diff --git a/testsuite/tests/module/mod3.stderr-hugs b/testsuite/tests/module/mod3.stderr-hugs new file mode 100644 index 0000000000..4aa156e5ca --- /dev/null +++ b/testsuite/tests/module/mod3.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod3.hs" - Explicit constructor list given for type synonym "T" in export list of module "M" diff --git a/testsuite/tests/module/mod30.hs b/testsuite/tests/module/mod30.hs new file mode 100644 index 0000000000..8f87970a2d --- /dev/null +++ b/testsuite/tests/module/mod30.hs @@ -0,0 +1,4 @@ +-- !!! Imported class clashes with local class definition +module M where +import Prelude(Eq,Bool) +class Eq a where (==) :: a -> a -> Bool diff --git a/testsuite/tests/module/mod31.hs b/testsuite/tests/module/mod31.hs new file mode 100644 index 0000000000..70f66a391e --- /dev/null +++ b/testsuite/tests/module/mod31.hs @@ -0,0 +1,5 @@ +-- !!! Defining local type with same name as imported class +-- was: Imported class clashes with local type definition +module M where +import Prelude(Eq,Bool) +type Eq = Bool diff --git a/testsuite/tests/module/mod32.hs b/testsuite/tests/module/mod32.hs new file mode 100644 index 0000000000..2922bab0ce --- /dev/null +++ b/testsuite/tests/module/mod32.hs @@ -0,0 +1,5 @@ +-- !!! Defining local class with same name as imported type. +-- was: Imported tycon clashes with local class definition +module M where +import Prelude(Int,Bool) +class Int a where (==) :: a -> a -> Bool diff --git a/testsuite/tests/module/mod33.hs b/testsuite/tests/module/mod33.hs new file mode 100644 index 0000000000..04d984af39 --- /dev/null +++ b/testsuite/tests/module/mod33.hs @@ -0,0 +1,5 @@ +-- !!! Redefining an imported name +-- was: Imported var clashes with local var definition +module M where +import Prelude(id) +id x = x diff --git a/testsuite/tests/module/mod34.hs b/testsuite/tests/module/mod34.hs new file mode 100644 index 0000000000..9b59245630 --- /dev/null +++ b/testsuite/tests/module/mod34.hs @@ -0,0 +1,5 @@ +-- !!! Defining local value with same name as imported class member. +-- was: Imported member fun clashes with local var definition +module M where +import Data.Ix(Ix(..)) +index x = x diff --git a/testsuite/tests/module/mod35.hs b/testsuite/tests/module/mod35.hs new file mode 100644 index 0000000000..614bb73130 --- /dev/null +++ b/testsuite/tests/module/mod35.hs @@ -0,0 +1,5 @@ +-- !!! Redefining imported data constructors +-- was: Imported constructor clashes with local constructor +module M where +import Prelude(Bool(True,False)) +data T = True diff --git a/testsuite/tests/module/mod36.hs b/testsuite/tests/module/mod36.hs new file mode 100644 index 0000000000..9bd609c019 --- /dev/null +++ b/testsuite/tests/module/mod36.hs @@ -0,0 +1,5 @@ +-- !!! Hiding lists "intersect" part 1 +module M where +import Prelude hiding (const,id) +import Prelude hiding (const) +x = const diff --git a/testsuite/tests/module/mod36.stderr b/testsuite/tests/module/mod36.stderr new file mode 100644 index 0000000000..9d6b97bfa9 --- /dev/null +++ b/testsuite/tests/module/mod36.stderr @@ -0,0 +1,2 @@ + +mod36.hs:5:5: Not in scope: `const' diff --git a/testsuite/tests/module/mod36.stderr-hugs b/testsuite/tests/module/mod36.stderr-hugs new file mode 100644 index 0000000000..b97ba265bd --- /dev/null +++ b/testsuite/tests/module/mod36.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod36.hs":5 - Undefined variable "const" diff --git a/testsuite/tests/module/mod37.hs b/testsuite/tests/module/mod37.hs new file mode 100644 index 0000000000..4e21e6c9a9 --- /dev/null +++ b/testsuite/tests/module/mod37.hs @@ -0,0 +1,5 @@ +-- !!! Hiding lists "intersect" part 2 +module M where +import Prelude hiding (const,id) +import Prelude hiding (const) +x = id diff --git a/testsuite/tests/module/mod38.hs b/testsuite/tests/module/mod38.hs new file mode 100644 index 0000000000..1391fbaeaf --- /dev/null +++ b/testsuite/tests/module/mod38.hs @@ -0,0 +1,4 @@ +-- !!! Class decl clashes with type decl +module M where +type C = Int +class C a where f :: a diff --git a/testsuite/tests/module/mod38.stderr b/testsuite/tests/module/mod38.stderr new file mode 100644 index 0000000000..2b124d5f6c --- /dev/null +++ b/testsuite/tests/module/mod38.stderr @@ -0,0 +1,5 @@ + +mod38.hs:4:7: + Multiple declarations of `M.C' + Declared at: mod38.hs:3:6 + mod38.hs:4:7 diff --git a/testsuite/tests/module/mod38.stderr-hugs b/testsuite/tests/module/mod38.stderr-hugs new file mode 100644 index 0000000000..1c2fed7dee --- /dev/null +++ b/testsuite/tests/module/mod38.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod38.hs":4 - "C" used as both class and type constructor diff --git a/testsuite/tests/module/mod39.hs b/testsuite/tests/module/mod39.hs new file mode 100644 index 0000000000..477e0a3854 --- /dev/null +++ b/testsuite/tests/module/mod39.hs @@ -0,0 +1,3 @@ +-- !!! Class variable constraints on member funs +module M where +class C a where f :: Eq a => a diff --git a/testsuite/tests/module/mod4.hs b/testsuite/tests/module/mod4.hs new file mode 100644 index 0000000000..02f579800f --- /dev/null +++ b/testsuite/tests/module/mod4.hs @@ -0,0 +1,3 @@ +-- !!! Exporting unknown constructor +module M(T(K1,K2)) where +data T = K1 diff --git a/testsuite/tests/module/mod4.stderr b/testsuite/tests/module/mod4.stderr new file mode 100644 index 0000000000..84d7cfa19e --- /dev/null +++ b/testsuite/tests/module/mod4.stderr @@ -0,0 +1,4 @@ + +mod4.hs:2:10: + The export item `T(K1, K2)' + attempts to export constructors or class methods that are not visible here diff --git a/testsuite/tests/module/mod4.stderr-hugs b/testsuite/tests/module/mod4.stderr-hugs new file mode 100644 index 0000000000..e3aa770ecd --- /dev/null +++ b/testsuite/tests/module/mod4.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod4.hs" - Entity "K2" is not a constructor of type "T" diff --git a/testsuite/tests/module/mod40.hs b/testsuite/tests/module/mod40.hs new file mode 100644 index 0000000000..5fc8a2e0f7 --- /dev/null +++ b/testsuite/tests/module/mod40.hs @@ -0,0 +1,4 @@ +-- !!! Cyclic class hierarchy +module M where +class C2 a => C1 a where f :: a +class C1 a => C2 a where g :: a diff --git a/testsuite/tests/module/mod40.stderr b/testsuite/tests/module/mod40.stderr new file mode 100644 index 0000000000..35c2151e83 --- /dev/null +++ b/testsuite/tests/module/mod40.stderr @@ -0,0 +1,5 @@ +
+mod40.hs:3:1:
+ Cycle in class declarations (via superclasses):
+ mod40.hs:3:1-31: class C2 a => C1 a
+ mod40.hs:4:1-31: class C1 a => C2 a
diff --git a/testsuite/tests/module/mod40.stderr-hugs b/testsuite/tests/module/mod40.stderr-hugs new file mode 100644 index 0000000000..50b78c836e --- /dev/null +++ b/testsuite/tests/module/mod40.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod40.hs":4 - Superclass relation for "C2" is cyclic diff --git a/testsuite/tests/module/mod41.hs b/testsuite/tests/module/mod41.hs new file mode 100644 index 0000000000..a1ac924242 --- /dev/null +++ b/testsuite/tests/module/mod41.hs @@ -0,0 +1,3 @@ +-- !!! Repeated variable in instance predicate +module M where +instance Eq a => Eq (Either a a) diff --git a/testsuite/tests/module/mod41.stderr b/testsuite/tests/module/mod41.stderr new file mode 100644 index 0000000000..5ec4355fbe --- /dev/null +++ b/testsuite/tests/module/mod41.stderr @@ -0,0 +1,8 @@ + +mod41.hs:3:18: + Illegal instance declaration for `Eq (Either a a)' + (All instance types must be of the form (T a1 ... an) + where a1 ... an are *distinct type variables*, + and each type variable appears at most once in the instance head. + Use -XFlexibleInstances if you want to disable this.) + In the instance declaration for `Eq (Either a a)' diff --git a/testsuite/tests/module/mod41.stderr-hugs b/testsuite/tests/module/mod41.stderr-hugs new file mode 100644 index 0000000000..50f49c0297 --- /dev/null +++ b/testsuite/tests/module/mod41.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod41.hs":3 - Repeated type variable "a" in instance head diff --git a/testsuite/tests/module/mod42.hs b/testsuite/tests/module/mod42.hs new file mode 100644 index 0000000000..9828d8b642 --- /dev/null +++ b/testsuite/tests/module/mod42.hs @@ -0,0 +1,3 @@ +-- !!! Not "simple type" in instance +module M where +instance Eq a diff --git a/testsuite/tests/module/mod42.stderr b/testsuite/tests/module/mod42.stderr new file mode 100644 index 0000000000..319f42ba05 --- /dev/null +++ b/testsuite/tests/module/mod42.stderr @@ -0,0 +1,8 @@ + +mod42.hs:3:10: + Illegal instance declaration for `Eq a' + (All instance types must be of the form (T a1 ... an) + where a1 ... an are *distinct type variables*, + and each type variable appears at most once in the instance head. + Use -XFlexibleInstances if you want to disable this.) + In the instance declaration for `Eq a' diff --git a/testsuite/tests/module/mod42.stderr-hugs b/testsuite/tests/module/mod42.stderr-hugs new file mode 100644 index 0000000000..481d86444d --- /dev/null +++ b/testsuite/tests/module/mod42.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod42.hs":3 - Syntax error in instance head (constructor expected) diff --git a/testsuite/tests/module/mod43.hs b/testsuite/tests/module/mod43.hs new file mode 100644 index 0000000000..085382f8b0 --- /dev/null +++ b/testsuite/tests/module/mod43.hs @@ -0,0 +1,3 @@ +-- !!! Type synonym in instance +module M where +instance Eq String diff --git a/testsuite/tests/module/mod43.stderr b/testsuite/tests/module/mod43.stderr new file mode 100644 index 0000000000..7fc4da0b8b --- /dev/null +++ b/testsuite/tests/module/mod43.stderr @@ -0,0 +1,7 @@ + +mod43.hs:3:10: + Illegal instance declaration for `Eq String' + (All instance types must be of the form (T t1 ... tn) + where T is not a synonym. + Use -XTypeSynonymInstances if you want to disable this.) + In the instance declaration for `Eq String' diff --git a/testsuite/tests/module/mod43.stderr-hugs b/testsuite/tests/module/mod43.stderr-hugs new file mode 100644 index 0000000000..4c8f7aeefd --- /dev/null +++ b/testsuite/tests/module/mod43.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod43.hs":3 - Cannot use type synonym in instance head diff --git a/testsuite/tests/module/mod44.hs b/testsuite/tests/module/mod44.hs new file mode 100644 index 0000000000..f5b34cd50e --- /dev/null +++ b/testsuite/tests/module/mod44.hs @@ -0,0 +1,5 @@ +-- !!! Repeated instance decl +module M where +data T = T Int +instance Eq T +instance Eq T diff --git a/testsuite/tests/module/mod44.stderr b/testsuite/tests/module/mod44.stderr new file mode 100644 index 0000000000..b6276a5235 --- /dev/null +++ b/testsuite/tests/module/mod44.stderr @@ -0,0 +1,5 @@ + +mod44.hs:4:10: + Duplicate instance declarations: + instance Eq T -- Defined at mod44.hs:4:10-13 + instance Eq T -- Defined at mod44.hs:5:10-13 diff --git a/testsuite/tests/module/mod44.stderr-hugs b/testsuite/tests/module/mod44.stderr-hugs new file mode 100644 index 0000000000..c23e7218d7 --- /dev/null +++ b/testsuite/tests/module/mod44.stderr-hugs @@ -0,0 +1,4 @@ +ERROR "mod44.hs":5 - Overlapping instances for class "Eq" +*** This instance : Eq T +*** Overlaps with : Eq T +*** Common instance : Eq T diff --git a/testsuite/tests/module/mod45.hs b/testsuite/tests/module/mod45.hs new file mode 100644 index 0000000000..03a1bc32ba --- /dev/null +++ b/testsuite/tests/module/mod45.hs @@ -0,0 +1,7 @@ +-- !!! Type sigs in instance decl +module M where +data T = T Int +instance Eq T where + (==) :: T -> T -> Bool + T x == T y = x == y + diff --git a/testsuite/tests/module/mod45.stderr b/testsuite/tests/module/mod45.stderr new file mode 100644 index 0000000000..bba6b1b7d7 --- /dev/null +++ b/testsuite/tests/module/mod45.stderr @@ -0,0 +1,2 @@ + +mod45.hs:5:3: Misplaced type signature: == :: T -> T -> Bool diff --git a/testsuite/tests/module/mod45.stderr-hugs b/testsuite/tests/module/mod45.stderr-hugs new file mode 100644 index 0000000000..5874ebc5fa --- /dev/null +++ b/testsuite/tests/module/mod45.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod45.hs":4 - Type signature declarations not permitted in instance declaration diff --git a/testsuite/tests/module/mod46.hs b/testsuite/tests/module/mod46.hs new file mode 100644 index 0000000000..4b7a8f8135 --- /dev/null +++ b/testsuite/tests/module/mod46.hs @@ -0,0 +1,4 @@ +-- !!! Instances of superclasses exist +module M where +data T = T Int +instance Ord T diff --git a/testsuite/tests/module/mod46.stderr b/testsuite/tests/module/mod46.stderr new file mode 100644 index 0000000000..603d0d6e79 --- /dev/null +++ b/testsuite/tests/module/mod46.stderr @@ -0,0 +1,6 @@ + +mod46.hs:4:10: + No instance for (Eq T) + arising from the superclasses of an instance declaration + Possible fix: add an instance declaration for (Eq T) + In the instance declaration for `Ord T' diff --git a/testsuite/tests/module/mod46.stderr-hugs b/testsuite/tests/module/mod46.stderr-hugs new file mode 100644 index 0000000000..ae15a4f695 --- /dev/null +++ b/testsuite/tests/module/mod46.stderr-hugs @@ -0,0 +1,4 @@ +ERROR "mod46.hs":4 - Cannot build superclass instance +*** Instance : Ord T +*** Context supplied : () +*** Required superclass : Eq T diff --git a/testsuite/tests/module/mod47.hs b/testsuite/tests/module/mod47.hs new file mode 100644 index 0000000000..f0f487dda2 --- /dev/null +++ b/testsuite/tests/module/mod47.hs @@ -0,0 +1,7 @@ +-- !!! Instance context can't satisfy class-hierarchy constraint +module M where +class Foo a +class Foo a => Bar a +instance Num a => Foo [a] +instance (Eq a, Enum a) => Bar [a] + diff --git a/testsuite/tests/module/mod47.stderr b/testsuite/tests/module/mod47.stderr new file mode 100644 index 0000000000..1b8fd0b411 --- /dev/null +++ b/testsuite/tests/module/mod47.stderr @@ -0,0 +1,9 @@ + +mod47.hs:6:10: + Could not deduce (Num a) + arising from the superclasses of an instance declaration + from the context (Eq a, Enum a) + bound by the instance declaration at mod47.hs:6:10-34 + Possible fix: + add (Num a) to the context of the instance declaration + In the instance declaration for `Bar [a]' diff --git a/testsuite/tests/module/mod47.stderr-hugs b/testsuite/tests/module/mod47.stderr-hugs new file mode 100644 index 0000000000..a26b99b109 --- /dev/null +++ b/testsuite/tests/module/mod47.stderr-hugs @@ -0,0 +1,4 @@ +ERROR "mod47.hs":6 - Cannot build superclass instance +*** Instance : Bar [a] +*** Context supplied : (Eq a, Enum a) +*** Required superclass : Foo [a] diff --git a/testsuite/tests/module/mod48.hs b/testsuite/tests/module/mod48.hs new file mode 100644 index 0000000000..681d356e2e --- /dev/null +++ b/testsuite/tests/module/mod48.hs @@ -0,0 +1,5 @@ +-- !!! Class decl can't use pattern bindings +module M where +class C a where + x,y :: a + (x,y) = error "foo"
\ No newline at end of file diff --git a/testsuite/tests/module/mod48.stderr b/testsuite/tests/module/mod48.stderr new file mode 100644 index 0000000000..d184d2a7a2 --- /dev/null +++ b/testsuite/tests/module/mod48.stderr @@ -0,0 +1,4 @@ + +mod48.hs:5:3: + Pattern bindings (except simple variables) not allowed in instance declarations + (x, y) = error "foo" diff --git a/testsuite/tests/module/mod48.stderr-hugs b/testsuite/tests/module/mod48.stderr-hugs new file mode 100644 index 0000000000..9abf8c5dbd --- /dev/null +++ b/testsuite/tests/module/mod48.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod48.hs":5 - Pattern binding illegal in class declaration diff --git a/testsuite/tests/module/mod49.hs b/testsuite/tests/module/mod49.hs new file mode 100644 index 0000000000..7f995ecfbc --- /dev/null +++ b/testsuite/tests/module/mod49.hs @@ -0,0 +1,5 @@ +-- !!! Default decl for non-method +module M where +class C a where + x :: a + y = error "foo" diff --git a/testsuite/tests/module/mod49.stderr b/testsuite/tests/module/mod49.stderr new file mode 100644 index 0000000000..f08b36e0c4 --- /dev/null +++ b/testsuite/tests/module/mod49.stderr @@ -0,0 +1,2 @@ + +mod49.hs:5:3: `y' is not a (visible) method of class `C' diff --git a/testsuite/tests/module/mod49.stderr-hugs b/testsuite/tests/module/mod49.stderr-hugs new file mode 100644 index 0000000000..873cf50f82 --- /dev/null +++ b/testsuite/tests/module/mod49.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod49.hs":5 - No member "y" in class "C" diff --git a/testsuite/tests/module/mod5.hs b/testsuite/tests/module/mod5.hs new file mode 100644 index 0000000000..5b059ecc1a --- /dev/null +++ b/testsuite/tests/module/mod5.hs @@ -0,0 +1,3 @@ +-- !!! Duplicate export of constructor +module M(T(K1,K1)) where +data T = K1 diff --git a/testsuite/tests/module/mod5.stderr-ghc b/testsuite/tests/module/mod5.stderr-ghc new file mode 100644 index 0000000000..7992560ca3 --- /dev/null +++ b/testsuite/tests/module/mod5.stderr-ghc @@ -0,0 +1,3 @@ + +mod5.hs:2:10: + Warning: `K1' is exported by `T(K1, K1)' and `T(K1, K1)' diff --git a/testsuite/tests/module/mod50.hs b/testsuite/tests/module/mod50.hs new file mode 100644 index 0000000000..5f26b8d487 --- /dev/null +++ b/testsuite/tests/module/mod50.hs @@ -0,0 +1,3 @@ +-- !!! Default decl for non-method +module M where +data T = C deriving (Foo)
\ No newline at end of file diff --git a/testsuite/tests/module/mod50.stderr b/testsuite/tests/module/mod50.stderr new file mode 100644 index 0000000000..9357f7a2d8 --- /dev/null +++ b/testsuite/tests/module/mod50.stderr @@ -0,0 +1,2 @@ + +mod50.hs:3:22: Not in scope: type constructor or class `Foo' diff --git a/testsuite/tests/module/mod50.stderr-hugs b/testsuite/tests/module/mod50.stderr-hugs new file mode 100644 index 0000000000..b3ca66839e --- /dev/null +++ b/testsuite/tests/module/mod50.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod50.hs":3 - Unknown class "Foo" in derived instance diff --git a/testsuite/tests/module/mod51.hs b/testsuite/tests/module/mod51.hs new file mode 100644 index 0000000000..c3069a6c3e --- /dev/null +++ b/testsuite/tests/module/mod51.hs @@ -0,0 +1,3 @@ +-- !!! Duplicate derived instance +module M where +data T = C deriving (Eq,Eq)
\ No newline at end of file diff --git a/testsuite/tests/module/mod51.stderr b/testsuite/tests/module/mod51.stderr new file mode 100644 index 0000000000..db74d7a5df --- /dev/null +++ b/testsuite/tests/module/mod51.stderr @@ -0,0 +1,5 @@ + +mod51.hs:3:25: + Duplicate instance declarations: + instance Eq T -- Defined at mod51.hs:3:25-26 + instance Eq T -- Defined at mod51.hs:3:22-23 diff --git a/testsuite/tests/module/mod51.stderr-hugs b/testsuite/tests/module/mod51.stderr-hugs new file mode 100644 index 0000000000..54d5198bea --- /dev/null +++ b/testsuite/tests/module/mod51.stderr-hugs @@ -0,0 +1,4 @@ +ERROR "mod51.hs":3 - Overlapping instances for class "Eq" +*** This instance : Eq T +*** Overlaps with : Eq T +*** Common instance : Eq T diff --git a/testsuite/tests/module/mod52.hs b/testsuite/tests/module/mod52.hs new file mode 100644 index 0000000000..c907afe215 --- /dev/null +++ b/testsuite/tests/module/mod52.hs @@ -0,0 +1,4 @@ +-- !!! Duplicate derived instance +module M where +data T = C deriving (Eq) +instance Eq T
\ No newline at end of file diff --git a/testsuite/tests/module/mod52.stderr b/testsuite/tests/module/mod52.stderr new file mode 100644 index 0000000000..23818e8bf3 --- /dev/null +++ b/testsuite/tests/module/mod52.stderr @@ -0,0 +1,5 @@ + +mod52.hs:3:22: + Duplicate instance declarations: + instance Eq T -- Defined at mod52.hs:3:22-23 + instance Eq T -- Defined at mod52.hs:4:10-13 diff --git a/testsuite/tests/module/mod52.stderr-hugs b/testsuite/tests/module/mod52.stderr-hugs new file mode 100644 index 0000000000..634069431f --- /dev/null +++ b/testsuite/tests/module/mod52.stderr-hugs @@ -0,0 +1,4 @@ +ERROR "mod52.hs":3 - Overlapping instances for class "Eq" +*** This instance : Eq T +*** Overlaps with : Eq T +*** Common instance : Eq T diff --git a/testsuite/tests/module/mod53.hs b/testsuite/tests/module/mod53.hs new file mode 100644 index 0000000000..c7291e43a7 --- /dev/null +++ b/testsuite/tests/module/mod53.hs @@ -0,0 +1,4 @@ +-- !!! Duplicate derived instance +module M where +class C a +data T = K deriving (C) diff --git a/testsuite/tests/module/mod53.stderr b/testsuite/tests/module/mod53.stderr new file mode 100644 index 0000000000..b8b44a471e --- /dev/null +++ b/testsuite/tests/module/mod53.stderr @@ -0,0 +1,5 @@ +
+mod53.hs:4:22:
+ Can't make a derived instance of `C T':
+ `C' is not a derivable class
+ In the data type declaration for `T'
diff --git a/testsuite/tests/module/mod53.stderr-hugs b/testsuite/tests/module/mod53.stderr-hugs new file mode 100644 index 0000000000..92b3f424c2 --- /dev/null +++ b/testsuite/tests/module/mod53.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod53.hs":4 - Cannot derive instances of class "C" diff --git a/testsuite/tests/module/mod54.hs b/testsuite/tests/module/mod54.hs new file mode 100644 index 0000000000..0814a5e57b --- /dev/null +++ b/testsuite/tests/module/mod54.hs @@ -0,0 +1,3 @@ +-- !!! Duplicate derived instance +module M where +data T = K deriving (Ord) diff --git a/testsuite/tests/module/mod54.stderr b/testsuite/tests/module/mod54.stderr new file mode 100644 index 0000000000..8b41e7f8bc --- /dev/null +++ b/testsuite/tests/module/mod54.stderr @@ -0,0 +1,9 @@ + +mod54.hs:3:22: + No instance for (Eq T) + arising from the 'deriving' clause of a data type declaration + Possible fix: + add an instance declaration for (Eq T) + or use a standalone 'deriving instance' declaration, + so you can specify the instance context yourself + When deriving the instance for (Ord T) diff --git a/testsuite/tests/module/mod54.stderr-hugs b/testsuite/tests/module/mod54.stderr-hugs new file mode 100644 index 0000000000..ff65e5ce96 --- /dev/null +++ b/testsuite/tests/module/mod54.stderr-hugs @@ -0,0 +1,4 @@ +ERROR "mod54.hs":3 - Cannot build superclass instance +*** Instance : Ord T +*** Context supplied : () +*** Required superclass : Eq T diff --git a/testsuite/tests/module/mod55.hs b/testsuite/tests/module/mod55.hs new file mode 100644 index 0000000000..55cfab7d60 --- /dev/null +++ b/testsuite/tests/module/mod55.hs @@ -0,0 +1,3 @@ +-- !!! Illegal deriving Enum +module M where +data T = K Int deriving (Enum) diff --git a/testsuite/tests/module/mod55.stderr b/testsuite/tests/module/mod55.stderr new file mode 100644 index 0000000000..7787ea3b2f --- /dev/null +++ b/testsuite/tests/module/mod55.stderr @@ -0,0 +1,6 @@ + +mod55.hs:3:26: + Can't make a derived instance of `Enum T': + `T' must be an enumeration type + (an enumeration consists of one or more nullary, non-GADT constructors) + In the data type declaration for `T' diff --git a/testsuite/tests/module/mod55.stderr-hugs b/testsuite/tests/module/mod55.stderr-hugs new file mode 100644 index 0000000000..1c0b452698 --- /dev/null +++ b/testsuite/tests/module/mod55.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod55.hs":3 - Can only derive instances of Enum for enumeration types diff --git a/testsuite/tests/module/mod56.hs b/testsuite/tests/module/mod56.hs new file mode 100644 index 0000000000..2fb79baaa6 --- /dev/null +++ b/testsuite/tests/module/mod56.hs @@ -0,0 +1,4 @@ +-- !!! Illegal deriving Ix +module M where +import Data.Ix(Ix) +data T = K1 Int | K2 deriving (Eq,Ord,Ix) diff --git a/testsuite/tests/module/mod56.stderr b/testsuite/tests/module/mod56.stderr new file mode 100644 index 0000000000..3dca4e2e10 --- /dev/null +++ b/testsuite/tests/module/mod56.stderr @@ -0,0 +1,8 @@ + +mod56.hs:4:39: + Can't make a derived instance of `Ix T': + `T' must be an enumeration type + (an enumeration consists of one or more nullary, non-GADT constructors) + or + `T' must have precisely one constructor + In the data type declaration for `T' diff --git a/testsuite/tests/module/mod56.stderr-hugs b/testsuite/tests/module/mod56.stderr-hugs new file mode 100644 index 0000000000..74e44165a4 --- /dev/null +++ b/testsuite/tests/module/mod56.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod56.hs":4 - Can only derive instances of Ix for enumeration or product types diff --git a/testsuite/tests/module/mod58.hs b/testsuite/tests/module/mod58.hs new file mode 100644 index 0000000000..4ab2f71737 --- /dev/null +++ b/testsuite/tests/module/mod58.hs @@ -0,0 +1,4 @@ +-- !!! Multiple (identical) default decls +module M where +default (Int,Integer) +default (Int,Integer) diff --git a/testsuite/tests/module/mod58.stderr b/testsuite/tests/module/mod58.stderr new file mode 100644 index 0000000000..d92345a8af --- /dev/null +++ b/testsuite/tests/module/mod58.stderr @@ -0,0 +1,4 @@ + +mod58.hs:4:1: + Multiple default declarations + here was another default declaration mod58.hs:3:1-21 diff --git a/testsuite/tests/module/mod58.stderr-hugs b/testsuite/tests/module/mod58.stderr-hugs new file mode 100644 index 0000000000..7dd4839a26 --- /dev/null +++ b/testsuite/tests/module/mod58.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod58.hs":4 - Multiple default declarations are not permitted in a single script file. diff --git a/testsuite/tests/module/mod59.hs b/testsuite/tests/module/mod59.hs new file mode 100644 index 0000000000..ecb026e894 --- /dev/null +++ b/testsuite/tests/module/mod59.hs @@ -0,0 +1,3 @@ +-- !!! Malformed pattern (unknown constructor) +module M where +f K = error "foo"
\ No newline at end of file diff --git a/testsuite/tests/module/mod59.stderr b/testsuite/tests/module/mod59.stderr new file mode 100644 index 0000000000..c08db2a55f --- /dev/null +++ b/testsuite/tests/module/mod59.stderr @@ -0,0 +1,2 @@ + +mod59.hs:3:3: Not in scope: data constructor `K' diff --git a/testsuite/tests/module/mod59.stderr-hugs b/testsuite/tests/module/mod59.stderr-hugs new file mode 100644 index 0000000000..5a408f345b --- /dev/null +++ b/testsuite/tests/module/mod59.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod59.hs":3 - Undefined data constructor "K" diff --git a/testsuite/tests/module/mod6.hs b/testsuite/tests/module/mod6.hs new file mode 100644 index 0000000000..91a9a780cd --- /dev/null +++ b/testsuite/tests/module/mod6.hs @@ -0,0 +1,3 @@ +-- !!! Omitted constructor from export list +module M(T(K1)) where +data T = K1|K2 diff --git a/testsuite/tests/module/mod60.hs b/testsuite/tests/module/mod60.hs new file mode 100644 index 0000000000..61884850b3 --- /dev/null +++ b/testsuite/tests/module/mod60.hs @@ -0,0 +1,3 @@ +-- !!! Malformed pattern (arity) +module M where +f (Left) = error "foo"
\ No newline at end of file diff --git a/testsuite/tests/module/mod60.stderr b/testsuite/tests/module/mod60.stderr new file mode 100644 index 0000000000..f363cb933b --- /dev/null +++ b/testsuite/tests/module/mod60.stderr @@ -0,0 +1,5 @@ + +mod60.hs:3:4: + Constructor `Left' should have 1 argument, but has been given none + In the pattern: Left + In an equation for `f': f (Left) = error "foo" diff --git a/testsuite/tests/module/mod60.stderr-hugs b/testsuite/tests/module/mod60.stderr-hugs new file mode 100644 index 0000000000..17e7120319 --- /dev/null +++ b/testsuite/tests/module/mod60.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod60.hs":3 - Constructor "Left" must have exactly 1 argument in pattern diff --git a/testsuite/tests/module/mod61.hs b/testsuite/tests/module/mod61.hs new file mode 100644 index 0000000000..62fdef2dd3 --- /dev/null +++ b/testsuite/tests/module/mod61.hs @@ -0,0 +1,3 @@ +-- !!! Malformed infix expression +module M where +f a b c = a==b==c
\ No newline at end of file diff --git a/testsuite/tests/module/mod61.stderr b/testsuite/tests/module/mod61.stderr new file mode 100644 index 0000000000..3ac4937437 --- /dev/null +++ b/testsuite/tests/module/mod61.stderr @@ -0,0 +1,4 @@ + +mod61.hs:3:11: + Precedence parsing error + cannot mix `==' [infix 4] and `==' [infix 4] in the same infix expression diff --git a/testsuite/tests/module/mod61.stderr-hugs b/testsuite/tests/module/mod61.stderr-hugs new file mode 100644 index 0000000000..32c0138b81 --- /dev/null +++ b/testsuite/tests/module/mod61.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod61.hs":3 - Ambiguous use of operator "(==)" with "(==)" diff --git a/testsuite/tests/module/mod62.hs b/testsuite/tests/module/mod62.hs new file mode 100644 index 0000000000..b1140fdd6b --- /dev/null +++ b/testsuite/tests/module/mod62.hs @@ -0,0 +1,3 @@ +-- !!! Malformed binding (qualified) +module M where +x = let M.y = 'a' in M.y diff --git a/testsuite/tests/module/mod62.stderr b/testsuite/tests/module/mod62.stderr new file mode 100644 index 0000000000..d435dbd6b9 --- /dev/null +++ b/testsuite/tests/module/mod62.stderr @@ -0,0 +1,6 @@ + +mod62.hs:3:9: Qualified name in binding position: M.y + +mod62.hs:3:22: + Not in scope: `M.y' + Perhaps you meant `M.x' (line 3) diff --git a/testsuite/tests/module/mod62.stderr-hugs b/testsuite/tests/module/mod62.stderr-hugs new file mode 100644 index 0000000000..1c50fab13a --- /dev/null +++ b/testsuite/tests/module/mod62.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod62.hs":3 - Syntax error in expression (unexpected symbol "M.y") diff --git a/testsuite/tests/module/mod63.hs b/testsuite/tests/module/mod63.hs new file mode 100644 index 0000000000..70da4c30c2 --- /dev/null +++ b/testsuite/tests/module/mod63.hs @@ -0,0 +1,4 @@ +-- !!! Bindings of different arities +module M where +f 0 = id +f x y = x+y diff --git a/testsuite/tests/module/mod63.stderr b/testsuite/tests/module/mod63.stderr new file mode 100644 index 0000000000..a4745b2e49 --- /dev/null +++ b/testsuite/tests/module/mod63.stderr @@ -0,0 +1,5 @@ + +mod63.hs:3:1: + Equations for `f' have different numbers of arguments + mod63.hs:3:1-8 + mod63.hs:4:1-11 diff --git a/testsuite/tests/module/mod63.stderr-hugs b/testsuite/tests/module/mod63.stderr-hugs new file mode 100644 index 0000000000..a2f6d6a677 --- /dev/null +++ b/testsuite/tests/module/mod63.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod63.hs":3 - Equations give different arities for "f" diff --git a/testsuite/tests/module/mod64.hs b/testsuite/tests/module/mod64.hs new file mode 100644 index 0000000000..9a9c6aef78 --- /dev/null +++ b/testsuite/tests/module/mod64.hs @@ -0,0 +1,3 @@ +-- !!! Pattern binding must bind (not an error in standard Haskell) +module M where +x = let ['a'] = "a" in 'a' diff --git a/testsuite/tests/module/mod64.stderr b/testsuite/tests/module/mod64.stderr new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuite/tests/module/mod64.stderr diff --git a/testsuite/tests/module/mod65.hs b/testsuite/tests/module/mod65.hs new file mode 100644 index 0000000000..96866b9666 --- /dev/null +++ b/testsuite/tests/module/mod65.hs @@ -0,0 +1,3 @@ +-- !!! Malformed lhs (pointless but legal in Haskell 1.3, rejected by Hugs) +module M where +x = let [] = "a" in 'a' diff --git a/testsuite/tests/module/mod65.stderr b/testsuite/tests/module/mod65.stderr new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuite/tests/module/mod65.stderr diff --git a/testsuite/tests/module/mod66.hs b/testsuite/tests/module/mod66.hs new file mode 100644 index 0000000000..d162ae09d5 --- /dev/null +++ b/testsuite/tests/module/mod66.hs @@ -0,0 +1,5 @@ +-- !!! Multiple value bindings +module M where +f x = 'a' +g x = 'b' +f x = 'c'
\ No newline at end of file diff --git a/testsuite/tests/module/mod66.stderr b/testsuite/tests/module/mod66.stderr new file mode 100644 index 0000000000..7949ae3ec0 --- /dev/null +++ b/testsuite/tests/module/mod66.stderr @@ -0,0 +1,5 @@ + +mod66.hs:5:1: + Multiple declarations of `M.f' + Declared at: mod66.hs:3:1 + mod66.hs:5:1 diff --git a/testsuite/tests/module/mod66.stderr-hugs b/testsuite/tests/module/mod66.stderr-hugs new file mode 100644 index 0000000000..2f954b8337 --- /dev/null +++ b/testsuite/tests/module/mod66.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod66.hs":3 - "f" multiply defined diff --git a/testsuite/tests/module/mod67.hs b/testsuite/tests/module/mod67.hs new file mode 100644 index 0000000000..addfbfb946 --- /dev/null +++ b/testsuite/tests/module/mod67.hs @@ -0,0 +1,3 @@ +-- !!! Type decl but no body +module M where +f :: Int -> Bool
\ No newline at end of file diff --git a/testsuite/tests/module/mod67.stderr b/testsuite/tests/module/mod67.stderr new file mode 100644 index 0000000000..2c2323b83f --- /dev/null +++ b/testsuite/tests/module/mod67.stderr @@ -0,0 +1,3 @@ + +mod67.hs:3:1: + The type signature for `f' lacks an accompanying binding diff --git a/testsuite/tests/module/mod67.stderr-hugs b/testsuite/tests/module/mod67.stderr-hugs new file mode 100644 index 0000000000..395507373d --- /dev/null +++ b/testsuite/tests/module/mod67.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod67.hs":3 - Missing binding for variable "f" in type signature diff --git a/testsuite/tests/module/mod68.hs b/testsuite/tests/module/mod68.hs new file mode 100644 index 0000000000..fd10684e2c --- /dev/null +++ b/testsuite/tests/module/mod68.hs @@ -0,0 +1,5 @@ +-- !!! Multiple type decls +module M where +f :: Int -> Bool +f :: Int -> Bool +f = even
\ No newline at end of file diff --git a/testsuite/tests/module/mod68.stderr b/testsuite/tests/module/mod68.stderr new file mode 100644 index 0000000000..2d5ece6f47 --- /dev/null +++ b/testsuite/tests/module/mod68.stderr @@ -0,0 +1,5 @@ + +mod68.hs:4:1: + Duplicate type signature: + mod68.hs:4:1-16: f :: Int -> Bool + mod68.hs:3:1-16: f :: Int -> Bool diff --git a/testsuite/tests/module/mod68.stderr-hugs b/testsuite/tests/module/mod68.stderr-hugs new file mode 100644 index 0000000000..362c681500 --- /dev/null +++ b/testsuite/tests/module/mod68.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod68.hs":4 - Multiple type signatures for "f" diff --git a/testsuite/tests/module/mod69.hs b/testsuite/tests/module/mod69.hs new file mode 100644 index 0000000000..8360274d21 --- /dev/null +++ b/testsuite/tests/module/mod69.hs @@ -0,0 +1,3 @@ +-- !!! Illegal @ in expression +module M where +f x = x@1 diff --git a/testsuite/tests/module/mod69.stderr b/testsuite/tests/module/mod69.stderr new file mode 100644 index 0000000000..d7f92be69a --- /dev/null +++ b/testsuite/tests/module/mod69.stderr @@ -0,0 +1,2 @@ + +mod69.hs:3:7: Pattern syntax in expression context: x@1 diff --git a/testsuite/tests/module/mod69.stderr-hugs b/testsuite/tests/module/mod69.stderr-hugs new file mode 100644 index 0000000000..36c2ef4df3 --- /dev/null +++ b/testsuite/tests/module/mod69.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod69.hs":3 - Illegal `@' in expression diff --git a/testsuite/tests/module/mod7.hs b/testsuite/tests/module/mod7.hs new file mode 100644 index 0000000000..68aacee63b --- /dev/null +++ b/testsuite/tests/module/mod7.hs @@ -0,0 +1,3 @@ +-- !!! Exporting non-existent type/class +module M(T) where +x = 'a' -- dummy definition to get round a separate bug diff --git a/testsuite/tests/module/mod7.stderr b/testsuite/tests/module/mod7.stderr new file mode 100644 index 0000000000..f9119cd786 --- /dev/null +++ b/testsuite/tests/module/mod7.stderr @@ -0,0 +1,2 @@ + +mod7.hs:2:10: Not in scope: type constructor or class `T' diff --git a/testsuite/tests/module/mod7.stderr-hugs b/testsuite/tests/module/mod7.stderr-hugs new file mode 100644 index 0000000000..a8bf4f0904 --- /dev/null +++ b/testsuite/tests/module/mod7.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod7.hs" - Unknown entity "T" exported from module "M" diff --git a/testsuite/tests/module/mod70.hs b/testsuite/tests/module/mod70.hs new file mode 100644 index 0000000000..cb7d51fe3b --- /dev/null +++ b/testsuite/tests/module/mod70.hs @@ -0,0 +1,3 @@ +-- !!! Illegal ~ in expression +module M where +f x = x~1 diff --git a/testsuite/tests/module/mod70.stderr b/testsuite/tests/module/mod70.stderr new file mode 100644 index 0000000000..110ff24afe --- /dev/null +++ b/testsuite/tests/module/mod70.stderr @@ -0,0 +1,2 @@ + +mod70.hs:3:8: Pattern syntax in expression context: ~1 diff --git a/testsuite/tests/module/mod70.stderr-hugs b/testsuite/tests/module/mod70.stderr-hugs new file mode 100644 index 0000000000..661f02ff6f --- /dev/null +++ b/testsuite/tests/module/mod70.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod70.hs":3 - Illegal `~' in expression diff --git a/testsuite/tests/module/mod71.hs b/testsuite/tests/module/mod71.hs new file mode 100644 index 0000000000..49cc66d4b1 --- /dev/null +++ b/testsuite/tests/module/mod71.hs @@ -0,0 +1,3 @@ +-- !!! Illegal _ in expression +module M where +f x = x _ 1 diff --git a/testsuite/tests/module/mod71.stderr b/testsuite/tests/module/mod71.stderr new file mode 100644 index 0000000000..956f05e8d5 --- /dev/null +++ b/testsuite/tests/module/mod71.stderr @@ -0,0 +1,2 @@ + +mod71.hs:3:9: Pattern syntax in expression context: _ diff --git a/testsuite/tests/module/mod71.stderr-hugs b/testsuite/tests/module/mod71.stderr-hugs new file mode 100644 index 0000000000..ebb60587c4 --- /dev/null +++ b/testsuite/tests/module/mod71.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod71.hs":3 - Illegal `_' in expression diff --git a/testsuite/tests/module/mod72.hs b/testsuite/tests/module/mod72.hs new file mode 100644 index 0000000000..355d235c1e --- /dev/null +++ b/testsuite/tests/module/mod72.hs @@ -0,0 +1,3 @@ +-- !!! Undefined variable in expression +module M where +f x = g x diff --git a/testsuite/tests/module/mod72.stderr b/testsuite/tests/module/mod72.stderr new file mode 100644 index 0000000000..7f047d8023 --- /dev/null +++ b/testsuite/tests/module/mod72.stderr @@ -0,0 +1,2 @@ + +mod72.hs:3:7: Not in scope: `g' diff --git a/testsuite/tests/module/mod72.stderr-hugs b/testsuite/tests/module/mod72.stderr-hugs new file mode 100644 index 0000000000..f801cf0fd5 --- /dev/null +++ b/testsuite/tests/module/mod72.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod72.hs":3 - Undefined variable "g" diff --git a/testsuite/tests/module/mod73.hs b/testsuite/tests/module/mod73.hs new file mode 100644 index 0000000000..dd825d997a --- /dev/null +++ b/testsuite/tests/module/mod73.hs @@ -0,0 +1,3 @@ +-- !!! Undefined qualified variable in expression +module M where +f x = Prelude.g x diff --git a/testsuite/tests/module/mod73.stderr b/testsuite/tests/module/mod73.stderr new file mode 100644 index 0000000000..c99c7ef1cb --- /dev/null +++ b/testsuite/tests/module/mod73.stderr @@ -0,0 +1,7 @@ + +mod73.hs:3:7: + Not in scope: `Prelude.g' + Perhaps you meant one of these: + `Prelude.id' (imported from Prelude), + `Prelude.gcd' (imported from Prelude), + `Prelude.log' (imported from Prelude) diff --git a/testsuite/tests/module/mod73.stderr-hugs b/testsuite/tests/module/mod73.stderr-hugs new file mode 100644 index 0000000000..3afec93055 --- /dev/null +++ b/testsuite/tests/module/mod73.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod73.hs":3 - Undefined qualified variable "Prelude.g" diff --git a/testsuite/tests/module/mod74.hs b/testsuite/tests/module/mod74.hs new file mode 100644 index 0000000000..af580a130b --- /dev/null +++ b/testsuite/tests/module/mod74.hs @@ -0,0 +1,3 @@ +-- !!! Undefined qualifier in expression +module M where +f x = N.g x diff --git a/testsuite/tests/module/mod74.stderr b/testsuite/tests/module/mod74.stderr new file mode 100644 index 0000000000..b4d417bac2 --- /dev/null +++ b/testsuite/tests/module/mod74.stderr @@ -0,0 +1,2 @@ + +mod74.hs:3:7: Not in scope: `N.g' diff --git a/testsuite/tests/module/mod74.stderr-hugs b/testsuite/tests/module/mod74.stderr-hugs new file mode 100644 index 0000000000..55feed3698 --- /dev/null +++ b/testsuite/tests/module/mod74.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod74.hs":3 - Undefined qualified variable "N.g" diff --git a/testsuite/tests/module/mod75.hs b/testsuite/tests/module/mod75.hs new file mode 100644 index 0000000000..4428de8237 --- /dev/null +++ b/testsuite/tests/module/mod75.hs @@ -0,0 +1,3 @@ +-- !!! Qualifying with local module name +module M where +f x = M.f x diff --git a/testsuite/tests/module/mod76.hs b/testsuite/tests/module/mod76.hs new file mode 100644 index 0000000000..ccf4efa0ff --- /dev/null +++ b/testsuite/tests/module/mod76.hs @@ -0,0 +1,7 @@ +-- !!! Multiple modules per file +module M where +foo = 'a' + +module N where +bar = 'b' + diff --git a/testsuite/tests/module/mod76.stderr b/testsuite/tests/module/mod76.stderr new file mode 100644 index 0000000000..cf7a94495c --- /dev/null +++ b/testsuite/tests/module/mod76.stderr @@ -0,0 +1,2 @@ + +mod76.hs:5:1: parse error on input `module' diff --git a/testsuite/tests/module/mod76.stderr-hugs b/testsuite/tests/module/mod76.stderr-hugs new file mode 100644 index 0000000000..a9f2f9ed4f --- /dev/null +++ b/testsuite/tests/module/mod76.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod76.hs":5 - Syntax error in input (unexpected keyword "module") diff --git a/testsuite/tests/module/mod77.hs b/testsuite/tests/module/mod77.hs new file mode 100644 index 0000000000..ea5f89d53e --- /dev/null +++ b/testsuite/tests/module/mod77.hs @@ -0,0 +1,4 @@ +-- !!! Naked fixity declaration +module M where +infix $$$ +x = 'a' diff --git a/testsuite/tests/module/mod77.stderr b/testsuite/tests/module/mod77.stderr new file mode 100644 index 0000000000..0cb4920e31 --- /dev/null +++ b/testsuite/tests/module/mod77.stderr @@ -0,0 +1,3 @@ + +mod77.hs:3:7: + The fixity signature for `$$$' lacks an accompanying binding diff --git a/testsuite/tests/module/mod77.stderr-hugs b/testsuite/tests/module/mod77.stderr-hugs new file mode 100644 index 0000000000..49dc7008bd --- /dev/null +++ b/testsuite/tests/module/mod77.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod77.hs":3 - Cannot find binding for operator "$$$" in fixity declaration diff --git a/testsuite/tests/module/mod79.hs b/testsuite/tests/module/mod79.hs new file mode 100644 index 0000000000..ae46dd88cd --- /dev/null +++ b/testsuite/tests/module/mod79.hs @@ -0,0 +1,4 @@ +-- !!! Importing unknown class/tycon +module M where +import Prelude(C) + diff --git a/testsuite/tests/module/mod79.stderr b/testsuite/tests/module/mod79.stderr new file mode 100644 index 0000000000..f8a185725e --- /dev/null +++ b/testsuite/tests/module/mod79.stderr @@ -0,0 +1,2 @@ + +mod79.hs:3:16: Module `Prelude' does not export `C' diff --git a/testsuite/tests/module/mod79.stderr-hugs b/testsuite/tests/module/mod79.stderr-hugs new file mode 100644 index 0000000000..43c079b009 --- /dev/null +++ b/testsuite/tests/module/mod79.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod79.hs" - Unknown entity "C" imported from module "Prelude" diff --git a/testsuite/tests/module/mod8.hs b/testsuite/tests/module/mod8.hs new file mode 100644 index 0000000000..8d7c3e003e --- /dev/null +++ b/testsuite/tests/module/mod8.hs @@ -0,0 +1,3 @@ +-- !!! Exporting non-existent module +module M(module N) where +x = 'a' -- dummy definition to get round a separate bug diff --git a/testsuite/tests/module/mod8.stderr b/testsuite/tests/module/mod8.stderr new file mode 100644 index 0000000000..cba84c8502 --- /dev/null +++ b/testsuite/tests/module/mod8.stderr @@ -0,0 +1,2 @@ + +mod8.hs:2:10: The export item `module N' is not imported diff --git a/testsuite/tests/module/mod8.stderr-hugs b/testsuite/tests/module/mod8.stderr-hugs new file mode 100644 index 0000000000..4ac6093dd1 --- /dev/null +++ b/testsuite/tests/module/mod8.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod8.hs" - Unknown module "N" exported from module "M" diff --git a/testsuite/tests/module/mod80.hs b/testsuite/tests/module/mod80.hs new file mode 100644 index 0000000000..4ab1539054 --- /dev/null +++ b/testsuite/tests/module/mod80.hs @@ -0,0 +1,4 @@ +-- !!! Importing unknown name +module M where +import Prelude(f) + diff --git a/testsuite/tests/module/mod80.stderr b/testsuite/tests/module/mod80.stderr new file mode 100644 index 0000000000..c56caf0ae6 --- /dev/null +++ b/testsuite/tests/module/mod80.stderr @@ -0,0 +1,2 @@ + +mod80.hs:3:16: Module `Prelude' does not export `f' diff --git a/testsuite/tests/module/mod80.stderr-hugs b/testsuite/tests/module/mod80.stderr-hugs new file mode 100644 index 0000000000..cea1259f7f --- /dev/null +++ b/testsuite/tests/module/mod80.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod80.hs" - Unknown entity "f" imported from module "Prelude" diff --git a/testsuite/tests/module/mod81.hs b/testsuite/tests/module/mod81.hs new file mode 100644 index 0000000000..ef1c8639fd --- /dev/null +++ b/testsuite/tests/module/mod81.hs @@ -0,0 +1,4 @@ +-- !!! Importing Tycon with bogus constructor +module M where +import Prelude(Either(Left,Right,Foo)) + diff --git a/testsuite/tests/module/mod81.stderr b/testsuite/tests/module/mod81.stderr new file mode 100644 index 0000000000..d3f0d5c427 --- /dev/null +++ b/testsuite/tests/module/mod81.stderr @@ -0,0 +1,3 @@ + +mod81.hs:3:16: + Module `Prelude' does not export `Either(Left, Right, Foo)' diff --git a/testsuite/tests/module/mod81.stderr-hugs b/testsuite/tests/module/mod81.stderr-hugs new file mode 100644 index 0000000000..1204130fb9 --- /dev/null +++ b/testsuite/tests/module/mod81.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod81.hs" - Entity "Foo" is not a constructor of type "Either" diff --git a/testsuite/tests/module/mod82.hs b/testsuite/tests/module/mod82.hs new file mode 100644 index 0000000000..62c630ac24 --- /dev/null +++ b/testsuite/tests/module/mod82.hs @@ -0,0 +1,4 @@ +-- !!! Importing Tycon with missing constructor +module M where +import Prelude(Either(Left)) + diff --git a/testsuite/tests/module/mod83.hs b/testsuite/tests/module/mod83.hs new file mode 100644 index 0000000000..efce6dd02f --- /dev/null +++ b/testsuite/tests/module/mod83.hs @@ -0,0 +1,4 @@ +-- !!! Importing Tycon with duplicate constructor +module M where +import Prelude(Either(Left,Right,Right)) + diff --git a/testsuite/tests/module/mod84.hs b/testsuite/tests/module/mod84.hs new file mode 100644 index 0000000000..737cf7b14f --- /dev/null +++ b/testsuite/tests/module/mod84.hs @@ -0,0 +1,4 @@ +-- !!! Correct tycon import (explicit constructor list) +module M where +import Prelude(Either(Left,Right)) +x = (Left 'a', Right 'a') diff --git a/testsuite/tests/module/mod85.hs b/testsuite/tests/module/mod85.hs new file mode 100644 index 0000000000..f9322f7517 --- /dev/null +++ b/testsuite/tests/module/mod85.hs @@ -0,0 +1,5 @@ +-- !!! Correct tycon import (implicit constructor list) +module M where +import Prelude(Either(..)) +x = (Left 'a', Right 'a') + diff --git a/testsuite/tests/module/mod86.hs b/testsuite/tests/module/mod86.hs new file mode 100644 index 0000000000..e143c44504 --- /dev/null +++ b/testsuite/tests/module/mod86.hs @@ -0,0 +1,4 @@ +-- !!! Correct abstract tycon import +module M where +import Prelude(Either) + diff --git a/testsuite/tests/module/mod87.hs b/testsuite/tests/module/mod87.hs new file mode 100644 index 0000000000..161ab3c031 --- /dev/null +++ b/testsuite/tests/module/mod87.hs @@ -0,0 +1,4 @@ +-- !!! Trying to use constructors of abstractly imported type. +module M where +import Prelude(Either) +x = Left 'a' diff --git a/testsuite/tests/module/mod87.stderr b/testsuite/tests/module/mod87.stderr new file mode 100644 index 0000000000..1536679aa6 --- /dev/null +++ b/testsuite/tests/module/mod87.stderr @@ -0,0 +1,2 @@ + +mod87.hs:4:5: Not in scope: data constructor `Left' diff --git a/testsuite/tests/module/mod87.stderr-hugs b/testsuite/tests/module/mod87.stderr-hugs new file mode 100644 index 0000000000..90399b0b20 --- /dev/null +++ b/testsuite/tests/module/mod87.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod87.hs":4 - Undefined data constructor "Left" diff --git a/testsuite/tests/module/mod88.hs b/testsuite/tests/module/mod88.hs new file mode 100644 index 0000000000..aacf912915 --- /dev/null +++ b/testsuite/tests/module/mod88.hs @@ -0,0 +1,5 @@ +-- !!! Honouring qualified imports lists +-- was: Known bug: Qualified import ignores import list +module M where +import qualified Prelude (map) +x = Prelude.Left 'a' diff --git a/testsuite/tests/module/mod88.stderr b/testsuite/tests/module/mod88.stderr new file mode 100644 index 0000000000..f166c864c7 --- /dev/null +++ b/testsuite/tests/module/mod88.stderr @@ -0,0 +1,2 @@ + +mod88.hs:5:5: Not in scope: data constructor `Prelude.Left' diff --git a/testsuite/tests/module/mod88.stderr-hugs b/testsuite/tests/module/mod88.stderr-hugs new file mode 100644 index 0000000000..23c3ba90cf --- /dev/null +++ b/testsuite/tests/module/mod88.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod88.hs":5 - Undefined data constructor "Prelude.Left" diff --git a/testsuite/tests/module/mod89.hs b/testsuite/tests/module/mod89.hs new file mode 100644 index 0000000000..2c48d65a16 --- /dev/null +++ b/testsuite/tests/module/mod89.hs @@ -0,0 +1,4 @@ +-- !!! Sublist for non-class/tycon +module M where +import Prelude(map(..)) + diff --git a/testsuite/tests/module/mod89.stderr b/testsuite/tests/module/mod89.stderr new file mode 100644 index 0000000000..ddf38b0d13 --- /dev/null +++ b/testsuite/tests/module/mod89.stderr @@ -0,0 +1,2 @@ + +mod89.hs:3:19: parse error on input `(' diff --git a/testsuite/tests/module/mod89.stderr-hugs b/testsuite/tests/module/mod89.stderr-hugs new file mode 100644 index 0000000000..5fcc8ae812 --- /dev/null +++ b/testsuite/tests/module/mod89.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod89.hs":3 - Syntax error in import declaration (unexpected `(') diff --git a/testsuite/tests/module/mod9.hs b/testsuite/tests/module/mod9.hs new file mode 100644 index 0000000000..a08690679b --- /dev/null +++ b/testsuite/tests/module/mod9.hs @@ -0,0 +1,3 @@ +-- !!! Exporting non-existent type transparently +module M(T(..)) where +x = 'a' -- dummy definition to get round a separate bug diff --git a/testsuite/tests/module/mod9.stderr b/testsuite/tests/module/mod9.stderr new file mode 100644 index 0000000000..19bec80bb2 --- /dev/null +++ b/testsuite/tests/module/mod9.stderr @@ -0,0 +1,2 @@ + +mod9.hs:2:10: Not in scope: type constructor or class `T' diff --git a/testsuite/tests/module/mod9.stderr-hugs b/testsuite/tests/module/mod9.stderr-hugs new file mode 100644 index 0000000000..cf018ce7c8 --- /dev/null +++ b/testsuite/tests/module/mod9.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod9.hs" - Explicit export list given for non-class/datatype "T" in export list of module "M" diff --git a/testsuite/tests/module/mod90.hs b/testsuite/tests/module/mod90.hs new file mode 100644 index 0000000000..7b44ff57e2 --- /dev/null +++ b/testsuite/tests/module/mod90.hs @@ -0,0 +1,4 @@ +-- !!! Sublist for non-class/tycon +module M where +import Prelude(Left(..)) + diff --git a/testsuite/tests/module/mod90.stderr b/testsuite/tests/module/mod90.stderr new file mode 100644 index 0000000000..a5c03e0b9a --- /dev/null +++ b/testsuite/tests/module/mod90.stderr @@ -0,0 +1,8 @@ + +mod90.hs:3:16: + In module `Prelude': + `Left' is a data constructor of `Either' + To import it use + `import Prelude (Either (Left))' + or + `import Prelude (Either (..))' diff --git a/testsuite/tests/module/mod90.stderr-hugs b/testsuite/tests/module/mod90.stderr-hugs new file mode 100644 index 0000000000..b157660b31 --- /dev/null +++ b/testsuite/tests/module/mod90.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod90.hs" - Unknown entity "Left" imported from module "Prelude" diff --git a/testsuite/tests/module/mod91.hs b/testsuite/tests/module/mod91.hs new file mode 100644 index 0000000000..8a7387e8ad --- /dev/null +++ b/testsuite/tests/module/mod91.hs @@ -0,0 +1,4 @@ +-- !!! Importing Class with bogus member +module M where +import Prelude(Eq((==),(/=),eq)) + diff --git a/testsuite/tests/module/mod91.stderr b/testsuite/tests/module/mod91.stderr new file mode 100644 index 0000000000..5d7d6e1df6 --- /dev/null +++ b/testsuite/tests/module/mod91.stderr @@ -0,0 +1,3 @@ + +mod91.hs:3:16: + Module `Prelude' does not export `Eq((==), (/=), eq)' diff --git a/testsuite/tests/module/mod91.stderr-hugs b/testsuite/tests/module/mod91.stderr-hugs new file mode 100644 index 0000000000..a5de80fc6c --- /dev/null +++ b/testsuite/tests/module/mod91.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod91.hs" - Entity "eq" is not a member of class "Eq" diff --git a/testsuite/tests/module/mod92.hs b/testsuite/tests/module/mod92.hs new file mode 100644 index 0000000000..e9045b9335 --- /dev/null +++ b/testsuite/tests/module/mod92.hs @@ -0,0 +1,4 @@ +-- !!! Importing Class with missing member +module M where +import Prelude(Eq((==))) + diff --git a/testsuite/tests/module/mod93.hs b/testsuite/tests/module/mod93.hs new file mode 100644 index 0000000000..9dbd82cc9d --- /dev/null +++ b/testsuite/tests/module/mod93.hs @@ -0,0 +1,4 @@ +-- !!! Importing Class with duplicate member +module M where +import Prelude(Eq((==),(/=),(==))) + diff --git a/testsuite/tests/module/mod94.hs b/testsuite/tests/module/mod94.hs new file mode 100644 index 0000000000..d485705132 --- /dev/null +++ b/testsuite/tests/module/mod94.hs @@ -0,0 +1,5 @@ +-- !!! Correct Class import (explicit member list) +module M where +import Prelude(Eq((==),(/=))) +x = 'a' == 'b' +y = 'a' /= 'b' diff --git a/testsuite/tests/module/mod95.hs b/testsuite/tests/module/mod95.hs new file mode 100644 index 0000000000..b1969b58a2 --- /dev/null +++ b/testsuite/tests/module/mod95.hs @@ -0,0 +1,5 @@ +-- !!! Correct Class import (explicit member list) +module M where +import Prelude(Eq(..)) +x = 'a' == 'b' +y = 'a' /= 'b' diff --git a/testsuite/tests/module/mod96.hs b/testsuite/tests/module/mod96.hs new file mode 100644 index 0000000000..2f20be02b8 --- /dev/null +++ b/testsuite/tests/module/mod96.hs @@ -0,0 +1,4 @@ +-- !!! Correct abstract class import +module M where +import Prelude(Eq) + diff --git a/testsuite/tests/module/mod97.hs b/testsuite/tests/module/mod97.hs new file mode 100644 index 0000000000..ee51c8b9fb --- /dev/null +++ b/testsuite/tests/module/mod97.hs @@ -0,0 +1,4 @@ +-- !!! Trying to use members of abstractly imported class +module M where +import Prelude(Eq) +x = 'a' == 'b' diff --git a/testsuite/tests/module/mod97.stderr b/testsuite/tests/module/mod97.stderr new file mode 100644 index 0000000000..fea2306c19 --- /dev/null +++ b/testsuite/tests/module/mod97.stderr @@ -0,0 +1,2 @@ + +mod97.hs:4:9: Not in scope: `==' diff --git a/testsuite/tests/module/mod97.stderr-hugs b/testsuite/tests/module/mod97.stderr-hugs new file mode 100644 index 0000000000..7763ec3677 --- /dev/null +++ b/testsuite/tests/module/mod97.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod97.hs":4 - Undefined variable "==" diff --git a/testsuite/tests/module/mod98.hs b/testsuite/tests/module/mod98.hs new file mode 100644 index 0000000000..e0dc3c32c2 --- /dev/null +++ b/testsuite/tests/module/mod98.hs @@ -0,0 +1,4 @@ +-- !!! Type signature for qualified name +module M where +M.x :: Char +x = 'a' diff --git a/testsuite/tests/module/mod98.stderr b/testsuite/tests/module/mod98.stderr new file mode 100644 index 0000000000..0a6a23d124 --- /dev/null +++ b/testsuite/tests/module/mod98.stderr @@ -0,0 +1,4 @@ + +mod98.hs:3:1: + Invalid type signature: M.x :: Char + Should be of form <variable> :: <type> diff --git a/testsuite/tests/module/mod98.stderr-hugs b/testsuite/tests/module/mod98.stderr-hugs new file mode 100644 index 0000000000..7f01f8b636 --- /dev/null +++ b/testsuite/tests/module/mod98.stderr-hugs @@ -0,0 +1 @@ +ERROR "mod98.hs":3 - Syntax error in input (unexpected symbol "M.x") diff --git a/testsuite/tests/module/mod99.hs b/testsuite/tests/module/mod99.hs new file mode 100644 index 0000000000..8298cf1c69 --- /dev/null +++ b/testsuite/tests/module/mod99.hs @@ -0,0 +1,4 @@ +-- !!! Empty export list +module M(,) where + +x = 2 |