summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/scripts
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-09-13 14:50:29 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-17 14:06:08 -0400
commit65bf3992aebb3c08f0c4e13a3fb89dd5620015a9 (patch)
tree829b10ecd01913dc32710182f0f73519e2f9414a /testsuite/tests/ghci/scripts
parentc9922a8e4d598f1c6a048305ca58d0ecf34d6776 (diff)
downloadhaskell-65bf3992aebb3c08f0c4e13a3fb89dd5620015a9.tar.gz
ghci: Explicitly store and restore interface file cache
In the old days the old HPT was used as an interface file cache when using ghci. The HPT is a `ModuleEnv HomeModInfo` and so if you were using hs-boot files then the interface file from compiling the .hs file would be present in the cache but not the hi-boot file. This used to be ok, because the .hi file used to just be a better version of the .hi-boot file, with more information so it was fine to reuse it. Now the source hash of a module is kept track of in the interface file and the source hash for the .hs and .hs-boot file are correspondingly different so it's no longer safe to reuse an interface file. I took the decision to move the cache management of interface files to GHCi itself, and provide an API where `load` can be provided with a list of interface files which can be used as a cache. An alternative would be to manage this cache somewhere in the HscEnv but it seemed that an API user should be responsible for populating and suppling the cache rather than having it managed implicitly. Fixes #20217
Diffstat (limited to 'testsuite/tests/ghci/scripts')
-rw-r--r--testsuite/tests/ghci/scripts/T20217.hs3
-rw-r--r--testsuite/tests/ghci/scripts/T20217.script4
-rw-r--r--testsuite/tests/ghci/scripts/T20217.stdout5
-rw-r--r--testsuite/tests/ghci/scripts/T20217A.hs1
-rw-r--r--testsuite/tests/ghci/scripts/T20217A.hs-boot1
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
6 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T20217.hs b/testsuite/tests/ghci/scripts/T20217.hs
new file mode 100644
index 0000000000..4529633222
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T20217.hs
@@ -0,0 +1,3 @@
+module T20217 where
+
+import {-# SOURCE #-} T20217A
diff --git a/testsuite/tests/ghci/scripts/T20217.script b/testsuite/tests/ghci/scripts/T20217.script
new file mode 100644
index 0000000000..27bffe4e61
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T20217.script
@@ -0,0 +1,4 @@
+:set -fno-code
+:set -v1
+:l T20217
+:r
diff --git a/testsuite/tests/ghci/scripts/T20217.stdout b/testsuite/tests/ghci/scripts/T20217.stdout
new file mode 100644
index 0000000000..fa229321bf
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T20217.stdout
@@ -0,0 +1,5 @@
+[1 of 3] Compiling T20217A[boot] ( T20217A.hs-boot, nothing )
+[2 of 3] Compiling T20217 ( T20217.hs, nothing )
+[3 of 3] Compiling T20217A ( T20217A.hs, nothing )
+Ok, three modules loaded.
+Ok, three modules loaded.
diff --git a/testsuite/tests/ghci/scripts/T20217A.hs b/testsuite/tests/ghci/scripts/T20217A.hs
new file mode 100644
index 0000000000..326b0d7607
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T20217A.hs
@@ -0,0 +1 @@
+module T20217A where x = x
diff --git a/testsuite/tests/ghci/scripts/T20217A.hs-boot b/testsuite/tests/ghci/scripts/T20217A.hs-boot
new file mode 100644
index 0000000000..c4c1f8a75b
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T20217A.hs-boot
@@ -0,0 +1 @@
+module T20217A where
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index d8c80e9543..c47b3b0569 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -346,3 +346,4 @@ test('T19650',
test('T20019', normal, ghci_script, ['T20019.script'])
test('T20101', normal, ghci_script, ['T20101.script'])
test('T20206', normal, ghci_script, ['T20206.script'])
+test('T20217', normal, ghci_script, ['T20217.script'])