summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-09-23 12:21:56 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-08 22:45:27 -0500
commitd122e02247a371b14c3e906556900c0d600f424d (patch)
tree59494c5ede8dac829e7d9e31a85293c184ec5598 /testsuite
parent74c9bf914b31bfdd4353b7ff31efd2d3725bd2bb (diff)
downloadhaskell-d122e02247a371b14c3e906556900c0d600f424d.tar.gz
Fix mk_mod_usage_info if the interface file is not already loaded
In #22217 it was observed that the order modules are compiled in affects the contents of an interface file. This was because a module dependended on another module indirectly, via a re-export but the interface file for this module was never loaded because the symbol was never used in the file. If we decide that we depend on a module then we jolly well ought to record this fact in the interface file! Otherwise it could lead to very subtle recompilation bugs if the dependency is not tracked and the module is updated. Therefore the best thing to do is just to make sure the file is loaded by calling the `loadSysInterface` function. This first checks the caches (like we did before) but then actually goes to find the interface on disk if it wasn't loaded. Fixes #22217
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/backpack/should_fail/T19244a.stderr22
-rw-r--r--testsuite/tests/determinism/determ024/A.hs6
-rw-r--r--testsuite/tests/determinism/determ024/B.hs7
-rw-r--r--testsuite/tests/determinism/determ024/Makefile11
-rw-r--r--testsuite/tests/determinism/determ024/all.T1
5 files changed, 36 insertions, 11 deletions
diff --git a/testsuite/tests/backpack/should_fail/T19244a.stderr b/testsuite/tests/backpack/should_fail/T19244a.stderr
index 76f0c86661..5dceaad5f3 100644
--- a/testsuite/tests/backpack/should_fail/T19244a.stderr
+++ b/testsuite/tests/backpack/should_fail/T19244a.stderr
@@ -13,7 +13,17 @@
Instantiating user[Map=ordmap:Map]
[1 of 2] Compiling Map[sig] ( user/Map.hsig, T19244a.out/user/user-GzloW2NeDdA2M0V8qzN4g2/Map.o )
-T19244a.bkp:9:9: error:
+T19244a.bkp:22:9: error:
+ • Type constructor ‘Key’ has conflicting definitions in the module
+ and its hsig file
+ Main module: type Key :: * -> Constraint
+ type Key = GHC.Classes.Ord :: * -> Constraint
+ Hsig file: type Key :: forall {k}. k -> Constraint
+ class Key k1
+ The types have different kinds
+ • while checking that ordmap:Map implements signature Map in user[Map=ordmap:Map]
+
+<no location info>: error:
• Type constructor ‘Map’ has conflicting definitions in the module
and its hsig file
Main module: type role Map nominal representational
@@ -31,16 +41,6 @@ T19244a.bkp:9:9: error:
The types have different kinds
• while checking that ordmap:Map implements signature Map in user[Map=ordmap:Map]
-T19244a.bkp:22:9: error:
- • Type constructor ‘Key’ has conflicting definitions in the module
- and its hsig file
- Main module: type Key :: * -> Constraint
- type Key = GHC.Classes.Ord :: * -> Constraint
- Hsig file: type Key :: forall {k}. k -> Constraint
- class Key k1
- The types have different kinds
- • while checking that ordmap:Map implements signature Map in user[Map=ordmap:Map]
-
<no location info>: error:
• Identifier ‘lookup’ has conflicting definitions in the module
and its hsig file
diff --git a/testsuite/tests/determinism/determ024/A.hs b/testsuite/tests/determinism/determ024/A.hs
new file mode 100644
index 0000000000..bd275761e2
--- /dev/null
+++ b/testsuite/tests/determinism/determ024/A.hs
@@ -0,0 +1,6 @@
+module A
+( isExtensionOf
+, stripExtension
+) where
+
+import System.FilePath.Posix
diff --git a/testsuite/tests/determinism/determ024/B.hs b/testsuite/tests/determinism/determ024/B.hs
new file mode 100644
index 0000000000..02c9081858
--- /dev/null
+++ b/testsuite/tests/determinism/determ024/B.hs
@@ -0,0 +1,7 @@
+module B
+( isExtensionOf
+, stripExtension
+) where
+
+import System.FilePath
+
diff --git a/testsuite/tests/determinism/determ024/Makefile b/testsuite/tests/determinism/determ024/Makefile
new file mode 100644
index 0000000000..300a408394
--- /dev/null
+++ b/testsuite/tests/determinism/determ024/Makefile
@@ -0,0 +1,11 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+determ024:
+ $(RM) A.hi A.o B.hi B.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 B.hs
+ '$(TEST_HC)' --show-iface B.hi > B_clean_iface
+ '$(TEST_HC)' $(TEST_HC_OPTS) -v0 A.hs B.hs -fforce-recomp
+ '$(TEST_HC)' --show-iface B.hi > B_dirty_iface
+ diff B_clean_iface B_dirty_iface
diff --git a/testsuite/tests/determinism/determ024/all.T b/testsuite/tests/determinism/determ024/all.T
new file mode 100644
index 0000000000..eaa79f6e6c
--- /dev/null
+++ b/testsuite/tests/determinism/determ024/all.T
@@ -0,0 +1 @@
+test('determ024', [extra_files(['A.hs', 'B.hs'])], makefile_test, ['determ024'])