diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2015-09-24 00:51:19 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-09-24 00:52:14 -0700 |
commit | b08a533dc87423a75bce037eb403d7828d3330d3 (patch) | |
tree | 0c899fe660bf73c8f31f71eecae1ec0d6280aea6 /testsuite/tests/deriving | |
parent | 2440e3c6b479ac532e2660374a78c8482e903bed (diff) | |
download | haskell-b08a533dc87423a75bce037eb403d7828d3330d3.tar.gz |
Fix DeriveGeneric for types with same OccName (#10487)
Summary:
DeriveGeneric generates some data types (for data type constructors and for
selectors of those constructors) and instances for those types. This patch
changes name generation for these new types to make it working with data types
with same names imported from different modules and with data types with same
names imported from same modules(using module imports).
Bonus content:
- Some refactoring in `TcGenGenerics.metaTyConsToDerivStuff` to remove some
redundant partial function applications and to remove a duplicated function.
- Remove some unused names from `OccName`. (those were used for an old
implementation of `DeriveGeneric`)
Reviewers: kosmikus, simonpj, dreixel, ezyang, bgamari, austin
Reviewed By: bgamari, austin
Subscribers: ezyang, thomie
Differential Revision: https://phabricator.haskell.org/D1081
GHC Trac Issues: #10487
Diffstat (limited to 'testsuite/tests/deriving')
-rw-r--r-- | testsuite/tests/deriving/should_compile/T10487.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_compile/T10487_M.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/deriving/should_compile/all.T | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/testsuite/tests/deriving/should_compile/T10487.hs b/testsuite/tests/deriving/should_compile/T10487.hs new file mode 100644 index 0000000000..473a1b37ef --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T10487.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE StandaloneDeriving, DeriveGeneric #-} + +module T10487 where + +import GHC.Generics + +import qualified T10487_M as M + +data Name = Name + +deriving instance Generic Name +deriving instance Generic M.Name diff --git a/testsuite/tests/deriving/should_compile/T10487_M.hs b/testsuite/tests/deriving/should_compile/T10487_M.hs new file mode 100644 index 0000000000..dc75fb2930 --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T10487_M.hs @@ -0,0 +1,3 @@ +module T10487_M where + +data Name = Name diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index b1cf3bc475..9ffa07df3d 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -55,4 +55,4 @@ test('T9359', normal, compile, ['']) test('T4896', normal, compile, ['']) test('T7947', extra_clean(['T7947a.o', 'T7947a.hi', 'T7947b.o', 'T7947b.hi']), multimod_compile, ['T7947', '-v0']) test('T10561', normal, compile_fail, ['']) - +test('T10487', extra_clean(['T10487_M.o', 'T10487_M.hi']), multimod_compile, ['T10487', '-v0']) |