Don't require PatternSynonyms language extension to just use pattern synonyms
authorDr. ERDI Gergo <gergo@erdi.hu>
Thu, 27 Nov 2014 11:21:04 +0000 (19:21 +0800)
committerDr. ERDI Gergo <gergo@erdi.hu>
Thu, 27 Nov 2014 11:21:04 +0000 (19:21 +0800)
(see #9838)

compiler/typecheck/TcPat.lhs
docs/users_guide/glasgow_exts.xml
testsuite/tests/patsyn/should_compile/ImpExp_Exp.hs [moved from testsuite/tests/patsyn/should_fail/T8961a.hs with 58% similarity]
testsuite/tests/patsyn/should_compile/ImpExp_Imp.hs [moved from testsuite/tests/patsyn/should_fail/T8961.hs with 84% similarity]
testsuite/tests/patsyn/should_compile/all.T
testsuite/tests/patsyn/should_fail/T8961.stderr [deleted file]
testsuite/tests/patsyn/should_fail/all.T

index b7f8d2e..de60fcb 100644 (file)
@@ -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
index 3d9e45c..5ed99ba 100644 (file)
@@ -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>.
@@ -1,4 +1,4 @@
 {-# LANGUAGE PatternSynonyms #-}
-module T8961a (pattern Single) where
+module ImpExp_Exp (pattern Single) where
 
 pattern Single x <- [x]
@@ -1,6 +1,6 @@
 module ShouldFail where
 
-import T8961a
+import ImpExp_Exp
 
 single :: [a] -> Maybe a
 single (Single x) = Just x
index 6a51bf5..c8a88c3 100644 (file)
@@ -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 (file)
index a58ee38..0000000
+++ /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
index b38776e..de5d6db 100644 (file)
@@ -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, [''])