[commit: testsuite] master: Another test for Trac #7354 (c460f8b)

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/c460f8bd55ac6bf57e5927933d4d27dffbe31c81

>---------------------------------------------------------------

commit c460f8bd55ac6bf57e5927933d4d27dffbe31c81
Author: Simon Peyton Jones <[email protected]>
Date:   Fri Oct 26 17:41:51 2012 +0100

    Another test for Trac #7354

>---------------------------------------------------------------

 tests/indexed-types/should_fail/Makefile      |    4 ++++
 tests/indexed-types/should_fail/T7354a.hs     |    7 +++++++
 tests/indexed-types/should_fail/T7354a.stderr |    7 +++++++
 tests/indexed-types/should_fail/T7354b.hs     |    7 +++++++
 tests/indexed-types/should_fail/all.T         |    8 ++++++++
 5 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/tests/indexed-types/should_fail/Makefile b/tests/indexed-types/should_fail/Makefile
index 9101fbd..7c2b8d1 100644
--- a/tests/indexed-types/should_fail/Makefile
+++ b/tests/indexed-types/should_fail/Makefile
@@ -1,3 +1,7 @@
 TOP=../../..
 include $(TOP)/mk/boilerplate.mk
 include $(TOP)/mk/test.mk
+
+T7354a:
+	'$(TEST_HC)' $(TEST_HC_OPTS) -c T7354b.hs
+	-'$(TEST_HC)' $(TEST_HC_OPTS) -c T7354a.hs
diff --git a/tests/indexed-types/should_fail/T7354a.hs b/tests/indexed-types/should_fail/T7354a.hs
new file mode 100644
index 0000000..8bdd3af
--- /dev/null
+++ b/tests/indexed-types/should_fail/T7354a.hs
@@ -0,0 +1,7 @@
+module T7354a where
+
+import T7354b
+
+foo = embed ()
+
+bar = foo
diff --git a/tests/indexed-types/should_fail/T7354a.stderr b/tests/indexed-types/should_fail/T7354a.stderr
new file mode 100644
index 0000000..1b66b87
--- /dev/null
+++ b/tests/indexed-types/should_fail/T7354a.stderr
@@ -0,0 +1,7 @@
+
+T7354a.hs:5:13:
+    Couldn't match expected type `Base t t' with actual type `()'
+    Relevant bindings include foo :: t (bound at T7354a.hs:5:1)
+    In the first argument of `embed', namely `()'
+    In the expression: embed ()
+    In an equation for `foo': foo = embed ()
diff --git a/tests/indexed-types/should_fail/T7354b.hs b/tests/indexed-types/should_fail/T7354b.hs
new file mode 100644
index 0000000..c5395cf
--- /dev/null
+++ b/tests/indexed-types/should_fail/T7354b.hs
@@ -0,0 +1,7 @@
+{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
+module T7354b where
+
+type family Base t :: * -> *
+
+class Unfoldable t where
+  embed :: Base t t -> t
diff --git a/tests/indexed-types/should_fail/all.T b/tests/indexed-types/should_fail/all.T
index 3ab9c5e..820fe7d 100644
--- a/tests/indexed-types/should_fail/all.T
+++ b/tests/indexed-types/should_fail/all.T
@@ -79,3 +79,11 @@ test('ExtraTcsUntch', normal, compile_fail, [''])
 test('T7010', normal, compile_fail, [''])
 test('T7194', normal, compile_fail, [''])
 test('T7354', normal, compile_fail, [''])
+test('T7354a',
+     extra_clean(['T7354b.o', 'T7354b.hi']),
+     run_command,
+     ['$MAKE -s --no-print-directory T7354a'])
+
+
+
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.