Add a failing test for #13099
authorReid Barton <rwbarton@gmail.com>
Fri, 20 Jan 2017 20:03:44 +0000 (15:03 -0500)
committerBen Gamari <ben@smart-cactus.org>
Fri, 20 Jan 2017 21:13:59 +0000 (16:13 -0500)
Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2990

GHC Trac Issues: #13099

testsuite/tests/driver/recomp017/A.hs [new file with mode: 0644]
testsuite/tests/driver/recomp017/B.hs [new file with mode: 0644]
testsuite/tests/driver/recomp017/C.hs [new file with mode: 0644]
testsuite/tests/driver/recomp017/C2.hs [new file with mode: 0644]
testsuite/tests/driver/recomp017/D.hs [new file with mode: 0644]
testsuite/tests/driver/recomp017/E.hs [new file with mode: 0644]
testsuite/tests/driver/recomp017/Makefile [new file with mode: 0644]
testsuite/tests/driver/recomp017/all.T [new file with mode: 0644]

diff --git a/testsuite/tests/driver/recomp017/A.hs b/testsuite/tests/driver/recomp017/A.hs
new file mode 100644 (file)
index 0000000..8f9d7c1
--- /dev/null
@@ -0,0 +1,3 @@
+{-# LANGUAGE TypeFamilies #-}
+module A where
+type family F a
diff --git a/testsuite/tests/driver/recomp017/B.hs b/testsuite/tests/driver/recomp017/B.hs
new file mode 100644 (file)
index 0000000..10f8423
--- /dev/null
@@ -0,0 +1,7 @@
+{-# LANGUAGE TypeFamilies #-}
+module B where
+import A
+data B
+type instance F (B,b) = ()
+b :: () -> F (B,b)
+b = id
diff --git a/testsuite/tests/driver/recomp017/C.hs b/testsuite/tests/driver/recomp017/C.hs
new file mode 100644 (file)
index 0000000..a6d1af0
--- /dev/null
@@ -0,0 +1,5 @@
+{-# LANGUAGE TypeFamilies #-}
+module C where
+import A
+data C
+type instance F (a,C) = ()
diff --git a/testsuite/tests/driver/recomp017/C2.hs b/testsuite/tests/driver/recomp017/C2.hs
new file mode 100644 (file)
index 0000000..551de2b
--- /dev/null
@@ -0,0 +1,5 @@
+{-# LANGUAGE TypeFamilies #-}
+module C where
+import A
+data C
+type instance F (a,C) = Bool
diff --git a/testsuite/tests/driver/recomp017/D.hs b/testsuite/tests/driver/recomp017/D.hs
new file mode 100644 (file)
index 0000000..8ed80ad
--- /dev/null
@@ -0,0 +1,3 @@
+module D (b) where
+import B
+import C
diff --git a/testsuite/tests/driver/recomp017/E.hs b/testsuite/tests/driver/recomp017/E.hs
new file mode 100644 (file)
index 0000000..326a03d
--- /dev/null
@@ -0,0 +1,10 @@
+{-# LANGUAGE TypeApplications #-}
+module E where
+import A
+import B
+import C
+import D
+c :: F (a, C) -> Bool
+c = id
+e :: () -> Bool
+e = c . b @ C
diff --git a/testsuite/tests/driver/recomp017/Makefile b/testsuite/tests/driver/recomp017/Makefile
new file mode 100644 (file)
index 0000000..6a2f92a
--- /dev/null
@@ -0,0 +1,21 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Recompilation tests
+
+clean:
+       rm -f *.o *.hi
+
+# bug #13099
+
+recomp017: clean
+       echo 'first run'
+       '$(TEST_HC)' $(TEST_HC_OPTS) --make D.hs
+       sleep 1
+       # A simple 'cp' would overwrite the original file,
+       # pointed to by the symlink
+       mv -f C2.hs C.hs
+       touch C.hs
+       echo 'second run'
+       ! '$(TEST_HC)' $(TEST_HC_OPTS) --make E.hs
diff --git a/testsuite/tests/driver/recomp017/all.T b/testsuite/tests/driver/recomp017/all.T
new file mode 100644 (file)
index 0000000..1ba5343
--- /dev/null
@@ -0,0 +1,11 @@
+# Test for #13099, a recompilation bug involving type family instances
+
+test('recomp017',
+     [ clean_cmd('$MAKE -s clean'),
+       extra_files(['A.hs', 'B.hs', 'C.hs', 'C2.hs',
+                    'D.hs', 'E.hs']),
+       ignore_stdout,
+       expect_broken(13099) ],
+     run_command,
+     ['$MAKE -s --no-print-directory recomp017'])
+