diff options
author | Seraphime Kirkovski <kirkseraph@gmail.com> | 2016-07-01 14:30:10 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-07-04 23:35:25 +0200 |
commit | 2a3af15270d1c04745b1c42e61bf4d5f6dbc8ad5 (patch) | |
tree | 038d795124ef0d5587e93205d61fc66539bffaf1 /testsuite/tests | |
parent | afec447cde1f97438bbc5bf7a31000e948c721eb (diff) | |
download | haskell-2a3af15270d1c04745b1c42e61bf4d5f6dbc8ad5.tar.gz |
Treat duplicate pattern synonym signatures as an error
Fixes issue T12165 by banning duplicate pattern synonyms
signatures. This seems to me the best solution because:
1) it is coherent with the way we treat other duplicate signatures
2) the typechecker currently doesn't try to apply a second
signature to a pattern to see if it matches, probably because
it assumes there is no more than one signature per object.
Test Plan: ./validate
Reviewers: goldfire, austin, mpickering, bgamari
Reviewed By: mpickering, bgamari
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D2361
GHC Trac Issues: #12165
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T12165.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T12165.stderr | 5 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T12165.hs b/testsuite/tests/patsyn/should_fail/T12165.hs new file mode 100644 index 0000000000..0fbf964651 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T12165.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE PatternSynonyms #-} +module ShouldFail where + +pattern P :: a -> b -> Maybe (a,b) +pattern P :: foo => bar => blah -> urgh +pattern P x y = Just (x, y) diff --git a/testsuite/tests/patsyn/should_fail/T12165.stderr b/testsuite/tests/patsyn/should_fail/T12165.stderr new file mode 100644 index 0000000000..881e46905e --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T12165.stderr @@ -0,0 +1,5 @@ + +T12165.hs:5:9: error: + Duplicate pattern synonym signatures for āPā + at T12165.hs:4:9 + T12165.hs:5:9 diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 658a5c0d96..fe0922c882 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -31,3 +31,4 @@ test('T11053', normal, compile, ['-fwarn-missing-pattern-synonym-signatures']) test('T10426', normal, compile_fail, ['']) test('T11265', normal, compile_fail, ['']) test('T11667', normal, compile_fail, ['']) +test('T12165', normal, compile_fail, ['']) |