From ff3cc2f12181070702485321975ce00f38add96d Mon Sep 17 00:00:00 2001 From: "Dr. ERDI Gergo" Date: Sun, 2 Nov 2014 14:06:24 +0800 Subject: Tweak the error message for pattern synonym methods, since they are disallowed both in class and instance declarations --- compiler/rename/RnBinds.lhs | 2 +- testsuite/tests/patsyn/should_fail/T9705-1.hs | 3 +++ testsuite/tests/patsyn/should_fail/T9705-1.stderr | 4 ++++ testsuite/tests/patsyn/should_fail/T9705-2.hs | 6 ++++++ testsuite/tests/patsyn/should_fail/T9705-2.stderr | 4 ++++ testsuite/tests/patsyn/should_fail/T9705.hs | 3 --- testsuite/tests/patsyn/should_fail/T9705.stderr | 4 ---- testsuite/tests/patsyn/should_fail/all.T | 3 ++- 8 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 testsuite/tests/patsyn/should_fail/T9705-1.hs create mode 100644 testsuite/tests/patsyn/should_fail/T9705-1.stderr create mode 100644 testsuite/tests/patsyn/should_fail/T9705-2.hs create mode 100644 testsuite/tests/patsyn/should_fail/T9705-2.stderr delete mode 100644 testsuite/tests/patsyn/should_fail/T9705.hs delete mode 100644 testsuite/tests/patsyn/should_fail/T9705.stderr 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-1.hs b/testsuite/tests/patsyn/should_fail/T9705-1.hs new file mode 100644 index 0000000000..54d1d00e7f --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T9705-1.hs @@ -0,0 +1,3 @@ +{-# LANGUAGE PatternSynonyms #-} +class C a where + pattern P = () 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.hs b/testsuite/tests/patsyn/should_fail/T9705.hs deleted file mode 100644 index 54d1d00e7f..0000000000 --- a/testsuite/tests/patsyn/should_fail/T9705.hs +++ /dev/null @@ -1,3 +0,0 @@ -{-# LANGUAGE PatternSynonyms #-} -class C a where - 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, ['']) -- cgit v1.2.1