summaryrefslogtreecommitdiff
path: root/testsuite/tests/th
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2016-08-22 10:39:12 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2016-08-22 10:39:13 -0400
commitfb0d87f1c4a35fa2aaf7f6dd55edbc71c7c3b44d (patch)
tree26e4a690f3d6f393205d2bc498df20f2ff7e0096 /testsuite/tests/th
parentf9aa996f0af59f32dc7b1528ff78be41413a9c27 (diff)
downloadhaskell-fb0d87f1c4a35fa2aaf7f6dd55edbc71c7c3b44d.tar.gz
Splice singleton unboxed tuples correctly with Template Haskell
Summary: Previously, TH would implicitly remove the parentheses when splicing in singleton unboxed tuple types (e.g., turning `(# Int #)` into `Int`). Luckily, the fix is simply to delete some code. Fixes #12513. Test Plan: make test TEST=T12513 Reviewers: hvr, bgamari, austin, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2462 GHC Trac Issues: #12513
Diffstat (limited to 'testsuite/tests/th')
-rw-r--r--testsuite/tests/th/T12513.hs12
-rw-r--r--testsuite/tests/th/T12513.stderr10
-rw-r--r--testsuite/tests/th/all.T1
3 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/th/T12513.hs b/testsuite/tests/th/T12513.hs
new file mode 100644
index 0000000000..625e4c4e16
--- /dev/null
+++ b/testsuite/tests/th/T12513.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE UnboxedTuples #-}
+module T12513 where
+
+import Language.Haskell.TH.Lib
+import Language.Haskell.TH.Syntax
+
+f :: $([t| (# Int #) |]) -> Int
+f x = x
+
+g :: $(unboxedTupleT 1 `appT` conT ''Int) -> Int
+g x = x
diff --git a/testsuite/tests/th/T12513.stderr b/testsuite/tests/th/T12513.stderr
new file mode 100644
index 0000000000..26a2dbb1da
--- /dev/null
+++ b/testsuite/tests/th/T12513.stderr
@@ -0,0 +1,10 @@
+
+T12513.hs:9:7: error:
+ • Couldn't match expected type ‘Int’ with actual type ‘(# Int #)’
+ • In the expression: x
+ In an equation for ‘f’: f x = x
+
+T12513.hs:12:7: error:
+ • Couldn't match expected type ‘Int’ with actual type ‘(# Int #)’
+ • In the expression: x
+ In an equation for ‘g’: g x = x
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 5cece9238e..b05d601670 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -421,3 +421,4 @@ test('T12130', extra_clean(['T12130a.hi','T12130a.o']),
test('T12403', omit_ways(['ghci']),
compile_and_run, ['-v0 -ddump-splices -dsuppress-uniques'])
test('T12407', omit_ways(['ghci']), compile, ['-v0'])
+test('T12513', omit_ways(['ghci']), compile_fail, ['-v0'])