Commit 1fc4f8ef authored by ross's avatar ross

[project @ 2004-11-11 15:00:27 by ross]

added more module tests from the Hugs testsuite, and merged mod200 into
mod154, which tests the same thing.
parent 059028be
module Mod136_A (module List) where
import qualified List
module Mod137_A (module Char) where
import Char
import List as Char
module Mod138_A (module Char) where
import qualified Char
import List as Char
module Mod139_A where
data Foo = Bar
class C a where
m1 :: a -> Int
instance C Int where
m1 _ = 2
x = 'x'
module Mod139_B ( module A ) where
import Mod139_A as A hiding (C,Foo)
module Mod140_A where
data Foo = Bar
module Mod141_A (partition, module List) where
import List hiding (partition)
partition :: String
partition = "partition"
module Mod143_A where
data Foo = Bar
module Mod145_A where
class C2 a where
m1 :: (a,a) -> Int
module Mod147_A(D) where
data D = D Int
module Mod157_A (T(..)) where
data T = A | B | C
module Mod157_B (T(..)) where
import Mod157_A(T(A))
module Mod157_C(T(..)) where
import Mod157_A(T(B))
module Mod157_D(T(..)) where
import Mod157_B(T(..))
import Mod157_C(T(..))
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
module Mod159_B (C(..)) where
import Mod159_A(C(m1))
module Mod159_C(C(..)) where
import Mod159_A(C(m2))
module Mod159_D(C(..)) where
import Mod159_B(C(..))
import Mod159_C(C(..))
module Mod162_A where
data T = T
module Mod163_A where
data C = MkC { f :: Char }
module Mod164_A where
data T = D1 | D2
module Mod164_B where
data S = D1 | D3
module Mod170_A (Type(..)) where
data Type = Constr { field :: Int }
......@@ -171,7 +171,57 @@ test('mod132', normal, multimod_compile_fail, ['mod132', '-v0'])
clean(['Mod132_A.hi', 'Mod132_A.o', 'Mod132_B.hi', 'Mod132_B.o'])
test('mod133', normal, compile, [''])
test('mod134', normal, compile_fail, [''])
test('mod135', normal, compile_fail, [''])
test('mod136', normal, multimod_compile_fail, ['mod136', '-v0'])
clean(['Mod136_A.hi', 'Mod136_A.o'])
test('mod137', normal, multimod_compile, ['mod137', '-v0'])
clean(['Mod137_A.hi', 'Mod137_A.o'])
test('mod138', normal, multimod_compile_fail, ['mod138', '-v0'])
clean(['Mod138_A.hi', 'Mod138_A.o'])
test('mod139', normal, multimod_compile, ['mod139', '-v0'])
clean(['Mod139_A.hi', 'Mod139_A.o', 'Mod139_B.hi', 'Mod139_B.o'])
test('mod140', normal, multimod_compile, ['mod140', '-v0'])
clean(['Mod140_A.hi', 'Mod140_A.o'])
test('mod141', normal, multimod_compile, ['mod141', '-v0'])
clean(['Mod141_A.hi', 'Mod141_A.o'])
test('mod142', normal, multimod_compile_fail, ['mod142', '-v0'])
clean(['Mod142_A.hi', 'Mod142_A.o'])
test('mod143', normal, multimod_compile_fail, ['mod143', '-v0'])
clean(['Mod143_A.hi', 'Mod143_A.o'])
test('mod144', normal, compile_fail, [''])
test('mod145', normal, multimod_compile_fail, ['mod145', '-v0'])
clean(['Mod145_A.hi', 'Mod145_A.o'])
test('mod146', normal, compile_fail, [''])
test('mod147', normal, multimod_compile_fail, ['mod147', '-v0'])
clean(['Mod147_A.hi', 'Mod147_A.o'])
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', normal, compile, [''])
test('mod155', normal, compile_fail, [''])
test('mod156', normal, compile, [''])
test('mod157', normal, multimod_compile, ['mod157', '-v0'])
clean(['Mod157_A.hi', 'Mod157_A.o', 'Mod157_B.hi', 'Mod157_B.o', 'Mod157_C.hi', 'Mod157_C.o'])
test('mod158', normal, compile_fail, [''])
test('mod159', normal, multimod_compile, ['mod159', '-v0'])
clean(['Mod159_A.hi', 'Mod159_A.o', 'Mod159_B.hi', 'Mod159_B.o', 'Mod159_C.hi', 'Mod159_C.o'])
test('mod160', normal, compile_fail, [''])
test('mod161', normal, compile_fail, [''])
test('mod162', normal, multimod_compile, ['mod162', '-v0'])
clean(['Mod162_A.hi', 'Mod162_A.o'])
test('mod163', normal, multimod_compile, ['mod163', '-v0'])
clean(['Mod163_A.hi', 'Mod163_A.o'])
test('mod164', normal, multimod_compile_fail, ['mod164', '-v0'])
clean(['Mod164_A.hi', 'Mod164_A.o', 'Mod164_B.hi', 'Mod164_B.o'])
test('mod165', normal, compile_fail, [''])
test('mod166', normal, compile, [''])
test('mod167', normal, compile, [''])
test('mod168', normal, compile, [''])
test('mod169', normal, compile, [''])
test('mod170', normal, multimod_compile, ['mod170', '-v0'])
clean(['Mod170_A.hi', 'Mod170_A.o'])
# After here we have GHC-only tests (the ones above are copied from Hugs
test('mod200', normal, compile, [''])
# After here we have GHC-only tests (the ones above are copied from Hugs)
-- !!! Re-exporting qualified import.
module M (module List) where
import List as Char
mod135.hs:2:10: Unknown module in export list: module `List'
-- !!! Re-exporting qualified module.
module M where
import Mod136_A
x = zipWith5
mod136.hs:6:4: Not in scope: `zipWith5'
-- !!! Re-exporting alias which maps to multiple mods.
module M where
import Mod137_A
x = zipWith5
y = isLatin1
-- !!! Re-exporting alias which maps to multiple mods; some qualified.
module M where
import Mod138_A
x = zipWith5
y = isLatin1
mod138.hs:7:4: Not in scope: `isLatin1'
-- !!! re-exporting module alias, with hiding.
module M where
import Mod139_B
z = Bar
a = Mod139_B.x
y = m1 (2::Int)
-- !!! hiding tycon _only_.
module M where
import Mod140_A
a = Bar
-- !!! re-exportation to override select entities.
module M where
import Mod141_A
a :: String
a = partition
-- !!! Conflicting re-exportation of var
module M (module M, module Mod142_A) where
import Mod142_A
x = 'x'
mod142.hs:2:10:
Conflicting exports for `x':
`module M' exports `M.x' defined at mod142.hs:6:0
`module Mod142_A' exports `Mod142_A.x' imported from Mod142_A at mod142.hs:4:0-14
(defined at ./Mod142_A.hs:3:0)
-- !!! Conflicting re-exportation of tycon
module M (module M, module Mod143_A) where
import Mod143_A
data Foo = Baz
mod143.hs:2:10:
Conflicting exports for `Foo':
`module M' exports `M.Foo' defined at mod143.hs:6:5
`module Mod143_A' exports `Mod143_A.Foo' imported from Mod143_A at mod143.hs:4:0-14
-- !!! Conflicting re-exportation of dcon
module M (module Mod143_A,module M) where
import Mod143_A -- yes, this is intentionally Mod143_A
data Foo1 = Bar
mod144.hs:2:10:
Conflicting exports for `Bar':
`module Mod143_A' exports `Mod143_A.Bar' imported from Mod143_A at mod144.hs:4:0-14
`module M' exports `M.Bar' defined at mod144.hs:6:12
-- !!! Conflicting re-exportation of class methods
module Mod145(module Mod145, module Mod145_A) where
import Mod145_A
class C1 a where
m1 :: a -> Int
mod145.hs:2:14:
Conflicting exports for `m1':
`module Mod145' exports `Mod145.m1' defined at mod145.hs:7:2
`module Mod145_A' exports `Mod145_A.m1' imported from Mod145_A at mod145.hs:4:0-14
-- !!! Conflicting re-exportation of class methods
module Mod146(module Mod146, module Mod145_A) where
import Mod145_A
class C1 a where
m1 :: a -> Int
mod146.hs:2:14:
Conflicting exports for `m1':
`module Mod146' exports `Mod146.m1' defined at mod146.hs:7:2
`module Mod145_A' exports `Mod145_A.m1' imported from Mod145_A at mod146.hs:4:0-14
-- !!! exporting tycon (but not dcon with same name.)
module M where
import Mod147_A
x = D 4
mod147.hs:6:4: Not in scope: data constructor `D'
-- !!! 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 = [];
-- !!! 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;
-- !!! ambiguous re-exportation.
module M (module M,module Prelude) where id x = x;
mod150.hs:2:10:
Conflicting exports for `id':
`module M' exports `M.id' defined at mod150.hs:2:41
`module Prelude' exports `GHC.Base.id' imported from Prelude at Implicit import declaration
-- !!! ambiguous re-exportation.
module M (module M,id) where id x = x;
mod151.hs:2:19:
Ambiguous occurrence `id'
It could refer to either `M.id', defined at mod151.hs:2:29
or `GHC.Base.id', imported from Prelude at Implicit import declaration
-- !!! ambiguous re-exportation.
module M (module Prelude,id) where id x = x;
mod152.hs:2:10:
Conflicting exports for `id':
`module Prelude' exports `GHC.Base.id' imported from Prelude at Implicit import declaration
`id' exports `M.id' defined at mod152.hs:2:35
mod152.hs:2:25:
Ambiguous occurrence `id'
It could refer to either `M.id', defined at mod152.hs:2:35
or `GHC.Base.id', imported from Prelude at Implicit import declaration
-- !!! ambiguous re-exportation.
module M (id) where id x = x;
mod153.hs:2:10:
Ambiguous occurrence `id'
It could refer to either `M.id', defined at mod153.hs:2:20
or `GHC.Base.id', imported from Prelude at Implicit import declaration
-- !!! 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 List as M
sort = "foo"
-- !!! ambiguous re-exportation.
module M(module M) where
import Prelude as M
id x = x
mod155.hs:2:9:
Conflicting exports for `id':
`module M' exports `M.id' defined at mod155.hs:5:0
`module M' exports `GHC.Base.id' imported from Prelude at mod155.hs:4:0-18
-- !!! non-ambiguous re-exportation.
module M (module Prelude) where id x = x;
-- !!! 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
-- !!! 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
mod158.hs:12:4: Not in scope: data constructor `C'
-- !!! 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'
-- !!! 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'
mod160.hs:12:4: Not in scope: `m3'
-- !!! Testing export of unknown name
module Bar(bar) where
foo = foo
\ No newline at end of file
mod161.hs:2:11: Not in scope: `bar'
-- !!! hiding a type (but not dcon of same name)
module M where
import Mod162_A hiding (T())
x = T
-- !!! lazy name conflict reporting for field labels/selectors.
module M where
import Mod163_A
data T = MkT { f :: Int }
-- !!! lazy name conflict reporting for data constructors
module M where
import Mod164_A
import Mod164_B
f x =
case x of
D1 -> 'a'
mod164.hs:9:4:
Ambiguous occurrence `D1'
It could refer to either `Mod164_A.D1', imported from Mod164_A at mod164.hs:4:0-14
or `Mod164_B.D1', imported from Mod164_B at mod164.hs:5:0-14
-- !!! 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'
mod165.hs:9:4:
Ambiguous occurrence `A.D1'
It could refer to either `Mod164_A.D1', imported from Mod164_A at mod165.hs:4:0-19
or `Mod164_B.D1', imported from Mod164_B at mod165.hs:5:0-19
-- !!! 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'
-- !!! 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
-- !!! 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,