diff options
author | Adam Gundry <adam@well-typed.com> | 2015-11-19 12:53:46 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-11-19 13:24:32 +0100 |
commit | 2442038554440923179d532137199d5290875cff (patch) | |
tree | 5a5f90dc1a0059465f2d4e47cc52beeb08e92d51 /compiler | |
parent | a586622c5386610e8ceffca7ef1efdf33d753587 (diff) | |
download | haskell-2442038554440923179d532137199d5290875cff.tar.gz |
Fix interaction of DuplicateRecordFields and GHC.Generics
This prevents GHC.Generics from exposing mangled selector names
when used on a datatype defined with DuplicateRecordFields enabled.
Test Plan:
New test overloadedrecflds_generics, which tests that both
GHC.Generics and Data.Data use the correct field labels, not mangled
names.
Reviewers: kosmikus, simonpj, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1486
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/typecheck/TcGenGenerics.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/typecheck/TcGenGenerics.hs b/compiler/typecheck/TcGenGenerics.hs index 9a1c506b33..acb39de9e1 100644 --- a/compiler/typecheck/TcGenGenerics.hs +++ b/compiler/typecheck/TcGenGenerics.hs @@ -737,7 +737,7 @@ mkBindsMetaD fix_env tycon = (dtBinds, allConBinds, allSelBinds) loc = srcLocSpan (getSrcLoc tycon) mkStringLHS s = [mkSimpleHsAlt nlWildPat (nlHsLit (mkHsString s))] datacons = tyConDataCons tycon - datasels = map (map flSelector . dataConFieldLabels) datacons + datasels = map dataConFieldLabels datacons tyConName_user = case tyConFamInst_maybe tycon of Just (ptycon, _) -> tyConName ptycon @@ -756,7 +756,7 @@ mkBindsMetaD fix_env tycon = (dtBinds, allConBinds, allSelBinds) conFixity_matches c = [mkSimpleHsAlt nlWildPat (fixity c)] conIsRecord_matches _ = [mkSimpleHsAlt nlWildPat (nlHsVar true_RDR)] - selName_matches s = mkStringLHS (occNameString (nameOccName s)) + selName_matches fl = mkStringLHS (unpackFS (flLabel fl)) -------------------------------------------------------------------------------- |