diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2016-07-18 13:51:53 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2016-07-18 13:51:53 -0400 |
commit | 1fc41d3274b5bf62f027aa6c7df57998db494938 (patch) | |
tree | 77e8e058104deb80ac5cce895331ec4459ecb922 /testsuite/tests/th/T12407.hs | |
parent | 514c4a4741f3881672f1ccc1fe6d08a5d596bb87 (diff) | |
download | haskell-1fc41d3274b5bf62f027aa6c7df57998db494938.tar.gz |
Make okConIdOcc recognize unboxed tuples
Summary:
`okConIdOcc`, which validates that a type or constructor name is valid
for splicing using Template Haskell, has a special case for tuples, but
neglects to look for unboxed tuples, causing some sensible Template Haskell
code involving unboxed tuples to be rejected.
Fixes #12407.
Test Plan: make test TEST=T12407
Reviewers: austin, bgamari, hvr, goldfire
Reviewed By: goldfire
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2410
GHC Trac Issues: #12407
Diffstat (limited to 'testsuite/tests/th/T12407.hs')
-rw-r--r-- | testsuite/tests/th/T12407.hs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/th/T12407.hs b/testsuite/tests/th/T12407.hs new file mode 100644 index 0000000000..daa3e34c6f --- /dev/null +++ b/testsuite/tests/th/T12407.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE UnboxedTuples #-} +module T12407 where + +import Language.Haskell.TH.Lib +import Language.Haskell.TH.Syntax + +$(do let ubxTup = conT (unboxedTupleTypeName 2) `appT` conT ''Int + `appT` conT ''Int + x <- newName "x" + y <- newName "y" + + [d| f :: $(ubxTup) -> $(ubxTup) + f $(conP (unboxedTupleDataName 2) [varP x, varP y]) + = $(conE (unboxedTupleDataName 2) `appE` varE x + `appE` varE y) + |]) |