Wibble to tests from improving comments about apartness.
authorRichard Eisenberg <eir@seas.upenn.edu>
Wed, 28 Aug 2013 16:05:03 +0000 (12:05 -0400)
committerRichard Eisenberg <eir@cis.upenn.edu>
Wed, 28 Aug 2013 17:09:02 +0000 (13:09 -0400)
testsuite/tests/indexed-types/should_compile/Overlap14.hs
testsuite/tests/indexed-types/should_fail/Overlap15.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/Overlap15.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/all.T

index 49af37c..96ed37e 100644 (file)
@@ -2,11 +2,11 @@
 
 module Overlap14 where
 
-type family F a b c where
-  F a a a   = Int
-  F Int b c = Bool
+import Data.Proxy
 
-type family G x
+type family F a b c where
+  F a a Int = Int
+  F b c d   = Bool
 
-foo :: F Int (G Bool) Bool
-foo = False
+foo :: Proxy b -> F b [b] Bool
+foo = False
diff --git a/testsuite/tests/indexed-types/should_fail/Overlap15.hs b/testsuite/tests/indexed-types/should_fail/Overlap15.hs
new file mode 100644 (file)
index 0000000..c150a40
--- /dev/null
@@ -0,0 +1,16 @@
+{-# LANGUAGE TypeFamilies #-}
+
+-- In an ideal world, this would work. But, GHC doesn't implement
+-- a full infinite-type unifier, so it can't figure out that F b [b] Bool
+-- can safely reduce to Bool.
+
+module Overlap15 where
+
+import Data.Proxy
+
+type family F a b c where
+  F a a a    = Int
+  F b c Bool = Bool
+
+foo :: Proxy b -> F b [b] Bool
+foo _ = False
diff --git a/testsuite/tests/indexed-types/should_fail/Overlap15.stderr b/testsuite/tests/indexed-types/should_fail/Overlap15.stderr
new file mode 100644 (file)
index 0000000..474bfd7
--- /dev/null
@@ -0,0 +1,7 @@
+
+Overlap15.hs:16:9:
+    Couldn't match expected type ‛F b [b] Bool’ with actual type ‛Bool’
+    Relevant bindings include
+      foo :: Proxy * b -> F b [b] Bool (bound at Overlap15.hs:16:1)
+    In the expression: False
+    In an equation for ‛foo’: foo _ = False
index 04d19ab..14344da 100644 (file)
@@ -85,6 +85,7 @@ test('Overlap7', normal, compile_fail, [''])
 test('Overlap9', normal, compile_fail, [''])
 test('Overlap10', normal, compile_fail, [''])
 test('Overlap11', normal, compile_fail, [''])
+test('Overlap15', normal, compile_fail, [''])
 test('T7194', normal, compile_fail, [''])
 test('T7354', normal, compile_fail, [''])
 test('T7354a',