Tweak the error message for pattern synonym methods,
authorDr. ERDI Gergo <gergo@erdi.hu>
Sun, 2 Nov 2014 06:06:24 +0000 (14:06 +0800)
committerDr. ERDI Gergo <gergo@erdi.hu>
Sun, 2 Nov 2014 06:08:01 +0000 (14:08 +0800)
since they are disallowed both in class and instance declarations

compiler/rename/RnBinds.lhs
testsuite/tests/patsyn/should_fail/T9705-1.hs [moved from testsuite/tests/patsyn/should_fail/T9705.hs with 100% similarity]
testsuite/tests/patsyn/should_fail/T9705-1.stderr [new file with mode: 0644]
testsuite/tests/patsyn/should_fail/T9705-2.hs [new file with mode: 0644]
testsuite/tests/patsyn/should_fail/T9705-2.stderr [new file with mode: 0644]
testsuite/tests/patsyn/should_fail/T9705.stderr [deleted file]
testsuite/tests/patsyn/should_fail/all.T

index 555d833..c2489cb 100644 (file)
@@ -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-1.stderr b/testsuite/tests/patsyn/should_fail/T9705-1.stderr
new file mode 100644 (file)
index 0000000..abe4fe6
--- /dev/null
@@ -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-2.hs b/testsuite/tests/patsyn/should_fail/T9705-2.hs
new file mode 100644 (file)
index 0000000..463c94b
--- /dev/null
@@ -0,0 +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 (file)
index 0000000..23f85fa
--- /dev/null
@@ -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 (file)
index d9a3a49..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-
-T9705.hs:3:5:
-    Pattern synonyms not allowed in instance declarations
-      pattern P = ()
index 298f23b..ea671dc 100644 (file)
@@ -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, [''])