Commit b82410ab authored by Simon Peyton Jones's avatar Simon Peyton Jones

Trac #9222 is actually an ambiguous type, now detected

parent 5760eb59
......@@ -3,5 +3,11 @@ module T9222 where
import Data.Proxy
-- Nov 2014: actually the type of Want is ambiguous if we
-- do the full co/contra thing for subtyping,
-- which we now do
-- So this program is erroneous. (But the original ticket was
-- a crash, and that's still fixed!)
data Want :: (i,j) -> * where
Want :: (a ~ '(b,c) => Proxy b) -> Want a
Couldn't match type ‘b0’ with ‘b’
‘b0’ is untouchable
inside the constraints (a ~ '(b0, c0))
bound by the type of the constructor ‘Want’:
(a ~ '(b0, c0)) => Proxy b0
at T9222.hs:13:3
‘b’ is a rigid type variable bound by
the type of the constructor ‘Want’:
((a ~ '(b, c)) => Proxy b) -> Want a
at T9222.hs:13:3
Expected type: '(b, c)
Actual type: a
In the ambiguity check for the type of the constructor ‘Want’:
Want :: forall (k :: BOX)
(k1 :: BOX)
(a :: (,) k k1)
(b :: k)
(c :: k1).
((a ~ '(b, c)) => Proxy b) -> Want a
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the definition of data constructor ‘Want’
In the data declaration for ‘Want’
......@@ -102,7 +102,7 @@ test('T8705', normal, compile, [''])
test('T8985', normal, compile, [''])
test('T9106', normal, compile_fail, [''])
test('T9144', normal, compile_fail, [''])
test('T9222', normal, compile, [''])
test('T9222', normal, compile_fail, [''])
test('T9264', normal, compile, [''])
test('T9263', normal, run_command, ['$MAKE -s --no-print-directory T9263'])
test('T9063', normal, compile, [''])
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment