Commit 8e88515a authored by simonpj's avatar simonpj
Browse files

[project @ 2005-02-25 13:19:26 by simonpj]

More tests
parent 43f57418
......@@ -198,6 +198,7 @@ test('tc185', only_compiler_types(['ghc']), compile, [''])
test('tc186', normal, compile, [''])
test('tc187', normal, compile, [''])
test('tc188', normal, compile, [''])
test('tc189', normal, compile, [''])
test('LoopOfTheDay1', normal, compile, [''])
test('LoopOfTheDay2', normal, compile, [''])
......
-- Nasty test for type signatures
-- In both groups of declarations below, the type variables 'a' and 'b'
-- end up being unified together.
module ShouldCompile where
-------------
x :: a
x = z `asTypeOf` y
y :: b
y = z
z = x
-------------
p :: [a]
q :: b
(p,q,r) = ([q,r], r, head p)
p :: a
q :: b
(p,q,r) = (r,r,p)
......@@ -116,3 +116,5 @@ test('tcfail127', normal, compile_fail, [''])
test('tcfail128', normal, compile_fail, [''])
test('tcfail129', normal, compile_fail, [''])
test('tcfail130', normal, compile_fail, [''])
test('tcfail131', normal, compile_fail, [''])
test('tcfail132', normal, compile_fail, [''])
-- Error message in monomorphic case
module ShouldFail where
f = (*) -- Monomorphic
g :: Num b => b -> b
g x = f x x
tcfail131.hs:7:2:
Inferred type is less polymorphic than expected
Quantified type variable `b' is mentioned in the environment:
f :: b -> b -> b (bound at tcfail131.hs:5:2)
When trying to generalise the type inferred for `g'
Signature type: forall b. (Num b) => b -> b
Type to generalise: b -> b
In the type signature for `g'
When generalising the type(s) for `g'
-- Fails with a kind error.
-- The current error message is rather horrible:
--
-- Kind error: Expecting kind `k_a1JA -> k_a1JE -> k_a1JI -> *',
-- but `DUnit t' has kind `k_a1JA -> k_a1JE -> *'
--
-- but we can't tidy kinds at the moment, becuase they don't have OccNames.
-- This test recalls the bad error message.
--
-- One way to improve matters would be to compile type defns in dependency order
-- I'm not sure when we stopped doing so; and stopping doing so at least means that
-- uses can influence kinds...
module ShouldFail where
newtype Object f' f t o1 o2 = Object (f' t o1 -> f t o2)
type DUnit t o1 o2 = ()
type T f g t o1 o2 = Either (f t o1 o2) (g t o1 o2)
type LiftObject t f' f = T (Object f' f t) (DUnit t)
Kind error: Expecting kind `* -> * -> * -> *',
but `DUnit t' has kind `* -> * -> *'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment