summaryrefslogtreecommitdiff
path: root/compiler/GHC/Tc/Gen
diff options
context:
space:
mode:
authorAdam Gundry <adam@well-typed.com>2020-12-02 22:35:52 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-16 04:34:43 -0500
commit1109896c26d183df5fca0058191ea5a0e300e286 (patch)
tree482a29305393d1aa02af979ec557f080eb521ee4 /compiler/GHC/Tc/Gen
parent2521b041bff00458cb2c84b8747ea60d6991e329 (diff)
downloadhaskell-1109896c26d183df5fca0058191ea5a0e300e286.tar.gz
Make sure HasField use counts for -Wunused-top-binds
This is a small fix that depends on the previous commit, because it corrected the rnExpr free variable calculation for HsVars which refer to ambiguous fields. Fixes #19213.
Diffstat (limited to 'compiler/GHC/Tc/Gen')
-rw-r--r--compiler/GHC/Tc/Gen/Head.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/GHC/Tc/Gen/Head.hs b/compiler/GHC/Tc/Gen/Head.hs
index eb5da5ca26..3d6d51ff22 100644
--- a/compiler/GHC/Tc/Gen/Head.hs
+++ b/compiler/GHC/Tc/Gen/Head.hs
@@ -546,7 +546,9 @@ finish_ambiguous_selector lr@(L _ rdr) parent_type
Nothing -> failWithTc (fieldNotInType parent rdr) ;
Just gre ->
+ -- See Note [Unused name reporting and HasField] in GHC.Tc.Instance.Class
do { addUsedGRE True gre
+ ; keepAlive (greMangledName gre)
; return (greMangledName gre) } } } } }
-- This field name really is ambiguous, so add a suitable "ambiguous