Commit 7b1a8562 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Fix up tests for Trac #7220; the old test really was ambiguous

parent 230b013b
......@@ -3,25 +3,26 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Test2 where
class C a b | b -> a
data A = A
data X = X
data X a = X
data Y = Y
type family TF b
f :: (forall b. (C a b, TF b ~ Y) => b) -> X
f :: (forall b. (C a b, TF b ~ Y) => b) -> X a
f _ = undefined
u :: (C A b, TF b ~ Y) => b
u = undefined
v :: X
v = (f :: (forall b. (C A b, TF b ~ Y) => b) -> X) u -- This line causes an error (see below)
v :: X A
v = (f :: (forall b. (C A b, TF b ~ Y) => b) -> X A) u -- This line causes an error (see below)
{-
GHC 7.6.1-rc1 (7.6.0.20120810) rejects this code with the following error message.
......
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
module T7220a where
class C a b | b -> a
data X = X
data Y = Y
type family TF b
f :: (forall b. (C a b, TF b ~ Y) => b) -> X
-- This type is really ambiguous
-- GHC 7.8 didn't detect that, and accepted the type, but would fail
-- when given g :: <the same type>
-- g x = f x
-- But it would succeed if you said just
-- g = f
-- Now we fail in all ways!
f _ = undefined
......@@ -426,4 +426,5 @@ test('T9708', normal, compile_fail, [''])
test('T9404', normal, compile, [''])
test('T9404b', normal, compile, [''])
test('T7220', normal, compile, [''])
test('T7220a', normal, compile_fail, [''])
test('T9151', normal, compile, [''])
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