summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRyanGlScott <ryan.gl.scott@gmail.com>2016-04-11 02:34:55 +0200
committerBen Gamari <ben@smart-cactus.org>2016-04-11 02:52:18 +0200
commit02a5c580b6078630842f4c3db5d92631fada21e9 (patch)
tree72afe5bd0818e27a9e6e3d75aff6fd06518841a1 /testsuite
parent46e8f199e4d3baffa306a40082fbc2fce67f779f (diff)
downloadhaskell-02a5c580b6078630842f4c3db5d92631fada21e9.tar.gz
Filter out invisible kind arguments during TH reification
Previously, all kind arguments were being reified, which would cause something like this: ``` type Id a = a data Proxy (a :: Id k) = Proxy ``` to output ``` data Proxy (a :: Id * k) = Proxy ``` when `Proxy`'s `Info` is reified. The fix is simple: simply call `filterOutInvisibleTypes` on the kind arguments of a kind synonym application. Fixes #11463. Test Plan: ./validate Reviewers: austin, bgamari, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2081 GHC Trac Issues: #11463
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/th/T11463.hs18
-rw-r--r--testsuite/tests/th/T11463.stdout2
-rw-r--r--testsuite/tests/th/all.T1
3 files changed, 21 insertions, 0 deletions
diff --git a/testsuite/tests/th/T11463.hs b/testsuite/tests/th/T11463.hs
new file mode 100644
index 0000000000..1faf5964f4
--- /dev/null
+++ b/testsuite/tests/th/T11463.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE TypeInType #-}
+module Main where
+
+import Data.Kind
+import Language.Haskell.TH
+
+type Id1 a = a
+type Id2 k (a :: k) = a
+data Proxy1 (a :: Id1 k) = Proxy1
+data Proxy2 (a :: Id2 * k) = Proxy2
+
+$(return [])
+
+main :: IO ()
+main = do
+ putStrLn $(reify ''Proxy1 >>= stringE . pprint)
+ putStrLn $(reify ''Proxy2 >>= stringE . pprint)
diff --git a/testsuite/tests/th/T11463.stdout b/testsuite/tests/th/T11463.stdout
new file mode 100644
index 0000000000..d33038a10e
--- /dev/null
+++ b/testsuite/tests/th/T11463.stdout
@@ -0,0 +1,2 @@
+data Main.Proxy1 (a_0 :: Main.Id1 k_1) = Main.Proxy1
+data Main.Proxy2 (a_0 :: Main.Id2 * k_1) = Main.Proxy2
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index f6d9138dce..2ff11fb7f3 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -397,5 +397,6 @@ test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques'])
test('T11452', normal, compile_fail, ['-v0'])
test('T9022', normal, compile_and_run, ['-v0'])
test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques'])
+test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques'])
test('T11680', normal, compile_fail, ['-v0'])
test('T11809', normal, compile, ['-v0'])