diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2023-01-24 20:57:57 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-30 21:19:56 -0500 |
commit | 2f1450521b816a7d287b72deba14d59b6ccfbdbf (patch) | |
tree | de16ae0d22fe31fae4f6079dacc1caeaba9db930 /testsuite/tests/th/T22819.hs | |
parent | 20598ef6d9e26e2e0af9ac42a42e7be00d7cc4f3 (diff) | |
download | haskell-2f1450521b816a7d287b72deba14d59b6ccfbdbf.tar.gz |
Fix two bugs in TypeData TH reification
This patch fixes two issues in the way that `type data` declarations were
reified with Template Haskell:
* `type data` data constructors are now properly reified using `DataConI`.
This is accomplished with a special case in `reifyTyCon`. Fixes #22818.
* `type data` type constructors are now reified in `reifyTyCon` using
`TypeDataD` instead of `DataD`. Fixes #22819.
Diffstat (limited to 'testsuite/tests/th/T22819.hs')
-rw-r--r-- | testsuite/tests/th/T22819.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/th/T22819.hs b/testsuite/tests/th/T22819.hs new file mode 100644 index 0000000000..bd5385abad --- /dev/null +++ b/testsuite/tests/th/T22819.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeData #-} +module T22818 where + +import Language.Haskell.TH +import System.IO + +type data T = MkT + +$(pure []) + +$(do i <- reify ''T + runIO $ do + hPutStrLn stderr $ pprint i + hFlush stderr + pure []) |