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 | |
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')
-rw-r--r-- | testsuite/tests/th/T12407.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 1 |
2 files changed, 18 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) + |]) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 3f448d70a8..5cece9238e 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -420,3 +420,4 @@ test('T12130', extra_clean(['T12130a.hi','T12130a.o']), multimod_compile, ['T12130', '-v0 ' + config.ghc_th_way_flags]) test('T12403', omit_ways(['ghci']), compile_and_run, ['-v0 -ddump-splices -dsuppress-uniques']) +test('T12407', omit_ways(['ghci']), compile, ['-v0']) |