diff options
author | Adam Gundry <adam@well-typed.com> | 2018-06-17 10:47:57 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-17 11:16:44 -0400 |
commit | ccd8ce405db89142932daea3fdace8814b110798 (patch) | |
tree | 47ce56a9d5685312d0e70ea7a2e711090a129c27 /testsuite/tests/overloadedrecflds | |
parent | 9897440ec9fbf17fb609e9a0d9456861c5f7f24a (diff) | |
download | haskell-ccd8ce405db89142932daea3fdace8814b110798.tar.gz |
Handle DuplicateRecordFields correctly in filterImports (fixes #14487)
filterImports needed a small adjustment to correctly handle record field
definitions arising from modules with DuplicateRecordFields enabled.
Previously hiding fields was not possible with DuplicateRecordFields enabled.
Test Plan: new test rename/should_compile/T14487
Reviewers: bgamari
Subscribers: simonpj, rwbarton, thomie, carter
GHC Trac Issues: #14487
Differential Revision: https://phabricator.haskell.org/D4805
Diffstat (limited to 'testsuite/tests/overloadedrecflds')
3 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/overloadedrecflds/should_fail/DuplicateExports.hs b/testsuite/tests/overloadedrecflds/should_fail/DuplicateExports.hs new file mode 100644 index 0000000000..e433e4aef2 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/DuplicateExports.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE DuplicateRecordFields #-} +{-# OPTIONS_GHC -Werror=duplicate-exports #-} + +-- This should warn about the duplicate export of foo, but not the +-- exports of the two different bar fields. +module Export (T(foo, bar), foo, S(bar)) where + +data T = MkT { foo :: Int, bar :: Int } +data S = MkS { bar :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_fail/DuplicateExports.stderr b/testsuite/tests/overloadedrecflds/should_fail/DuplicateExports.stderr new file mode 100644 index 0000000000..e2bdef49ab --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/DuplicateExports.stderr @@ -0,0 +1,3 @@ + +DuplicateExports.hs:6:29: error: [-Wduplicate-exports (in -Wdefault), -Werror=duplicate-exports] + ‘foo’ is exported by ‘foo’ and ‘T(foo, bar)’ diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T index 3e6c121de0..92ff1f0015 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/all.T +++ b/testsuite/tests/overloadedrecflds/should_fail/all.T @@ -31,3 +31,4 @@ test('hasfieldfail02', normal, compile_fail, ['']) test('hasfieldfail03', normal, compile_fail, ['']) test('T14953', [extra_files(['T14953_A.hs', 'T14953_B.hs'])], multimod_compile_fail, ['T14953', '']) +test('DuplicateExports', normal, compile_fail, ['']) |