summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver/recomp006
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/driver/recomp006')
-rw-r--r--testsuite/tests/driver/recomp006/A.hs9
-rw-r--r--testsuite/tests/driver/recomp006/B1.hs8
-rw-r--r--testsuite/tests/driver/recomp006/B2.hs8
-rw-r--r--testsuite/tests/driver/recomp006/Makefile16
-rw-r--r--testsuite/tests/driver/recomp006/all.T3
-rw-r--r--testsuite/tests/driver/recomp006/recomp006.stderr14
-rw-r--r--testsuite/tests/driver/recomp006/recomp006.stdout2
7 files changed, 60 insertions, 0 deletions
diff --git a/testsuite/tests/driver/recomp006/A.hs b/testsuite/tests/driver/recomp006/A.hs
new file mode 100644
index 0000000000..a658ba6e3c
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/A.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE TypeOperators #-}
+module A where
+
+import B ((:-))
+
+-- assumes :- is right-associative
+f :: Int :- Int :- Int
+f = (1,(2,3))
+
diff --git a/testsuite/tests/driver/recomp006/B1.hs b/testsuite/tests/driver/recomp006/B1.hs
new file mode 100644
index 0000000000..aed449262f
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/B1.hs
@@ -0,0 +1,8 @@
+
+{-# LANGUAGE TypeOperators #-}
+
+module B where
+
+infixr 9 :-
+
+type a :- b = (a,b)
diff --git a/testsuite/tests/driver/recomp006/B2.hs b/testsuite/tests/driver/recomp006/B2.hs
new file mode 100644
index 0000000000..905b6dbd9a
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/B2.hs
@@ -0,0 +1,8 @@
+
+{-# LANGUAGE TypeOperators #-}
+
+module B where
+
+infixl 9 :-
+
+type a :- b = (a,b)
diff --git a/testsuite/tests/driver/recomp006/Makefile b/testsuite/tests/driver/recomp006/Makefile
new file mode 100644
index 0000000000..a0f55d636d
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/Makefile
@@ -0,0 +1,16 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+OBJSUFFIX = .o
+
+# Test that changing the fixity of a type synonym operator forces recompilation
+# (see #3166).
+recomp006:
+ $(RM) A.hi A$(OBJSUFFIX)
+ cp B1.hs B.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs 1>out 2>err
+ sleep 1
+ cp B2.hs B.hs
+ # This should fail
+ if '$(TEST_HC)' $(TEST_HC_OPTS) --make A.hs; then false; fi
diff --git a/testsuite/tests/driver/recomp006/all.T b/testsuite/tests/driver/recomp006/all.T
new file mode 100644
index 0000000000..bc4f915bad
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/all.T
@@ -0,0 +1,3 @@
+test('recomp006',
+ [ skip_if_fast, extra_clean(['A.o','A.hi','B.o','B.hi','err','out']) ],
+ run_command, ['$MAKE -s --no-print-directory recomp006'])
diff --git a/testsuite/tests/driver/recomp006/recomp006.stderr b/testsuite/tests/driver/recomp006/recomp006.stderr
new file mode 100644
index 0000000000..c449b5cd2d
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/recomp006.stderr
@@ -0,0 +1,14 @@
+
+A.hs:8:6:
+ No instance for (Num (Int :- Int))
+ arising from the literal `1'
+ Possible fix: add an instance declaration for (Num (Int :- Int))
+ In the expression: 1
+ In the expression: (1, (2, 3))
+ In an equation for `f': f = (1, (2, 3))
+
+A.hs:8:8:
+ Couldn't match expected type `Int' with actual type `(t0, t1)'
+ In the expression: (2, 3)
+ In the expression: (1, (2, 3))
+ In an equation for `f': f = (1, (2, 3))
diff --git a/testsuite/tests/driver/recomp006/recomp006.stdout b/testsuite/tests/driver/recomp006/recomp006.stdout
new file mode 100644
index 0000000000..f403e40d1a
--- /dev/null
+++ b/testsuite/tests/driver/recomp006/recomp006.stdout
@@ -0,0 +1,2 @@
+[1 of 2] Compiling B ( B.hs, B.o )
+[2 of 2] Compiling A ( A.hs, A.o )