[commit: ghc] master: Don't require PatternSynonyms language extension to just use pattern synonyms (see #9838) (d8c437b)

git at git.haskell.org git at git.haskell.org
Thu Nov 27 11:23:31 UTC 2014


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

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

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

commit d8c437b37436e150986a7607f574ac2c3a604f40
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date:   Thu Nov 27 19:21:04 2014 +0800

    Don't require PatternSynonyms language extension to just use pattern synonyms
    (see #9838)


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

d8c437b37436e150986a7607f574ac2c3a604f40
 compiler/typecheck/TcPat.lhs                                       | 6 ------
 docs/users_guide/glasgow_exts.xml                                  | 4 ++--
 .../patsyn/{should_fail/T8961a.hs => should_compile/ImpExp_Exp.hs} | 2 +-
 .../patsyn/{should_fail/T8961.hs => should_compile/ImpExp_Imp.hs}  | 2 +-
 testsuite/tests/patsyn/should_compile/all.T                        | 1 +
 testsuite/tests/patsyn/should_fail/T8961.stderr                    | 7 -------
 testsuite/tests/patsyn/should_fail/all.T                           | 1 -
 7 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/compiler/typecheck/TcPat.lhs b/compiler/typecheck/TcPat.lhs
index b7f8d2e..de60fcb 100644
--- a/compiler/typecheck/TcPat.lhs
+++ b/compiler/typecheck/TcPat.lhs
@@ -828,12 +828,6 @@ tcPatSynPat penv (L con_span _) pat_syn pat_ty arg_pats thing_inside
 
         ; prov_dicts' <- newEvVars prov_theta'
 
-        -- Using a pattern synonym requires the PatternSynonyms
-        -- language flag to keep consistent with #2905
-        ; patsyns_on <- xoptM Opt_PatternSynonyms
-        ; checkTc patsyns_on
-                  (ptext (sLit "A pattern match on a pattern synonym requires PatternSynonyms"))
-
         ; let skol_info = case pe_ctxt penv of
                             LamPat mc -> PatSkol (PatSynCon pat_syn) mc
                             LetPat {} -> UnkSkol -- Doesn't matter
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 3d9e45c..5ed99ba 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -877,8 +877,8 @@ y)</literal> will not be coalesced.
 
 <para>
 Pattern synonyms are enabled by the flag
-<literal>-XPatternSynonyms</literal>, which is required for both
-defining them <emphasis>and</emphasis> using them.  More information
+<literal>-XPatternSynonyms</literal>, which is required for defining
+them, but <emphasis>not</emphasis> for using them.  More information
 and examples of view patterns can be found on the <ulink
 url="http://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms">Wiki
 page</ulink>.
diff --git a/testsuite/tests/patsyn/should_fail/T8961a.hs b/testsuite/tests/patsyn/should_compile/ImpExp_Exp.hs
similarity index 58%
rename from testsuite/tests/patsyn/should_fail/T8961a.hs
rename to testsuite/tests/patsyn/should_compile/ImpExp_Exp.hs
index f741d7b..9d18ca3 100644
--- a/testsuite/tests/patsyn/should_fail/T8961a.hs
+++ b/testsuite/tests/patsyn/should_compile/ImpExp_Exp.hs
@@ -1,4 +1,4 @@
 {-# LANGUAGE PatternSynonyms #-}
-module T8961a (pattern Single) where
+module ImpExp_Exp (pattern Single) where
 
 pattern Single x <- [x]
diff --git a/testsuite/tests/patsyn/should_fail/T8961.hs b/testsuite/tests/patsyn/should_compile/ImpExp_Imp.hs
similarity index 84%
rename from testsuite/tests/patsyn/should_fail/T8961.hs
rename to testsuite/tests/patsyn/should_compile/ImpExp_Imp.hs
index 087c399..a2450e2 100644
--- a/testsuite/tests/patsyn/should_fail/T8961.hs
+++ b/testsuite/tests/patsyn/should_compile/ImpExp_Imp.hs
@@ -1,6 +1,6 @@
 module ShouldFail where
 
-import T8961a
+import ImpExp_Exp
 
 single :: [a] -> Maybe a
 single (Single x) = Just x
diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T
index 6a51bf5..c8a88c3 100644
--- a/testsuite/tests/patsyn/should_compile/all.T
+++ b/testsuite/tests/patsyn/should_compile/all.T
@@ -18,3 +18,4 @@ test('T8584-3', normal, compile, [''])
 test('T8968-1', normal, compile, [''])
 test('T8968-2', normal, compile, [''])
 test('T8968-3', normal, compile, [''])
+test('ImpExp_Imp', [extra_clean(['ImpExp_Exp.hi', 'ImpExp_Exp.o'])], multimod_compile, ['ImpExp_Imp', '-v0'])
diff --git a/testsuite/tests/patsyn/should_fail/T8961.stderr b/testsuite/tests/patsyn/should_fail/T8961.stderr
deleted file mode 100644
index a58ee38..0000000
--- a/testsuite/tests/patsyn/should_fail/T8961.stderr
+++ /dev/null
@@ -1,7 +0,0 @@
-[1 of 2] Compiling T8961a           ( T8961a.hs, T8961a.o )
-[2 of 2] Compiling ShouldFail       ( T8961.hs, T8961.o )
-
-T8961.hs:6:9:
-    A pattern match on a pattern synonym requires PatternSynonyms
-    In the pattern: Single x
-    In an equation for ‘single’: single (Single x) = Just x
diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T
index b38776e..de5d6db 100644
--- a/testsuite/tests/patsyn/should_fail/all.T
+++ b/testsuite/tests/patsyn/should_fail/all.T
@@ -1,7 +1,6 @@
 test('mono', normal, compile_fail, [''])
 test('unidir', normal, compile_fail, [''])
 test('local', normal, compile_fail, [''])
-test('T8961', normal, multimod_compile_fail, ['T8961',''])
 test('as-pattern', normal, compile_fail, [''])
 test('T9161-1', normal, compile_fail, [''])
 test('T9161-2', normal, compile_fail, [''])



More information about the ghc-commits mailing list