Permit conversion of partially applied PromotedTupleTs
authorRyan Scott <ryan.gl.scott@gmail.com>
Fri, 2 Mar 2018 21:15:38 +0000 (16:15 -0500)
committerBen Gamari <ben@smart-cactus.org>
Fri, 2 Mar 2018 21:53:29 +0000 (16:53 -0500)
Summary:
We were simply missing a case in `Convert` for when have a
`PromotedTupleT` that wasn't fully saturated. Easily fixed.

Test Plan: make test TEST=T14843

Reviewers: goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14843

Differential Revision: https://phabricator.haskell.org/D4442

compiler/hsSyn/Convert.hs
testsuite/tests/th/T14843.hs [new file with mode: 0644]
testsuite/tests/th/all.T

index e137b1e..c1cf77b 100644 (file)
@@ -1301,6 +1301,9 @@ cvtTypeKind ty_str ty
              -> do  { let kis = replicate m placeHolderKind
                     ; returnL (HsExplicitTupleTy kis tys')
                     }
+             | otherwise
+             -> mk_apps (HsTyVar NotPromoted
+                               (noLoc (getRdrName (tupleDataCon Boxed n)))) tys'
              where
                m = length tys'
 
diff --git a/testsuite/tests/th/T14843.hs b/testsuite/tests/th/T14843.hs
new file mode 100644 (file)
index 0000000..505fa51
--- /dev/null
@@ -0,0 +1,9 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TemplateHaskell #-}
+module T14843 where
+
+import Language.Haskell.TH.Syntax
+
+type T1 = $(return (PromotedTupleT 2))
+type T2 = $([t| '(,) |])
+type T3 = $(return (PromotedT (tupleDataName 2)))
index 7305800..50e7314 100644 (file)
@@ -400,3 +400,4 @@ test('T14060', normal, compile_and_run, ['-v0'])
 test('T14646', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
 test('T14681', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
 test('T14817', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
+test('T14843', normal, compile, ['-v0'])