diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index fc13b3ff55c666b2dc87db5c8373a68e8f2e778a..5b9fbad974272c7fd5b2e49f5902f0c50115654f 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1649,12 +1649,14 @@ reifyKind ki reify_kc_app :: TyCon -> [TyCoRep.Kind] -> TcM TH.Kind reify_kc_app kc kis - = fmap (mkThAppTs r_kc) (mapM reifyKind kis) + = fmap (mkThAppTs r_kc) (mapM reifyKind vis_kis) where r_kc | isTupleTyCon kc = TH.TupleT (tyConArity kc) | kc `hasKey` listTyConKey = TH.ListT | otherwise = TH.ConT (reifyName kc) + vis_kis = filterOutInvisibleTypes kc kis + reifyCxt :: [PredType] -> TcM [TH.Pred] reifyCxt = mapM reifyPred diff --git a/testsuite/tests/th/T11463.hs b/testsuite/tests/th/T11463.hs new file mode 100644 index 0000000000000000000000000000000000000000..1faf5964f4d5f6430e2464acdd95d7062eb7c20f --- /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 0000000000000000000000000000000000000000..d33038a10e5a557315a237f2e2f3b81476bbbe84 --- /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 c398a3114809744ef4d8273908069262379d3d8c..905543073b3b1c65ad6b1ba66e3bffa1e3f05738 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -400,5 +400,6 @@ test('TH_finalizer', normal, compile, ['-v0']) test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-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'])