Make unique auxiliary function names in deriving
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 5 Jul 2016 12:46:29 +0000 (13:46 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 5 Jul 2016 15:24:12 +0000 (16:24 +0100)
commit895eefa8447a2886e77fdedcbca8047263c88db7
tree067b91d5b15a370e5f059413d098dacdb50c7ab0
parent5f79394f628259403edf612ef109d8c0f4d7e67a
Make unique auxiliary function names in deriving

In deriving for Data, we make some auxiliary functions, but they
didn't always get distinct names (Trac #12245).  This patch fixes
it by using the same mechanism as for dictionary functions, namely
chooseUniqueOccTc.

Some assocated refactoring came along for the ride.
compiler/basicTypes/OccName.hs
compiler/typecheck/TcDeriv.hs
compiler/typecheck/TcGenDeriv.hs
compiler/typecheck/TcGenGenerics.hs
testsuite/tests/deriving/should_compile/T12245.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/all.T