[commit: ghc] wip/T9705: Tweak the error message for pattern synonym methods, since they are disallowed both in class and instance declarations (ff3cc2f)

git at git.haskell.org git at git.haskell.org
Sun Nov 2 06:07:57 UTC 2014


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

On branch  : wip/T9705
Link       : http://ghc.haskell.org/trac/ghc/changeset/ff3cc2f12181070702485321975ce00f38add96d/ghc

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

commit ff3cc2f12181070702485321975ce00f38add96d
Author: Dr. ERDI Gergo <gergo at erdi.hu>
Date:   Sun Nov 2 14:06:24 2014 +0800

    Tweak the error message for pattern synonym methods,
    since they are disallowed both in class and instance declarations


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

ff3cc2f12181070702485321975ce00f38add96d
 compiler/rename/RnBinds.lhs                                 | 2 +-
 testsuite/tests/patsyn/should_fail/{T9705.hs => T9705-1.hs} | 0
 testsuite/tests/patsyn/should_fail/T9705-1.stderr           | 4 ++++
 testsuite/tests/patsyn/should_fail/{T9705.hs => T9705-2.hs} | 3 +++
 testsuite/tests/patsyn/should_fail/T9705-2.stderr           | 4 ++++
 testsuite/tests/patsyn/should_fail/T9705.stderr             | 4 ----
 testsuite/tests/patsyn/should_fail/all.T                    | 3 ++-
 7 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index 555d833..c2489cb 100644
--- a/compiler/rename/RnBinds.lhs
+++ b/compiler/rename/RnBinds.lhs
@@ -1068,7 +1068,7 @@ methodBindErr mbind
 
 methodPatSynErr :: HsBindLR RdrName RdrName -> SDoc
 methodPatSynErr mbind
- =  hang (ptext (sLit "Pattern synonyms not allowed in instance declarations"))
+ =  hang (ptext (sLit "Pattern synonyms not allowed in class/instance declarations"))
        2 (ppr mbind)
 
 bindsInHsBootFile :: LHsBindsLR Name RdrName -> SDoc
diff --git a/testsuite/tests/patsyn/should_fail/T9705.hs b/testsuite/tests/patsyn/should_fail/T9705-1.hs
similarity index 100%
copy from testsuite/tests/patsyn/should_fail/T9705.hs
copy to testsuite/tests/patsyn/should_fail/T9705-1.hs
diff --git a/testsuite/tests/patsyn/should_fail/T9705-1.stderr b/testsuite/tests/patsyn/should_fail/T9705-1.stderr
new file mode 100644
index 0000000..abe4fe6
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/T9705-1.stderr
@@ -0,0 +1,4 @@
+
+T9705-1.hs:3:5:
+    Pattern synonyms not allowed in class/instance declarations
+      pattern P = ()
diff --git a/testsuite/tests/patsyn/should_fail/T9705.hs b/testsuite/tests/patsyn/should_fail/T9705-2.hs
similarity index 64%
rename from testsuite/tests/patsyn/should_fail/T9705.hs
rename to testsuite/tests/patsyn/should_fail/T9705-2.hs
index 54d1d00..463c94b 100644
--- a/testsuite/tests/patsyn/should_fail/T9705.hs
+++ b/testsuite/tests/patsyn/should_fail/T9705-2.hs
@@ -1,3 +1,6 @@
 {-# LANGUAGE PatternSynonyms #-}
 class C a where
+    method :: a
+
+instance C Int where
     pattern P = ()
diff --git a/testsuite/tests/patsyn/should_fail/T9705-2.stderr b/testsuite/tests/patsyn/should_fail/T9705-2.stderr
new file mode 100644
index 0000000..23f85fa
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/T9705-2.stderr
@@ -0,0 +1,4 @@
+
+T9705-2.hs:6:5:
+    Pattern synonyms not allowed in class/instance declarations
+      pattern P = ()
diff --git a/testsuite/tests/patsyn/should_fail/T9705.stderr b/testsuite/tests/patsyn/should_fail/T9705.stderr
deleted file mode 100644
index d9a3a49..0000000
--- a/testsuite/tests/patsyn/should_fail/T9705.stderr
+++ /dev/null
@@ -1,4 +0,0 @@
-
-T9705.hs:3:5:
-    Pattern synonyms not allowed in instance declarations
-      pattern P = ()
diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T
index 298f23b..ea671dc 100644
--- a/testsuite/tests/patsyn/should_fail/all.T
+++ b/testsuite/tests/patsyn/should_fail/all.T
@@ -6,4 +6,5 @@ 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, [''])
-test('T9705', normal, compile_fail, [''])
+test('T9705-1', normal, compile_fail, [''])
+test('T9705-2', normal, compile_fail, [''])



More information about the ghc-commits mailing list