Test Trac #6123, and improve an error message in T2627b
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 25 May 2012 10:47:17 +0000 (11:47 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 25 May 2012 10:47:17 +0000 (11:47 +0100)
testsuite/tests/indexed-types/should_fail/T2627b.stderr
testsuite/tests/indexed-types/should_fail/T6123.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T6123.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/all.T

index c0e03ce..9d5504f 100644 (file)
@@ -1,7 +1,11 @@
 
-T2627b.hs:20:24:
-    Occurs check: cannot construct the infinite type:
-      b0 = Dual (Dual b0)
-    In the expression: conn undefined undefined
+T2627b.hs:20:14:
+    Couldn't match expected type `b0' with actual type `Dual (Dual b0)'
+      `b0' is untouchable
+           inside the constraints (b ~ W a2 b2)
+           bound at a pattern with constructor
+                      Wr :: forall a b. a -> Comm b -> Comm (W a b),
+                    in an equation for `conn'
+    In the pattern: Wr a r
     In an equation for `conn':
         conn (Rd k) (Wr a r) = conn undefined undefined
diff --git a/testsuite/tests/indexed-types/should_fail/T6123.hs b/testsuite/tests/indexed-types/should_fail/T6123.hs
new file mode 100644 (file)
index 0000000..78e1d78
--- /dev/null
@@ -0,0 +1,10 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module T6123 where
+
+type family Id a
+
+cid :: a ~ Id a => a -> a
+cid x = x
+
+cundefined = cid undefined
diff --git a/testsuite/tests/indexed-types/should_fail/T6123.stderr b/testsuite/tests/indexed-types/should_fail/T6123.stderr
new file mode 100644 (file)
index 0000000..c389866
--- /dev/null
@@ -0,0 +1,10 @@
+
+T6123.hs:10:14:
+    Couldn't match expected type `a0' with actual type `Id a0'
+    The type variable `a0' is ambiguous
+    Possible cause: the monomorphism restriction applied to the following:
+      cundefined :: a0 (bound at T6123.hs:10:1)
+    Probable fix: give these definition(s) an explicit type signature
+                  or use -XNoMonomorphismRestriction
+    In the expression: cid undefined
+    In an equation for `cundefined': cundefined = cid undefined
index d3e691f..8117a72 100644 (file)
@@ -73,6 +73,6 @@ test('T1897b', normal, compile_fail, [''])
 test('T5439', normal, compile_fail, [''])
 test('T5515', normal, compile_fail, [''])
 test('T5763', expect_broken(5673), compile_fail, [''])
-
 test('T5934', normal, compile_fail, [''])
+test('T6123', normal, compile_fail, [''])