summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. ERDI Gergo <gergo@erdi.hu>2014-11-02 14:06:24 +0800
committerDr. ERDI Gergo <gergo@erdi.hu>2014-11-02 14:06:24 +0800
commitff3cc2f12181070702485321975ce00f38add96d (patch)
tree0efd3add580aa8f72b485710ce71e3d17dd09596
parente5ba36080d08791f44e3bed37721f702e242af96 (diff)
downloadhaskell-wip/T9705.tar.gz
Tweak the error message for pattern synonym methods,wip/T9705
since they are disallowed both in class and instance declarations
-rw-r--r--compiler/rename/RnBinds.lhs2
-rw-r--r--testsuite/tests/patsyn/should_fail/T9705-1.hs (renamed from testsuite/tests/patsyn/should_fail/T9705.hs)0
-rw-r--r--testsuite/tests/patsyn/should_fail/T9705-1.stderr4
-rw-r--r--testsuite/tests/patsyn/should_fail/T9705-2.hs6
-rw-r--r--testsuite/tests/patsyn/should_fail/T9705-2.stderr4
-rw-r--r--testsuite/tests/patsyn/should_fail/T9705.stderr4
-rw-r--r--testsuite/tests/patsyn/should_fail/all.T3
7 files changed, 17 insertions, 6 deletions
diff --git a/compiler/rename/RnBinds.lhs b/compiler/rename/RnBinds.lhs
index 555d8333ec..c2489cbac9 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
index 54d1d00e7f..54d1d00e7f 100644
--- a/testsuite/tests/patsyn/should_fail/T9705.hs
+++ b/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 0000000000..abe4fe6ada
--- /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-2.hs b/testsuite/tests/patsyn/should_fail/T9705-2.hs
new file mode 100644
index 0000000000..463c94b4ff
--- /dev/null
+++ b/testsuite/tests/patsyn/should_fail/T9705-2.hs
@@ -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
index 0000000000..23f85fa8b5
--- /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 d9a3a495c9..0000000000
--- 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 298f23bf2a..ea671dcc58 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, [''])