diff options
author | Adam Gundry <adam@well-typed.com> | 2020-04-27 23:22:59 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-05-08 15:29:41 -0400 |
commit | 7a763cff78d2d4b23d05554e68138678cb4ba627 (patch) | |
tree | 16f7aabfff8879bc7cb027971f5d15fefddb1fce /testsuite | |
parent | 926d2aab83dc6068cba76f71a19b040eddc6dee9 (diff) | |
download | haskell-7a763cff78d2d4b23d05554e68138678cb4ba627.tar.gz |
Reject all duplicate declarations involving DuplicateRecordFields (fixes #17965)
This fixes a bug that resulted in some programs being accepted that used the same
identifier as a field label and another declaration, depending on the order they
appeared in the source code.
Diffstat (limited to 'testsuite')
3 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_fail/T17965.hs b/testsuite/tests/overloadedrecflds/should_fail/T17965.hs new file mode 100644 index 0000000000..b723637f23 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T17965.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE DuplicateRecordFields #-} +main = return () +newtype Record a = Record { f :: a -> a } +class C a where f :: a -> a diff --git a/testsuite/tests/overloadedrecflds/should_fail/T17965.stderr b/testsuite/tests/overloadedrecflds/should_fail/T17965.stderr new file mode 100644 index 0000000000..446913eda4 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/T17965.stderr @@ -0,0 +1,5 @@ + +T17965.hs:4:17: error: + Multiple declarations of âfâ + Declared at: T17965.hs:3:29 + T17965.hs:4:17 diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T index 92ff1f0015..bc3c0650d2 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/all.T +++ b/testsuite/tests/overloadedrecflds/should_fail/all.T @@ -32,3 +32,4 @@ test('hasfieldfail03', normal, compile_fail, ['']) test('T14953', [extra_files(['T14953_A.hs', 'T14953_B.hs'])], multimod_compile_fail, ['T14953', '']) test('DuplicateExports', normal, compile_fail, ['']) +test('T17965', normal, compile_fail, ['']) |