diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-03-21 17:21:15 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-03-21 17:34:52 +0000 |
commit | 411a97e2c0083529b4259d0cad8f453bae110dee (patch) | |
tree | c84731b7c3bb2513910da88a2e782edd6dcce5c9 /testsuite/tests/patsyn | |
parent | 49ac3f0f2a13f66fea31a258fa98b0de39bfbf10 (diff) | |
download | haskell-411a97e2c0083529b4259d0cad8f453bae110dee.tar.gz |
Allow as-patterns in unidirectional patttern synonyms
This patch implements GHC Proposal #94, described here
https://github.com/ghc-proposals/ghc-proposals/pull/94
The effect is simply to lift a totally-undocumented restriction to
unidirecional pattern synonyms, namely that they can't have as-patterns
or n+k patterns.
The fix is easy: just remove the checks.
I also took the opportunity to improve the manual entry for
the semantics of pattern matching for pattern synonyms.
Diffstat (limited to 'testsuite/tests/patsyn')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/as-pattern.hs | 1 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/as-pattern.stderr | 5 |
3 files changed, 2 insertions, 6 deletions
diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 0f4c608169..d3a0a9b771 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -1,7 +1,7 @@ test('mono', normal, compile_fail, ['']) test('unidir', normal, compile_fail, ['']) test('local', normal, compile_fail, ['']) -test('as-pattern', normal, compile_fail, ['']) +test('as-pattern', normal, compile, ['']) test('T9161-1', normal, compile_fail, ['']) test('T9161-2', normal, compile_fail, ['']) test('T9705-1', normal, compile_fail, ['']) diff --git a/testsuite/tests/patsyn/should_fail/as-pattern.hs b/testsuite/tests/patsyn/should_fail/as-pattern.hs index 2794bed16a..f3ec9c9029 100644 --- a/testsuite/tests/patsyn/should_fail/as-pattern.hs +++ b/testsuite/tests/patsyn/should_fail/as-pattern.hs @@ -1,4 +1,5 @@ {-# LANGUAGE PatternSynonyms #-} module ShouldFail where +-- This is now ok (following GHC proposal #94) pattern P x y <- x@(Just y) diff --git a/testsuite/tests/patsyn/should_fail/as-pattern.stderr b/testsuite/tests/patsyn/should_fail/as-pattern.stderr deleted file mode 100644 index 61df61742e..0000000000 --- a/testsuite/tests/patsyn/should_fail/as-pattern.stderr +++ /dev/null @@ -1,5 +0,0 @@ - -as-pattern.hs:4:18: error: - ā¢ Pattern synonym definition cannot contain as-patterns (@): - x@(Just y) - ā¢ In the declaration for pattern synonym āPā |