[commit: ghc] master: Allow unlifted types in pattern synonym result type (8c9b8a3)

git at git.haskell.org git at git.haskell.org
Mon May 23 12:19:34 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8c9b8a31dd9e085704ecac3361a64f196a0bc09d/ghc

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

commit 8c9b8a31dd9e085704ecac3361a64f196a0bc09d
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


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

8c9b8a31dd9e085704ecac3361a64f196a0bc09d
 compiler/typecheck/TcPatSyn.hs                  | 4 +++-
 testsuite/tests/patsyn/should_compile/T12094.hs | 8 ++++++++
 testsuite/tests/patsyn/should_compile/all.T     | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs
index 8c577cf..8763774 100644
--- a/compiler/typecheck/TcPatSyn.hs
+++ b/compiler/typecheck/TcPatSyn.hs
@@ -113,7 +113,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 d2f6809..035cd00 100644
--- a/testsuite/tests/patsyn/should_compile/all.T
+++ b/testsuite/tests/patsyn/should_compile/all.T
@@ -53,3 +53,4 @@ test('T11367', normal, compile, [''])
 test('T11351', normal, compile, [''])
 test('T11633', normal, compile, [''])
 test('T11959', expect_broken(11959), multimod_compile, ['T11959', '-v0'])
+test('T12094', normal, compile, [''])



More information about the ghc-commits mailing list