Commit f0022b77 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Add test for Trac #1128

parent d5c903e2
......@@ -159,4 +159,5 @@ test('tcfail170', normal, compile_fail, [''])
test('tcfail171', normal, compile_fail, [''])
test('tcfail172', normal, compile_fail, [''])
test('tcfail173', normal, compile_fail, [''])
test('tcfail174', normal, compile_fail, [''])
{-# OPTIONS -fglasgow-exts #-}
module Foo where
data Capture a = Base a
| Capture (Capture (forall x . x -> a))
g :: Capture (forall a . a -> a)
g = Base id
-- This function should definitely be rejected, with or without type signature
h1 = Capture g
h2 :: Capture b
h2 = Capture g
tcfail174.hs:13:13:
Inferred type is less polymorphic than expected
Quantified type variable `a' escapes
When matching `forall a. a -> a'
and `forall a. a -> a1'
Expected type: Capture (forall x. x -> a)
Inferred type: Capture (forall a2. a2 -> a2)
In the first argument of `Capture', namely `g'
tcfail174.hs:16:13:
Couldn't match expected type `b' (a rigid variable)
against inferred type `a' (a rigid variable)
`b' is bound by the type signature for `h2' at tcfail174.hs:15:14
When matching `forall a. a -> a'
and `forall a. a -> b'
Expected type: Capture (forall x. x -> b)
Inferred type: Capture (forall a1. a1 -> a1)
In the first argument of `Capture', namely `g'
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