diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-08-22 09:28:49 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-08-22 09:28:49 -0400 |
commit | a89bb806c58d3e601b37d6f2c4ebec6514fd2776 (patch) | |
tree | b2bef8ba5b726ac2ef726ec29eee5d6b592a93b8 /testsuite/tests/patsyn | |
parent | 6982ee99fb97c252c3faf37faae34131fb66f67c (diff) | |
download | haskell-a89bb806c58d3e601b37d6f2c4ebec6514fd2776.tar.gz |
Fix #14114 by checking for duplicate vars on pattern synonym RHSes
Summary:
Because we weren't checking for duplicate variables on the right-hand
sides of pattern synonyms, bogus definitions like this one passed the renamer:
```lang=haskell
pattern Foo a <- (a,a)
```
Luckily, the fix is simple.
Test Plan: make test TEST=T14114
Reviewers: mpickering, austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, thomie
GHC Trac Issues: #14114
Differential Revision: https://phabricator.haskell.org/D3866
Diffstat (limited to 'testsuite/tests/patsyn')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T14114.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T14114.stderr | 18 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T14114.hs b/testsuite/tests/patsyn/should_fail/T14114.hs new file mode 100644 index 0000000000..b1fb8e6575 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T14114.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE PatternSynonyms #-} +module T14114 where + +pattern Foo1 a <- (a,a) +pattern Foo2 a = (a,a) +pattern Foo3 a <- (a,a) where + Foo3 a = (a,a) diff --git a/testsuite/tests/patsyn/should_fail/T14114.stderr b/testsuite/tests/patsyn/should_fail/T14114.stderr new file mode 100644 index 0000000000..a93b51e8f4 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T14114.stderr @@ -0,0 +1,18 @@ + +T14114.hs:4:20: error: + • Conflicting definitions for ‘a’ + Bound at: T14114.hs:4:20 + T14114.hs:4:22 + • In a pattern synonym declaration + +T14114.hs:5:20: error: + • Conflicting definitions for ‘a’ + Bound at: T14114.hs:5:20 + T14114.hs:5:22 + • In a pattern synonym declaration + +T14114.hs:6:20: error: + • Conflicting definitions for ‘a’ + Bound at: T14114.hs:6:20 + T14114.hs:6:22 + • In a pattern synonym declaration diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 86ec79a50c..92989cf060 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -36,3 +36,4 @@ test('T12819', normal, compile_fail, ['']) test('UnliftedPSBind', normal, compile_fail, ['']) test('T13349', normal, compile_fail, ['']) test('T13470', normal, compile_fail, ['']) +test('T14114', normal, compile_fail, ['']) |