Add failing test for #9562.
authorEdward Z. Yang <ezyang@cs.stanford.edu>
Thu, 11 Jun 2015 21:57:50 +0000 (14:57 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Thu, 11 Jun 2015 21:57:50 +0000 (14:57 -0700)
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
testsuite/.gitignore
testsuite/tests/driver/T9562/A.hs [new file with mode: 0644]
testsuite/tests/driver/T9562/B.hs [new file with mode: 0644]
testsuite/tests/driver/T9562/B.hs-boot [new file with mode: 0644]
testsuite/tests/driver/T9562/C.hs [new file with mode: 0644]
testsuite/tests/driver/T9562/D.hs [new file with mode: 0644]
testsuite/tests/driver/T9562/Main.hs [new file with mode: 0644]
testsuite/tests/driver/T9562/Makefile [new file with mode: 0644]
testsuite/tests/driver/T9562/all.T [new file with mode: 0644]

index 1855727..ade0024 100644 (file)
@@ -540,6 +540,7 @@ mk/ghcconfig*_inplace_bin_ghc-stage2.exe.mk
 /tests/driver/T7835/Test
 /tests/driver/T8526/A.inc
 /tests/driver/T8602/t8602.sh
+/tests/driver/T9562/Main
 /tests/driver/Test.081b
 /tests/driver/Test.081b.hs
 /tests/driver/Test_081a
diff --git a/testsuite/tests/driver/T9562/A.hs b/testsuite/tests/driver/T9562/A.hs
new file mode 100644 (file)
index 0000000..03f5ad3
--- /dev/null
@@ -0,0 +1,5 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module A where
+
+type family F a b
diff --git a/testsuite/tests/driver/T9562/B.hs b/testsuite/tests/driver/T9562/B.hs
new file mode 100644 (file)
index 0000000..34fe7b8
--- /dev/null
@@ -0,0 +1,11 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module B where
+
+import A
+import C
+
+type instance F a b = b
+
+oops :: F a b -> a -> b
+oops = const
diff --git a/testsuite/tests/driver/T9562/B.hs-boot b/testsuite/tests/driver/T9562/B.hs-boot
new file mode 100644 (file)
index 0000000..facbc8c
--- /dev/null
@@ -0,0 +1,5 @@
+module B where
+
+import A
+
+oops :: F a b -> a -> b
diff --git a/testsuite/tests/driver/T9562/C.hs b/testsuite/tests/driver/T9562/C.hs
new file mode 100644 (file)
index 0000000..bca4f46
--- /dev/null
@@ -0,0 +1,3 @@
+module C (oops) where
+
+import {-# SOURCE #-} B
diff --git a/testsuite/tests/driver/T9562/D.hs b/testsuite/tests/driver/T9562/D.hs
new file mode 100644 (file)
index 0000000..c9beceb
--- /dev/null
@@ -0,0 +1,11 @@
+{-# LANGUAGE TypeFamilies #-}
+
+module D where
+
+import A
+import C
+
+type instance F a b = a
+
+unsafeCoerce :: a -> b
+unsafeCoerce x = oops x x
diff --git a/testsuite/tests/driver/T9562/Main.hs b/testsuite/tests/driver/T9562/Main.hs
new file mode 100644 (file)
index 0000000..fabf5f5
--- /dev/null
@@ -0,0 +1,5 @@
+module Main where
+
+import D ( unsafeCoerce )
+
+main = print $ (unsafeCoerce True :: Int)
diff --git a/testsuite/tests/driver/T9562/Makefile b/testsuite/tests/driver/T9562/Makefile
new file mode 100644 (file)
index 0000000..423389d
--- /dev/null
@@ -0,0 +1,12 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+T9562:
+       rm -f *.o *.hi *.o-boot *.hi-boot Main
+       '$(TEST_HC)' -c A.hs
+       '$(TEST_HC)' -c B.hs-boot
+       '$(TEST_HC)' -c C.hs
+       '$(TEST_HC)' -c B.hs
+       '$(TEST_HC)' -c D.hs
+       ! ('$(TEST_HC)' Main.hs && ./Main)
diff --git a/testsuite/tests/driver/T9562/all.T b/testsuite/tests/driver/T9562/all.T
new file mode 100644 (file)
index 0000000..ab379ee
--- /dev/null
@@ -0,0 +1,6 @@
+setTestOpts(only_compiler_types(['ghc']))
+
+test('T9562',
+     [extra_clean(['A011.hi', 'A011.o']), expect_broken(9562)],
+     run_command,
+     ['$MAKE -s --no-print-directory T9562'])