From 48ff0843eee29313cc2da14c04dc57f6589ab040 Mon Sep 17 00:00:00 2001 From: Adam Gundry Date: Sat, 1 Oct 2016 17:56:58 -0400 Subject: Do not warn about unused underscore-prefixed fields (fixes Trac #12609) When DuplicateRecordFields is enabled, the mangling of selector names was causing them to be reported as unused even if prefixed by an underscore. This corrects the OccName used by the check. Test Plan: New test overloadedrecflds/should_compile/T12609 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2549 GHC Trac Issues: #12609 --- testsuite/tests/overloadedrecflds/should_compile/T12609.hs | 8 ++++++++ testsuite/tests/overloadedrecflds/should_compile/all.T | 1 + 2 files changed, 9 insertions(+) create mode 100644 testsuite/tests/overloadedrecflds/should_compile/T12609.hs (limited to 'testsuite') diff --git a/testsuite/tests/overloadedrecflds/should_compile/T12609.hs b/testsuite/tests/overloadedrecflds/should_compile/T12609.hs new file mode 100644 index 0000000000..7b8205bc48 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_compile/T12609.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE DuplicateRecordFields #-} +{-# OPTIONS_GHC -Werror -Wunused-top-binds #-} +module Main (main, T(MkT)) where + +data T = MkT { _x :: Int } + +main :: IO () +main = return () diff --git a/testsuite/tests/overloadedrecflds/should_compile/all.T b/testsuite/tests/overloadedrecflds/should_compile/all.T index ea5baf899e..264fa115e4 100644 --- a/testsuite/tests/overloadedrecflds/should_compile/all.T +++ b/testsuite/tests/overloadedrecflds/should_compile/all.T @@ -1 +1,2 @@ test('T11173', extra_clean(['T11173a.hi', 'T11173a.o']), multimod_compile, ['T11173', '-v0']) +test('T12609', normal, compile, ['']) -- cgit v1.2.1