diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2016-12-14 16:47:53 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-12-15 10:42:25 -0500 |
commit | 9550b8d810c3ce9fcf3419da367041124e2673de (patch) | |
tree | e9abfa4cbc4b90364a22d4f4c528c43561eb0dc6 /testsuite | |
parent | fe5d68ad1ae5faaaf786f334edf251295195ef6d (diff) | |
download | haskell-9550b8d810c3ce9fcf3419da367041124e2673de.tar.gz |
Make unboxedTuple{Type,Data}Name support 0- and 1-tuples
Previously, these functions were hardcoded so as to always `error`
whenever given an argument of 0 or 1. This restriction can be lifted
pretty easily, however.
This requires a slight tweak to `isBuiltInOcc_maybe` in `TysWiredIn` to
allow it to recognize `Unit#` (which is the hard-wired `OccName` for
unboxed 1-tuples).
Fixes #12977.
Test Plan: make test TEST=12977
Reviewers: austin, goldfire, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2847
GHC Trac Issues: #12977
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/th/T12977.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/th/T12977.hs b/testsuite/tests/th/T12977.hs new file mode 100644 index 0000000000..69832b89d8 --- /dev/null +++ b/testsuite/tests/th/T12977.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE UnboxedTuples #-} +module T12977 where + +import Language.Haskell.TH.Lib +import Language.Haskell.TH.Syntax + +zero :: () -> $(conT (unboxedTupleTypeName 0)) +zero () = $(conE (unboxedTupleDataName 0)) + +one :: () -> $(conT (unboxedTupleTypeName 1) `appT` conT ''Int) +one () = $(conE (unboxedTupleDataName 1)) 42 diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index b144419f45..c2c9fa28fd 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -444,3 +444,4 @@ test('T12646', normal, compile, ['-v0']) test('T12788', extra_clean(['T12788_Lib.hi', 'T12788_Lib.o']), multimod_compile_fail, ['T12788.hs', '-v0 ' + config.ghc_th_way_flags]) +test('T12977', normal, compile, ['-v0']) |