[commit: ghc] ghc-8.0: Allow unlifted types in pattern synonym result type (66d70fd)

git at git.haskell.org git at git.haskell.org
Mon Jul 25 18:36:41 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/66d70fd68b4b52f0e6751679f5702964c122f767/ghc

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

commit 66d70fd68b4b52f0e6751679f5702964c122f767
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Sun May 22 11:52:26 2016 +0100

    Allow unlifted types in pattern synonym result type
    
    Fixes #12094
    
    Test Plan: ./validate
    
    Reviewers: austin, bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2255
    
    GHC Trac Issues: #12094
    
    (cherry picked from commit 8c9b8a31dd9e085704ecac3361a64f196a0bc09d)


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

66d70fd68b4b52f0e6751679f5702964c122f767
 compiler/typecheck/TcPatSyn.hs                  | 6 ++++--
 testsuite/tests/patsyn/should_compile/T12094.hs | 8 ++++++++
 testsuite/tests/patsyn/should_compile/all.T     | 1 +
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs
index 3cf1a86..5113856 100644
--- a/compiler/typecheck/TcPatSyn.hs
+++ b/compiler/typecheck/TcPatSyn.hs
@@ -14,7 +14,7 @@ module TcPatSyn ( tcPatSynSig, tcInferPatSynDecl, tcCheckPatSynDecl
 import HsSyn
 import TcPat
 import TcHsType( tcImplicitTKBndrs, tcExplicitTKBndrs
-               , tcHsContext, tcHsLiftedType, tcHsOpenType, kindGeneralize )
+               , tcHsContext, tcHsOpenType, kindGeneralize )
 import TcRnMonad
 import TcEnv
 import TcMType
@@ -117,7 +117,9 @@ tcPatSynSig name sig_ty
               do { req     <- tcHsContext hs_req
                  ; prov    <- tcHsContext hs_prov
                  ; arg_tys <- mapM tcHsOpenType (hs_arg_tys :: [LHsType Name])
-                 ; body_ty <- tcHsLiftedType hs_body_ty
+                 -- A (literal) pattern can be unlifted;
+                 -- -- e.g. pattern Zero <- 0#   (Trac #12094)
+                 ; body_ty <- tcHsOpenType hs_body_ty
                  ; let bound_tvs
                          = unionVarSets [ allBoundVariabless req
                                         , allBoundVariabless prov
diff --git a/testsuite/tests/patsyn/should_compile/T12094.hs b/testsuite/tests/patsyn/should_compile/T12094.hs
new file mode 100644
index 0000000..5b4e6b4
--- /dev/null
+++ b/testsuite/tests/patsyn/should_compile/T12094.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE MagicHash #-}
+{-# LANGUAGE PatternSynonyms #-}
+module T12094 where
+
+import GHC.Exts (Int#)
+
+pattern Zero :: Int# -- commenting out this line works
+pattern Zero <- 0#
diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T
index 8eddc7b..29a1e33 100644
--- a/testsuite/tests/patsyn/should_compile/all.T
+++ b/testsuite/tests/patsyn/should_compile/all.T
@@ -51,3 +51,4 @@ test('T11283', normal, compile, [''])
 test('T11367', normal, compile, [''])
 test('T11351', normal, compile, [''])
 test('T11633', normal, compile, [''])
+test('T12094', normal, compile, [''])



More information about the ghc-commits mailing list