Reify DuplicateRecordFields by label, rather than by selector
authorAdam Gundry <adam@well-typed.com>
Thu, 17 Dec 2015 11:19:23 +0000 (12:19 +0100)
committerBen Gamari <ben@smart-cactus.org>
Thu, 17 Dec 2015 11:54:33 +0000 (12:54 +0100)
commit4b161c93dba774cc8051cf40a2024ad86f3259f2
treefb68bc97fff554f46c04538d6e9e2efaaa098fa3
parentcab131624ad0cdd54e2f3a70f93c1bd574ccf102
Reify DuplicateRecordFields by label, rather than by selector

See `Note [Reifying field labels]` in `TcSplice`. This makes
typical uses of TH work better with `DuplicateRecordFields`.
If `reify` is called on the `Name` of a field label produced by
the output of a previous `reify`, and there are multiple  fields
with that label defined in the same module, it may fail with
an ambiguity error.

Test Plan:
Added tests, and manually tested that this makes
Aeson's `deriveJSON` avoid the `$sel:` prefixes.

Reviewers: simonpj, goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1586

GHC Trac Issues: #11103
compiler/typecheck/TcSplice.hs
testsuite/tests/overloadedrecflds/should_fail/T11103.hs [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/T11103.stderr [new file with mode: 0644]
testsuite/tests/overloadedrecflds/should_fail/all.T
testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun04.hs
testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun04.stdout