[commit: ghc] master: Permit conversion of partially applied PromotedTupleTs (6835702)

git at git.haskell.org git at git.haskell.org
Fri Mar 2 21:54:22 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/68357020b1cf29d4306e769b3366feb9a65ae78c/ghc

>---------------------------------------------------------------

commit 68357020b1cf29d4306e769b3366feb9a65ae78c
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Fri Mar 2 16:15:38 2018 -0500

    Permit conversion of partially applied PromotedTupleTs
    
    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


>---------------------------------------------------------------

68357020b1cf29d4306e769b3366feb9a65ae78c
 compiler/hsSyn/Convert.hs    | 3 +++
 testsuite/tests/th/T14843.hs | 9 +++++++++
 testsuite/tests/th/all.T     | 1 +
 3 files changed, 13 insertions(+)

diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs
index e137b1e..c1cf77b 100644
--- a/compiler/hsSyn/Convert.hs
+++ b/compiler/hsSyn/Convert.hs
@@ -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
index 0000000..505fa51
--- /dev/null
+++ b/testsuite/tests/th/T14843.hs
@@ -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)))
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 7305800..50e7314 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -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'])



More information about the ghc-commits mailing list