summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-09-02 18:45:05 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-04 16:25:35 -0400
commitc1e54439be3d38a1f972ac772cca7eec5e1519a9 (patch)
treefae78006b08e1cd756c41f7a09ec5bfb992da89c /testsuite/tests/ghci
parent220ad8d67af345cf3decf82ff26c1e696d21ac93 (diff)
downloadhaskell-c1e54439be3d38a1f972ac772cca7eec5e1519a9.tar.gz
Introduce isBoxedTupleDataCon and use it to fix #18644
The code that converts promoted tuple data constructors to `IfaceType`s in `GHC.CoreToIface` was using `isTupleDataCon`, which conflates boxed and unboxed tuple data constructors. To avoid this, this patch introduces `isBoxedTupleDataCon`, which is like `isTupleDataCon` but only works for _boxed_ tuple data constructors. While I was in town, I was horribly confused by the fact that there were separate functions named `isUnboxedTupleCon` and `isUnboxedTupleTyCon` (similarly, `isUnboxedSumCon` and `isUnboxedSumTyCon`). It turns out that the former only works for data constructors, despite its very general name! I opted to rename `isUnboxedTupleCon` to `isUnboxedTupleDataCon` (similarly, I renamed `isUnboxedSumCon` to `isUnboxedSumDataCon`) to avoid this potential confusion, as well as to be more consistent with the naming convention I used for `isBoxedTupleDataCon`. Fixes #18644.
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r--testsuite/tests/ghci/scripts/T18644.script3
-rw-r--r--testsuite/tests/ghci/scripts/T18644.stdout4
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
3 files changed, 8 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T18644.script b/testsuite/tests/ghci/scripts/T18644.script
new file mode 100644
index 0000000000..e1fb4a86d8
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T18644.script
@@ -0,0 +1,3 @@
+:set -XDataKinds -XUnboxedTuples
+:kind! '(# #)
+:kind! '()
diff --git a/testsuite/tests/ghci/scripts/T18644.stdout b/testsuite/tests/ghci/scripts/T18644.stdout
new file mode 100644
index 0000000000..704d4344b4
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T18644.stdout
@@ -0,0 +1,4 @@
+'(# #) :: (# #)
+= '(# #)
+'() :: ()
+= '()
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 0a05e1dffa..e9d40a7d68 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -315,3 +315,4 @@ test('T17403', normal, ghci_script, ['T17403.script'])
test('T17431', normal, ghci_script, ['T17431.script'])
test('T17549', normal, ghci_script, ['T17549.script'])
test('T17669', [extra_run_opts('-fexternal-interpreter -fobject-code'), expect_broken(17669)], ghci_script, ['T17669.script'])
+test('T18644', normal, ghci_script, ['T18644.script'])