Test Trac #8570
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 29 Nov 2013 07:30:09 +0000 (07:30 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 29 Nov 2013 07:30:09 +0000 (07:30 +0000)
testsuite/tests/typecheck/should_fail/T8570.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T8570.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T8570a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T8570b.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T8570.hs b/testsuite/tests/typecheck/should_fail/T8570.hs
new file mode 100644 (file)
index 0000000..4542160
--- /dev/null
@@ -0,0 +1,7 @@
+module T8570 where
+
+import T8570a (Image(filepath), logo)
+import T8570b (Field(Image))
+
+foo = let Image {filepath = x} = logo in x
+
diff --git a/testsuite/tests/typecheck/should_fail/T8570.stderr b/testsuite/tests/typecheck/should_fail/T8570.stderr
new file mode 100644 (file)
index 0000000..18653ea
--- /dev/null
@@ -0,0 +1,6 @@
+
+T8570.hs:6:18:
+    Constructor ‛Image’ does not have field ‛filepath’
+    In the pattern: Image {filepath = x}
+    In a pattern binding: Image {filepath = x} = logo
+    In the expression: let Image {filepath = x} = logo in x
diff --git a/testsuite/tests/typecheck/should_fail/T8570a.hs b/testsuite/tests/typecheck/should_fail/T8570a.hs
new file mode 100644 (file)
index 0000000..32bea50
--- /dev/null
@@ -0,0 +1,3 @@
+module T8570a where
+data Image = Image { filepath :: () }
+logo = Image ()
\ No newline at end of file
diff --git a/testsuite/tests/typecheck/should_fail/T8570b.hs b/testsuite/tests/typecheck/should_fail/T8570b.hs
new file mode 100644 (file)
index 0000000..c293fd6
--- /dev/null
@@ -0,0 +1,3 @@
+module T8570b where
+
+data Field = Image
index 0050d65..93eb007 100644 (file)
@@ -327,3 +327,5 @@ test('T8450', normal, compile_fail, [''])
 test('T8514', normal, compile_fail, [''])
 test('ContextStack1', normal, compile_fail, ['-fcontext-stack=10'])
 test('ContextStack2', normal, compile_fail, ['-ftype-function-depth=10'])
+test('T8570', extra_clean(['T85570a.o', 'T8570a.hi','T85570b.o', 'T8570b.hi']),
+     multimod_compile_fail, ['T8570', '-v0'])